Home #SNMP Design: One API Design Flaw

#SNMP Design: One API Design Flaw

When I reviewed the message classes, I suddenly realized that there is a design flaw. Do you notice?

Let’s forget about existing code, and think about this case. You want to query system description from two agents in the network, so how to write some code? Probably this is the simplest code,

Message message = new Message(/* arguments */);

Therefore, when you create the message instance the IP address should not be specified. Yes, the current design fails to support this simple use case, which is obviously a design flaw. But why I did not realize this flaw earlier? Why the early design is like this? That is because TrapV1Message was the first message class, and to create its instance an IP address must be specified. Now I fully understand why people think SNMP v1 TRAP is a bad thing, it does not fit in to the whole image.

At this moment, I don’t want to change the existing code because TwinTower is almost ready. Thus, this change will be introduced for CrossRoad. OK, next time I may provide backward compatibility (current APIs will still be available but marked as obsolete while new APIs are introduced side by side. Time after time, I will remove obsolete code so you have time to prepare the migration).

Stay tuned.

© Lex Li. All rights reserved. The code included is licensed under CC BY 4.0 unless otherwise noted.

Important Notice

#SNMP Design: Specification Document Draft Published