Question: naming of control classes

This forum is meant for questions and discussions about the XSharp Tools libraries, which contain code written by XSharp users that they want to share with others,
The development team is not responsible for this code

Moderator: wriedmann

FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Question: naming of control classes

Post by FFF »

Well, would say, a lot depends on the available intellisense possibilities. But I'm with W., it's a Pita if you always have to look for the using statements to see, what's in use.

K.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
SHirsch
Posts: 286
Joined: Tue Jan 30, 2018 8:23 am
Location: Germany

Question: naming of control classes

Post by SHirsch »

Hi,

I also prefer prefix.
In my framework all classes are prefixed 'kd' and postfixed with their special purpose (eg. kdSleWeight oder kdSleDate).

Stefan
MathiasHakansson
Posts: 50
Joined: Fri Feb 16, 2018 7:52 am

Question: naming of control classes

Post by MathiasHakansson »

An alternative could be to organize you namespaces so that you don't have to be afraid of them...

Accessing a Control by

XST.SLE.Date
XST.SLE.Password
XST.Combo.Check
XST.Combo.MultiSelect

It can be better to use namespaces instead of adding prefixes. If the names are short your code does not look ugly.

/Mathias
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Question: naming of control classes

Post by wriedmann »

Hi Mathias,

thank you very much for your suggestion!

Personally, I don't like to subdivide namespaces too much.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
TerryB1
Posts: 306
Joined: Wed Jan 03, 2018 11:58 am

Question: naming of control classes

Post by TerryB1 »

Hi Wolfgang
I think I’ve found where the confusion occurred.

In your original question you gave the following example:
Example: the tools version of the TextBox class could be named TextBoxXST, or XstTextBox.
I took this to mean that you were proposing an XstTextBox which could be either a WinForms Text Box or a WPF TextBox. Letting logic sort out which was which.
My point was that WPF controls and WinForms controls fall logically into separate namespaces anyway, so what not use them separately. Why bring them together under a single class name?

Sorry if I’ve confused things.
Terry
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Question: naming of control classes

Post by wriedmann »

Hi Terry,

I would follow what Microsoft did.
Unfortunately there are some controls with the same class name in both WPF and Windows Forms, but since you will probably not mix WinForms and WPF controls in the same window, this should be no major problem.

We will have a xsharp.tools.WPF.xstButton class and a xsharp.tools.windows.forms.xstButton class.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply