[AGENT++] SNMP classes design (SNMP++, SNMP4J, SNMP++.NET)

Marek Malowidzki malowidz at wil.waw.pl
Thu Aug 12 09:28:19 CEST 2004


----- Original Message ----- 
From: "Frank Fock" <fock at agentpp.com>
To: "Marek Malowidzki" <malowidz at wil.waw.pl>
Cc: <agentpp at agentpp.org>
Sent: Thursday, August 12, 2004 12:13 AM
Subject: Re: [AGENT++] SNMP classes design (SNMP++, SNMP4J, SNMP++.NET)


> Hi Marek,
>
> May be it's a question of taste, but having different classes for
different
> PDU types does not seem to be very object oriented for me. It is much
> easier to write generic tools for PDU processing when dealing with a
> single (or a small set) PDU class.
> SNMP v2 PDUs have been designed by the IETF to be of the same
> format, so why should we use different classes for the different types?

Indeed, this is a question of taste. However, there are some differences
between some PDU types, e.g., v1 trap or get-bulk.

> If you want to add functionality for a special PDU type, you can write
> an adapter class.
>
> What kind of functionality do you want to include in a PDU class?

No, I just mean some differences in the interface. The wire PDU format is
indeed the same but the meaning of some fields is different (e.g.,
get-bulk). The situation when you can call methods on some type that may be
unrelevant (and it depends on the current PDU object's content) is not too
elegant and generally violates the OO concept of a type interface (which
should be constant). For the current Pdu class, the pdu-type works as a
"union switch" that dynamically decides which part of the type's interface
is relevant and which is not.

Frank, I am not going to fight fiercely for the "pure OO design," I just
asked for the reasons. What I understand from your explanations, you have
decided that defining separate PDU classes was not worth doing - mainly, due
to small differences in the interface (and probably the differences in the
v1 trap did not justify it). Thus, instead of defining a number of PDU
classes, you decided to keep everything in a single class with addtional
"pdu-type" discriminator (property). Is this right?

Best regards,

Marek




More information about the AGENTPP mailing list