Name Conventions
-
Colin Angus Mackay wrote:
GetValue() in .NET
I'd disagree - for a start I always use getValue, and second off, all the M$ events I've been to recently have had their people using it too... But at the end of the day, I'd say it's COMPLETELY personal preference :)
"Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox
RichardGrimmer wrote:
I'd say it's COMPLETELY personal preference
Actually, I'd say it's the preference of whoever will own the code you're writing. If you only code for yourself, then you are correct, if you're coding for others, you should follow their standards, practices, and guidelines. And in my experience, most places that actually understand the concepts of standards and practices tend to follow the guidelines that Christian has already stated. Making them good habits to get into.
Grim
(aka Toby)
MCDBA, MCSD, MCP+SB
SELECT * FROM users WHERE clue IS NOT NULL GO
(0 row(s) affected)
-
Use getValue() in Java and GetValue() in .NET
Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos
I prefer GetValue() in .NET too. However, if I am trying to port getter/setter methods written in Java to .NET, it is better for me to write them in property syntax. eg (C#):
private int value; /// /// Get and set the value /// public int Value { get { return value; } set { if (this.value != value) this.value = value); } }
You can refer MS website regarding. http://msdn2.microsoft.com/en-us/ms229002(VS.80).aspx[^] :)I like you, and I love programming more.
-
Hello, When i should to name method with uppercase letter and when not? When I should use getValue() and when GetValue()? Thanks.
The problem is more with the name than that case. As long as you consistently use the same casing you won't have a problem. You should pick a better name than GetValue, though. Pick a name that indicates what you are getting - all of your accessor functions are going to "get a value" of some kind. I had a guy a while back who thought it was funny to give his stuff names like "process_something" and "my_string"... this bites you in the ass pretty quick.
"Quality Software since 1983!"
http://www.smoothjazzy.com/ - see the "Programming" section for freeware tools and articles. -
Hello, When i should to name method with uppercase letter and when not? When I should use getValue() and when GetValue()? Thanks.
I reckon if you use .NET you should stick with The Guidelines - Design Guidelines, Managed code and the .NET Framework[^]
-
How about in VB ? ;P
"Courage choose who will follow, Fate choose who will lead" - Lord Gunner, Septerra Core "Press any key to continue, where's the ANY key ?" - Homer Simpsons Drinking gives me amazing powers of insight. I can solve all the worlds problems when drunk, but can never remember the solutions in the morning. - Michael P Butler to Paul Watson on 12/08/03
Wouldn't that be: GETVALUE() ;)
Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!
-
Steve Hansen wrote:
However, an underscore in any other position in an element name is CLS-compliant.
I understood this as
_element
is invalid, butelement_
,my_element
etc are OK.Steve Hansen wrote:
So it only matters for public properties/methods which I don't think they do.
Agreed.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
dnh wrote:
I understood this as _element is invalid, but element_, my_element etc are OK.
All ugly and should be banned! ;)
Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!
-
Use getValue() in Java and GetValue() in .NET
Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos
Follow a consistent approach regardless of any language. The standardization of naming conventions should be organization-wide and not restricted to any language. Following are the advantages of adhering to common standards: • Programmers can go into any code and figure out the code easily and fast. • New people can get up to speed quickly. • People make fewer mistakes in consistent environments. • Increase the readability and maintainability of the code and hence the productivity of the team. So I would suggest you standardize the coding standards. :rolleyes: I hope this was helpful to you.... Thanks, Nilesh Bhatkhalkar
Cheers, Nilesh Prakash Bhatkhalkar
-
Follow a consistent approach regardless of any language. The standardization of naming conventions should be organization-wide and not restricted to any language. Following are the advantages of adhering to common standards: • Programmers can go into any code and figure out the code easily and fast. • New people can get up to speed quickly. • People make fewer mistakes in consistent environments. • Increase the readability and maintainability of the code and hence the productivity of the team. So I would suggest you standardize the coding standards. :rolleyes: I hope this was helpful to you.... Thanks, Nilesh Bhatkhalkar
Cheers, Nilesh Prakash Bhatkhalkar
NileshBhatkhalkar wrote:
The standardization of naming conventions should be organization-wide and not restricted to any language.
That's nice in theory, but if you look at the standard for Java and the standard for .NET you'll see they are different. If you implement an organisation wide standard that ignores the language you'll end up with two standards in one piece of code. One standard defined by your organisation and one standard defined by the language vendor. I've worked in a company that did that and quite frankly the code was a mess. When I moved to a new language I didn't immediately know where the framework stopped and the company's code started and I got myself in to a right mess when trying to figure out how to call stuff.
NileshBhatkhalkar wrote:
I hope this was helpful to you....
Sorry, but experience has taught me that this is not the way to go. Be as consistent as possible by all means, but yield to the existing standards defined by the language vendor if need be.
Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos
-
Paul Selormey wrote:
Wrong, it is because CLS==language independence, a feature it boasts off over Java bytecode.
True -and to make it language independant, they needed to make it case insensitive. Which languages are case insensitive ?
Paul Selormey wrote:
BTW, it is your perfect C# compiler that will complain.
Of course it will. The VB.NET compiler is too stupid to see a difference between var, Var and VAR to start with.
Paul Selormey wrote:
just remove the CLS compliant attribute,
I've been known to do that, actually
Paul Selormey wrote:
and stop blaming VB for your bugs
ROTFL - you're obviously kidding around, but either way, I think a language being case insensitive is just plain dumb. It's obviously a 'feature' added to VB.NET to make it easier, it's not something that has a real advantage beyond that.
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
Christian Graus wrote:
Which languages are case insensitive ?
Maybe for the .NET languages you have access to VB.NET. I know of at least Fortran and there is a .NET version.
Christian Graus wrote:
Of course it will. The VB.NET compiler is too stupid to see a difference between var, Var and VAR to start with.
Of what value is the claim that var, Var and VAR are different? Windows is not case sensitive does not make it dump because UNIX/Linux is.
Christian Graus wrote:
ROTFL - you're obviously kidding around, but either way, I think a language being case insensitive is just plain dumb.
Fortran, SQL are case insensitive and I have never found them dump. They do just what they are designed to do and they do it perfectly. I used Fortran for both my MSc and PhD simulations work and never wished I used anything different.
Christian Graus wrote:
It's obviously a 'feature' added to VB.NET to make it easier, it's not something that has a real advantage beyond that.
Neither do I found the case sensitivity of C#/C/C++ to be off any special advantage. I will definitely not have method/function names like getValue and GetValue to mean different things in my code. If you will, simply accept that as a personal preference and has nothing to do with programming skill or whatever. The history of C, the mother of C#, tells you why they needed a case sensitivity. With love, Paul.
Jesus Christ is LOVE! Please tell somebody.
-
I reckon if you use .NET you should stick with The Guidelines - Design Guidelines, Managed code and the .NET Framework[^]
-
Christian Graus wrote:
Which languages are case insensitive ?
Maybe for the .NET languages you have access to VB.NET. I know of at least Fortran and there is a .NET version.
Christian Graus wrote:
Of course it will. The VB.NET compiler is too stupid to see a difference between var, Var and VAR to start with.
Of what value is the claim that var, Var and VAR are different? Windows is not case sensitive does not make it dump because UNIX/Linux is.
Christian Graus wrote:
ROTFL - you're obviously kidding around, but either way, I think a language being case insensitive is just plain dumb.
Fortran, SQL are case insensitive and I have never found them dump. They do just what they are designed to do and they do it perfectly. I used Fortran for both my MSc and PhD simulations work and never wished I used anything different.
Christian Graus wrote:
It's obviously a 'feature' added to VB.NET to make it easier, it's not something that has a real advantage beyond that.
Neither do I found the case sensitivity of C#/C/C++ to be off any special advantage. I will definitely not have method/function names like getValue and GetValue to mean different things in my code. If you will, simply accept that as a personal preference and has nothing to do with programming skill or whatever. The history of C, the mother of C#, tells you why they needed a case sensitivity. With love, Paul.
Jesus Christ is LOVE! Please tell somebody.
Paul Selormey wrote:
I know of at least Fortran and there is a .NET version.
OK, I didn't know that. I wonder mow many computers used upper and lower case when FORTRAN was developed ?
Paul Selormey wrote:
The history of C, the mother of C#
You're totally wrong. C has nothing to do with C#, and C++ has next to nothing to do with C#. They are totally unrelated.
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
-
Follow a consistent approach regardless of any language. The standardization of naming conventions should be organization-wide and not restricted to any language. Following are the advantages of adhering to common standards: • Programmers can go into any code and figure out the code easily and fast. • New people can get up to speed quickly. • People make fewer mistakes in consistent environments. • Increase the readability and maintainability of the code and hence the productivity of the team. So I would suggest you standardize the coding standards. :rolleyes: I hope this was helpful to you.... Thanks, Nilesh Bhatkhalkar
Cheers, Nilesh Prakash Bhatkhalkar
-
Christian Graus wrote:
Which languages are case insensitive ?
Maybe for the .NET languages you have access to VB.NET. I know of at least Fortran and there is a .NET version.
Christian Graus wrote:
Of course it will. The VB.NET compiler is too stupid to see a difference between var, Var and VAR to start with.
Of what value is the claim that var, Var and VAR are different? Windows is not case sensitive does not make it dump because UNIX/Linux is.
Christian Graus wrote:
ROTFL - you're obviously kidding around, but either way, I think a language being case insensitive is just plain dumb.
Fortran, SQL are case insensitive and I have never found them dump. They do just what they are designed to do and they do it perfectly. I used Fortran for both my MSc and PhD simulations work and never wished I used anything different.
Christian Graus wrote:
It's obviously a 'feature' added to VB.NET to make it easier, it's not something that has a real advantage beyond that.
Neither do I found the case sensitivity of C#/C/C++ to be off any special advantage. I will definitely not have method/function names like getValue and GetValue to mean different things in my code. If you will, simply accept that as a personal preference and has nothing to do with programming skill or whatever. The history of C, the mother of C#, tells you why they needed a case sensitivity. With love, Paul.
Jesus Christ is LOVE! Please tell somebody.
Paul Selormey wrote:
The history of C, the mother of C#, tells you why they needed a case sensitivity.
Can you please say why?:)
Regards, --=A J E E S H=--
-
Paul Selormey wrote:
The history of C, the mother of C#, tells you why they needed a case sensitivity.
Can you please say why?:)
Regards, --=A J E E S H=--
Which part, that it is the mother of C#, or case sensitivity? With love, Paul.
Jesus Christ is LOVE! Please tell somebody.
-
Paul Selormey wrote:
I know of at least Fortran and there is a .NET version.
OK, I didn't know that. I wonder mow many computers used upper and lower case when FORTRAN was developed ?
Paul Selormey wrote:
The history of C, the mother of C#
You're totally wrong. C has nothing to do with C#, and C++ has next to nothing to do with C#. They are totally unrelated.
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
Christian Graus wrote:
You're totally wrong. C has nothing to do with C#, and C++ has next to nothing to do with C#. They are totally unrelated.
How about listening to the Guy who did it...[^] With love, Paul.
Jesus Christ is LOVE! Please tell somebody.
-
Christian Graus wrote:
You're totally wrong. C has nothing to do with C#, and C++ has next to nothing to do with C#. They are totally unrelated.
How about listening to the Guy who did it...[^] With love, Paul.
Jesus Christ is LOVE! Please tell somebody.
I don't care what the marketing speak is, anyone who knows anything about C++ and Java can tell that C# comes from Java. It's named C# to get people to associate it with C++. I've seen tons of people online who say 'C# is faster than VB.NET because it comes from C++'. Not so. Nor does it act like C++. It acts like Java.
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
-
Which part, that it is the mother of C#, or case sensitivity? With love, Paul.
Jesus Christ is LOVE! Please tell somebody.
Hi paul, Case sensitivity
Regards, --=A J E E S H=--
-
Wouldn't that be: GETVALUE() ;)
Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!
-
Hi paul, Case sensitivity
Regards, --=A J E E S H=--
Read the C-History...the abstract is enough.[^] Best regards, Paul.
Jesus Christ is LOVE! Please tell somebody.
-
Read the C-History...the abstract is enough.[^] Best regards, Paul.
Jesus Christ is LOVE! Please tell somebody.
Hi Paul Selormey, Thanks for the link.:)
Regards, --=A J E E S H=--