|
Ali I. wrote:
They say Programming is an 'art' why do they then ask us to follow these conventions... ?? Should'nt an artist (programmer) have free hand?
The main reason is that it's usually a group effort. If you always work alone, then it won't matter what conventions (if any) you follow. But in a group, it makes a difference.
Alvaro
Explain to the mothers & fathers of American servicemen that may come home in body bags why their son or daughter have to give up their life?" -- Sean Hannity, 1999.
|
|
|
|
|
End of the day... you are not the owner or the 'gate keeper' for the art. Sor, make the art understandable to the next person too - so follow some guidelines
"He that is good with a hammer tends to think everything is a nail." - Abraham Maslow
|
|
|
|
|
S P S wrote:
End of the day... you are not the owner or the 'gate keeper' for the art.
Depends on where you work and what your job function is. Since I am the only windows programmer in my department I am the only person responsible for the 500K+ lines of MFC code that I have written in my current job (since early 1997).
John
|
|
|
|
|
OK, exceptions ruled out
"He that is good with a hammer tends to think everything is a nail." - Abraham Maslow
|
|
|
|
|
Yep, a couple years ago when we were a real software development team, we came up with a pretty good coding standard. The funny part was reaching the consensus. All important points (use of smart pointers, STL, standard strings, documentation, ...) we resolved quickly and unanomously, and then lost weeks arguing where to put curly braces
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
On a new line, right? :P
regards,
Paul Watson
South Africa
Colib and WebTwoZero.
K(arl) wrote:
oh, and BTW, CHRISTIAN ISN'T A PARADOX, HE IS A TASMANIAN!
|
|
|
|
|
K & R brace style, like God intended.
Software Zen: delete this;
|
|
|
|
|
Hi coders..
What code casing style do you follow? you know we have number of them, e.g.,
camelCasing,
PascalCasing,
Finger_Breaking_Underscore,
DataTypeVariable etc.
To start the debate, I start with my experience. We use camelCasing most.
Not everything that can be counted counts and not everything that counts can be counted - Einstein
-- modified at 5:25 Monday 29th August, 2005
|
|
|
|
|
We prefer PascalCasing and think camelCasing is pretty horrible. However, we do use camelCasing for variable names, in line with .NET style recommendations. We do so by using a small set of well-defined prefixes, such as "my" to identify member variables. The lower case part of the camelCase will always be one of these informative prefixes.
Gavin Greig
"Haw, you're no deid," girned Charon. "Get aff ma boat or ah'll report ye."
Matthew Fitt - The Hoose O Haivers: The Twelve Trauchles O Heracles.
|
|
|
|
|
myDocuments.
ARGH!
(Apologies for this post not being constructive.)
regards,
Paul Watson
South Africa
Colib and WebTwoZero.
K(arl) wrote:
oh, and BTW, CHRISTIAN ISN'T A PARADOX, HE IS A TASMANIAN!
|
|
|
|
|
Yeah, we did swither a bit about it, but we went for it in the end. It may be associated with "My Documents" and also - perhaps more seriously - the forthcoming "My" namespace, but in the end it was a real word, it was short, and it indicates that the variable "belongs" to something (a class).
Gavin Greig
"Haw, you're no deid," girned Charon. "Get aff ma boat or ah'll report ye."
Matthew Fitt - The Hoose O Haivers: The Twelve Trauchles O Heracles.
|
|
|
|
|
Oh for sure, I think it is perfectly fine. I just know the VB and Fisher Windows haters out there will deride it for being like me and My Documents.
regards,
Paul Watson
South Africa
Colib and WebTwoZero.
K(arl) wrote:
oh, and BTW, CHRISTIAN ISN'T A PARADOX, HE IS A TASMANIAN!
|
|
|
|
|
I use camelCase for variable and method names, and PascalCase for class names. I don't prefix class names with C and do prefix interfaces with I . I also use Hungarian notation, and prefix data members with m_ .
<aside>
Tabs replaced with spaces
Indentation = K&R
Comments = Doxygen
</aside>
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
this question has already been subject to a survey here[^]...
but i still use camelCase...
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 8:09 Monday 29th August, 2005
|
|
|
|
|
It still blows my mind in these days of OO and strongly typed languages that people prefix variable instances with the details of the implementation.
It's so anti data hiding.
Dale Thompson
|
|
|
|
|
Dale Thompson wrote:
It's so anti data hiding.
Doesn't data hiding include hiding the actual variables?
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
-- modified at 10:00 Monday 29th August, 2005
|
|
|
|
|
We use camelCasing for local Variables, m_camelCasing for Members.
Function names are in PascalCasing, and statics and globals are rare
(Well - the theory says that they are PascalCasing).
MACROS and DEFINEs are Capitals.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
I mostly use PascalCasing for function names and extended version of the hungarian notation for all the other things.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I use PascalCasing for classes, methods, and class members and camelCasing for local variables in methods.
|
|
|
|
|
We use Pascal case for classes and functions.
Hungarian notation for all variables.
|
|
|
|
|
In VB6 i used to use hungarian style but since moving to DotNet i use m_camelCase for member variables, camelCase for local variables and PascalCase for Class names and Functions.
I think more important than what style you use is that you use a style (or structured mix like above) and stick to that. That way anybody else who looks at your code should be able to read it like a book.
Nothing annoys me more than code which has no style and deliberatly obscure variable/function names.
JJ
|
|
|
|
|
I use m_camelCasing for Members, l_camelCasing for local Variables and p_camelCasing for Parameters.
Properties and Methods are in PascalCasing.
Because of the lack of guidelines I made this my own guidline hoping that it will keep me sane ( no need to comment that )
I just like to be able to write something like this:
<br />
public void DoSomething(int p_theValueToWorkWith)<br />
{<br />
...<br />
...<br />
int l_theValueToWorkWith=p_theValueToWorkWith;<br />
...<br />
...<br />
}<br />
Beside that, using CodeRush I can still type faster than I can think.
|
|
|
|
|
I use m_camelCase for members, PascalCase for classes, properties, and methods. In C++ I used the C prefix for classes. Not in C#. I use the I prefix in both languages for interfaces. e prefix for enums to establish that its not a #define. I like the m_ for members as it pushes out the name with the direct association that its a member, and doesn't conflict with a local that is usually being compared to the member. I don't like my, as its two characters the same as m_ but makes me think Hungarian. I used informal Hungarian in C++, but I threw it out in C#. m_ is the only common usage of an underscore. I like it.
I was a believer in informal hungarian earlier but have moved on. At my last company we had a formal set of guidelines. This current place doesn't, but I'm adhering to my own. I believe strongly in having consistency across the entire code base. It should be intuitive to all members of the team. And when a new person joins, they shouldn't have to learn umpteen coding styles. I like my curly braces on their own line and directly below the start of the block. It allows me to grab the block as a whole with drag n drop. Plus its a direct visual as to what's in the block.
Comments are always welcome. Anything that helps me understand what I was thinking then, or what they were thinking then. The code isn't always intuitive. Sure I can read it and reverse engineer its meaning, but I won't know why immediately most of the time. I'm a lover of comments.
What happens instead if there isn't a consistency followed is what we have here now, as a new person starts, a new branch of standards are introduced and it becomes just a bit unwieldy. Prefixed stored procnames are another one.
In addition I think a generic best practices guideline is also helpful. Logging, data access, NOT using strings for EVERYTHING. I find this often with ASP developers. Build a search string from the database, and index into it for your keyword instead of putting together a bitflag. But I digress.
This statement is false
Semantic Sense in a Stream of Syntax
Twiddles my Bits from Degree in Form
To Dissipate into Meaning
This statement is false
|
|
|
|