[kea-dev] Converting configuration back to JSON (unparsing)
Thomas Markwalder
tmark at isc.org
Thu Feb 23 19:55:11 UTC 2017
On 2/23/17 2:36 PM, Francis Dupont wrote:
> Thomas Markwalder writes:
>> Yes, D2 has an object hierarchy constructed from Elements via
>> SimpleParsers. It is contained in D2CfgContext.
> => fine!
>
>> The class is going to be named ToElement()?
> => CfgToElement but it is an abstract class so classes will derived
> from it.
>
>> Class names should be nouns, typically.
> => boost::noncopyable is a perfect counter-example.
Ok, yes they are also adjectives, which just lends credence to
Configurable for a class name.
My point is that objects that embody our configuration may have other
things in common
eventually besides just implementing a toElement() method.
>> Having it be ToElement::toElement() seems a bit off.
> => the only place you should get it is in a doxygen comment
> (and remember it is an instance method).
>
>> What about something more like Configurable which defines toElement()
>> method.
> => it is more Configured than Configurable but this does not catch
> the fact the derived class must implement a toElement() method.
> So ToElement seems a natural name.
If Configurable::toElement() is an abstract method it would be pretty
clear that anything deriving from it has to implement it. If that's the
criteria you would need a separate base class for every abstract method.
>
> I've just updated fdunparse private branch to these new names.
> And BTW there is no ToElement::toElement found by grep (:-).
>
> Thanks
>
> Francis Dupont <fdupont at isc.org>
>
> PS: for pretty print I believe a function is better (and less intrusive)
> than to extend an existing method. I'll take the corresponding ticket
> and change the code (and use it to not write whole configs for unit tests
> twice :-).
More information about the kea-dev
mailing list