[RFC] Solid and use of namespaces

Marcos Mayorga marcos at mm-studios.org
Mon May 22 14:39:41 BST 2006


> Marcos Mayorga wrote:
>> I would choose using namespaces to nest the classes.
>> Clearer code, best designed, improved readability and extensibility, and
>> over all, increases the level of abstraction, which is a key factor for
>> OOP.
>>
> Namespaces are a purely lexical feature, I fail to see how using them
> would "increase the level of abstraction".

lexical features makes abstraction a real thing, i.e. hungarian notation
(lpzsName) cuts away the abstraction of implement the variable Name with
other type than lpsz.


>> ie: I have nothing to do with the class PowerBattery related to 'power'
>> if you choo to use power::battery, a can later do a power::solar_panel,
>> and use functions insife power (like
>> power::have_i_supply_for_one_hour())
>> which abstract me on the specific power supply the instance is using.
>>
>>
> Seems to me you're confusing namespaces and polymorphism.

i don't think so, because in my example i solar_panel doesn't inherit from
battery, just reside in the same namespace, ok, power::have_i... function
would use polymorphism to resolve which class to use, but my point was
that all of these classes resides inside power namespace.


>
> --
> Guillaume
> http://telegraph-road.org
>
>






More information about the kde-core-devel mailing list