Hello All,
when naming subclasses of controls and windows, I would like to use the standard control class name and a prefix or suffix.
Example: the tools version of the TextBox class could be named TextBoxXST, or XstTextBox.
What do you would prefer: prefix or suffix? My personal preference is to use a prefix.
And what should the prefix/postfix be? Here my personal preference would be Xst for XSharp Tools.
Thank you very much for suggestions/wishes!
Wolfgang
Question: naming of control classes
Moderator: wriedmann
Question: naming of control classes
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Question: naming of control classes
I think, i prever prefix, as this sorts naturally. And "X" would imho suffice
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Question: naming of control classes
Hi Karl,
thanks! You are right, an 'x' alone should be enough.
Wolfgang
thanks! You are right, an 'x' alone should be enough.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Question: naming of control classes
Hi All
I suggest a prefix - x alone is too limiting - Xst would give more scope for searches later.
Reason: You may want to find all Xst Controls whatever they may be: Just search for Xst.
OK so you could do that with x alone.
But suppose you want to group something else in your searches - x has gone as an option.
Xst or Xctl is easier to read and interpret.
Just a thought
Terry
I suggest a prefix - x alone is too limiting - Xst would give more scope for searches later.
Reason: You may want to find all Xst Controls whatever they may be: Just search for Xst.
OK so you could do that with x alone.
But suppose you want to group something else in your searches - x has gone as an option.
Xst or Xctl is easier to read and interpret.
Just a thought
Terry
Question: naming of control classes
I don't see, where x vs xst changes anything in search /sort, a prefix is a prefix..
Karl
Karl
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Question: naming of control classes
Wolfgang,
I would not choose a prefix. That makes things indeed more difficult to find in alphabetical completion lists etc.
I think the most important thing is to put the classes it in the right namespace. The class name itself should be meaningful. That's all I think. If you really want to add something to make the name unique, I would go for a suffix.
So you would have something like XSharp.Tools.Windows.Forms.TextBox, or XSharp.Tools.Windows.Forms.TextBoxEx or
XSharp.Tools.Windows.Forms.TextBoxXT
Robert
I would not choose a prefix. That makes things indeed more difficult to find in alphabetical completion lists etc.
I think the most important thing is to put the classes it in the right namespace. The class name itself should be meaningful. That's all I think. If you really want to add something to make the name unique, I would go for a suffix.
So you would have something like XSharp.Tools.Windows.Forms.TextBox, or XSharp.Tools.Windows.Forms.TextBoxEx or
XSharp.Tools.Windows.Forms.TextBoxXT
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Question: naming of control classes
Hi Robert,
the correct namespace is IMHO obvious, and a meaningful name is very important too - self documenting code is a must.
But since there will be using statements for both namespaces (for example System.Windows.Forms and XSharp.Tools.Windows.Forms) it is important to keep different names - to make it easier for the programmer to understand which controls are effectively used.
Your arguments for a suffix instead of a prefix are very valid! Until now, I have always used prefixes in both VO and X#, but I have to admit that I'm typing the names most of the time, and there a prefix comes handy, at least when it is short.
Thank you very much!
Wolfgang
the correct namespace is IMHO obvious, and a meaningful name is very important too - self documenting code is a must.
But since there will be using statements for both namespaces (for example System.Windows.Forms and XSharp.Tools.Windows.Forms) it is important to keep different names - to make it easier for the programmer to understand which controls are effectively used.
Your arguments for a suffix instead of a prefix are very valid! Until now, I have always used prefixes in both VO and X#, but I have to admit that I'm typing the names most of the time, and there a prefix comes handy, at least when it is short.
Thank you very much!
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Question: naming of control classes
Hi Karl
A prefix is a prefix - Yes.
It can also help to identify groupings:
Suppose you want to all controls on a global basis. You could search on basis of " Xst" or " x" I agree.
But what if your app had numerous Xml classes etc?
I have also read Roberts reply.
The question seems to be "Do you want to add something to make the name unique"?
Terry
A prefix is a prefix - Yes.
It can also help to identify groupings:
Suppose you want to all controls on a global basis. You could search on basis of " Xst" or " x" I agree.
But what if your app had numerous Xml classes etc?
I have also read Roberts reply.
The question seems to be "Do you want to add something to make the name unique"?
Terry
Question: naming of control classes
Hi Terry,
And unique names make the code also a lot easier to read (and this is one of the things I like very much in xBase languages: that they are easy to read even after years).
Wolfgang
IMHO this is absolutely necessary. In the other case there would be the need to fully qualify every type, both on declaration and initialization because in most cases both namespaces would be included in the source file.The question seems to be "Do you want to add something to make the name unique"?
And unique names make the code also a lot easier to read (and this is one of the things I like very much in xBase languages: that they are easy to read even after years).
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Question: naming of control classes
Just wondering: are you considering this for Windows Forms alone, or will it be extended to cover WPF controls.
Terry
Terry