www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - What would be the best way to work with huge class hierarchies?

reply O/N/Src <ozan.sueel gmail.comies> writes:
Hi
I'm trying to bring a class hierarchy with a lot of classes in D 
style.
The original classes have sometimes identical names like "button" 
or "control".
With the namespaces I've classes like followings

ui.core.Button
...and subclasses like
ui.web.mobile.Button
ui.web.desktop.Button
ui.desktop.Button
and more like this.

Which would be the best way to bring them in the D world?

Apple-Style like UCButton, UWMButton, UWDButton, UDButton
MS-style with the use of namespaces (ui.web.mobile.Button, 
ui.web.desktop.Button)
Java like WebMobileButton, DesktopButton
?

Regards, Ozan
Jun 03 2016
parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 6/3/16 11:32 AM, O/N/Src wrote:
 Hi
 I'm trying to bring a class hierarchy with a lot of classes in D style.
 The original classes have sometimes identical names like "button" or
 "control".
 With the namespaces I've classes like followings

 ui.core.Button
 ....and subclasses like
 ui.web.mobile.Button
 ui.web.desktop.Button
 ui.desktop.Button
 and more like this.

 Which would be the best way to bring them in the D world?

 Apple-Style like UCButton, UWMButton, UWDButton, UDButton
 MS-style with the use of namespaces (ui.web.mobile.Button,
 ui.web.desktop.Button)
 Java like WebMobileButton, DesktopButton
 ?

 Regards, Ozan
D supports packages and modules. I would recommend using that to reproduce namespaces. When you are porting a library to D, best to use the same names as given in the original, not invent new ones. -Steve
Jun 03 2016