|
The style guidelines for my group are a little over one page in length, and are mostly naming conventions. I can summarize them as follows:- Names should not rely on tribal knowledge for interpretation (use whole words).
- Non-local names should use Pascal or camel case.
- Local names should be in lower case.
- If it's public, capitalize the name.
- If it's private/protected, prefix the name with an underscore.
- Acronyms embedded in a name should be prefixed and/or suffixed by an underscore to ensure the acronym is readable.
- Hungarian notation is strongly discouraged.
- Above all, BE CONSISTENT.
We don't prescribe brace style or other formatting (e.g. tabs), source organization, language features, or most of the other things that people argue about.
Software Zen: delete this;
|
|
|
|
|
Nothing should ever be camelCase.
|
|
|
|
|
Agreed. I don't like or use it myself, but we had a couple folks who liked it.
Software Zen: delete this;
|
|
|
|
|
codewitch honey crisis wrote: To the point where I usually kick myself for not putting constants before vars in equality comparisons if(0==foo), etc.
I've never liked that one. Yes, I know it stops the "=" vs. "==" mistake but it just doesn't read the right way.
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
I've grown to like it because if you tab everything out, it makes the constants easy to put into columns and read from the left.
But that's only applicable when you're doing a lot of comparisons in one test, like in a state machine transition.
Still, sometimes its elegant. Other times, maybe most times, i tend to agree with you but i suck it up and do it anyway, like eating an orange (i hate oranges)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
It's a Catch-22 requirement. The rule is to help people who are unaware of the problem it is intended to solve. As soon as you are aware of the problem, you don't need the rule. As soon as you know the rule, you are aware of the problem so are unlikely to fall foul of it.
|
|
|
|
|
Plus, any self-respecting compiler released in the last 20 years issues a warning for "assignment in conditional expression".
Software Zen: delete this;
|
|
|
|
|
This. This is my main problem with style guides: sometimes technology catches up and the rule isn't needed anymore.
|
|
|
|
|
codewitch honey crisis wrote: I'm half serious about this post. Which half?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
I'm not sure
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Trust me, there's nothing wrong with dropping the source file into the notepad/vi and being able to tell right away whether some variables are member variables or local variables (thanks to conventions) without having to search the whole directory structure for its declaration. Especially if the project is > 1 million lines. Or looking at the equivalent of the namespace diarrhea where your fingers gets tired of searching here and there and comparing trying to put it all together in your head.
modified 5-Apr-19 14:23pm.
|
|
|
|
|
i hear that!
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
this is how freedom smells in a socialist system. As long as you like it, it is great.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
i'm not sure what any of this has to do with the workers owning and controlling the means of production (iow: socialism)
it's just about my feelings around coding standards. sheesh
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I lived in a socialist society and thats my feeling about. Owning means of production is not really essential in socialism, because there arent any profits from it. It brings only responsibilities to maintenance it.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
that's the def of socialism but whatever. i'm not having this convo with you on a programming board.
seriously.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I am also not, but you added some words which I prefered to share my personal experiences
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I find coding styles to be like handwriting. When you've read enough code written by others, you'll find that you can read any style - as long as the writers followed it consistently.
Life is too short to refactor everything into your preferred style.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Daniel Pfeffer wrote: Life is too short to refactor everything into your preferred style.
But, but those people over there are doing it WRONG!
|
|
|
|
|
Great response! 100% agree!
"Go forth into the source" - Neal Morse
|
|
|
|
|
codewitch honey crisis wrote: I'm half serious about this post. If you need to relax, work with the other not-so-serious half.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Honey I shrunk the code
|
|
|
|
|
I wish short code was also fast code. Why is it almost never that way?
I'm lazy.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
You said it
It's all too easy too write reams of code that is almost unmaintainable, in the end readability is more important than performance I think, that way less bugs will be introduced.
|
|
|
|
|
I totally agree.
I forget who, but someone said that design patterns are just a reflection of the limitations of a language.
In other words, patterns should be able to be replaced by keywords, basically, that do the patterns.
In general, I think this speaks to the broader point we were on.
Let the language do the heavy lifting. I just wish it did more sometimes.
I don't often admit this in polite company, but I'm a fan of pure visual languages like FlowStone.
They I think, do a really good job of encapsulating a lot of patterns.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|