Intervention: Coding Guidelines
-
I like standards. I'm button-down that way.
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.
There is only one (sensible) standard: The code can be read by another programmer without needing a decoder-ring - consistent with it's own standards and the intent of being informative to not only ones self, but with others who cares to look at the code. Consider that, even for a given language, a different type of project can be best served by code that is emphasizes its constructs as plainly (and maintainable) as possible. Also, if it's VB6, just chop off their hands.
"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
-
I like standards. I'm button-down that way.
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.
Coding standards are like religion. It's fine to have one, but please don't force yours on me. :) /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
Coding standards are like religion. It's fine to have one, but please don't force yours on me. :) /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
I am just trying to let go of some of my uptightness around the standards of others. =) We agree. I mean in principle. Intellectually speaking, but my heart isn't there yet.
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.
-
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
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.
-
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. X|
Press F1 for help or google it. Greetings from Germany
-
There is only one (sensible) standard: The code can be read by another programmer without needing a decoder-ring - consistent with it's own standards and the intent of being informative to not only ones self, but with others who cares to look at the code. Consider that, even for a given language, a different type of project can be best served by code that is emphasizes its constructs as plainly (and maintainable) as possible. Also, if it's VB6, just chop off their hands.
"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
all true, and yet the unsensible is perhaps underrated. some of the most inspirational bouts of coding I've had have left me with something I couldn't understand later. not that I appreciate that entirely. it is what it is. but yeah, I at least try to make the function names clean if it comes down to that. plus, have you ever noticed how sometimes, code as it matures can get a bunch of weird forks in its codepath to handle one-offs and bugs, sometimes in other systems its interacting with, and so the simplest, cleanest solution doesn't work in the real world. The truth is, I distrust all of this. It makes me uneasy. But it's a reality. The best one can hope for in those situations is to keep the interfaces as clean as possible, comment what you can, especially the corner cases, and wave a dead chicken over the whole thing. And that's perhaps where software breaks from engineering into art. =)
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 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!
-
all true, and yet the unsensible is perhaps underrated. some of the most inspirational bouts of coding I've had have left me with something I couldn't understand later. not that I appreciate that entirely. it is what it is. but yeah, I at least try to make the function names clean if it comes down to that. plus, have you ever noticed how sometimes, code as it matures can get a bunch of weird forks in its codepath to handle one-offs and bugs, sometimes in other systems its interacting with, and so the simplest, cleanest solution doesn't work in the real world. The truth is, I distrust all of this. It makes me uneasy. But it's a reality. The best one can hope for in those situations is to keep the interfaces as clean as possible, comment what you can, especially the corner cases, and wave a dead chicken over the whole thing. And that's perhaps where software breaks from engineering into art. =)
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.
codewitch honey crisis wrote:
some of the most inspirational bouts of coding I've had have left me with something I couldn't understand later.
Let me tell you about a closely guarded secret: comments! Orders of magnitude more valuable than wasting mind and body on some OCD organization of symbol and function names. Rule-makers aren't sitting with you seeing the problems you need to solve. If you've ever built a database then you may have come to a time where normalization just isn't the best choice - you break it in a strategic spot for simplicity and efficient execution. The basic rule of thumb: do it the best way you can.
"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
-
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. X|
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.
-
codewitch honey crisis wrote:
some of the most inspirational bouts of coding I've had have left me with something I couldn't understand later.
Let me tell you about a closely guarded secret: comments! Orders of magnitude more valuable than wasting mind and body on some OCD organization of symbol and function names. Rule-makers aren't sitting with you seeing the problems you need to solve. If you've ever built a database then you may have come to a time where normalization just isn't the best choice - you break it in a strategic spot for simplicity and efficient execution. The basic rule of thumb: do it the best way you can.
"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
comments are cool, but have you ever implemented an algorithm before you understood it? how do you comment that effectively? for me, what happens is, I code it to learn it. Maybe over the course of weeks, months, even years, depending on what it is I'll refactor or even rewrite as I understand the problem domain better. As I do those refactors and rewrites I can and do add comments. Maybe it's because I think visually so my process to translate algo to code is weird or something, but I'm sure I can't be the only one who does this.
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.
-
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.
-
Coding standards are like religion. It's fine to have one, but please don't force yours on me. :) /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
Well played Ravi.
-
Halp! I've become a slave to naming and style guidelines. Years of C++ development and years of development prior to advanced compilers and syntax highlighting and intellisense and doc-comments and all of that made me a fascist about it. To the point where I judge people for not following, say, MS naming and style guidelines for .NET when building C# apps. To the point where I usually kick myself for not putting constants before vars in equality comparisons if(0==foo), etc. I already smoke pot (it's legal here) so how do I loosen up? Y'all don't need my judgment. Nor do any fellow devs. And I need to be able to use other people's code without feeling a little sick about it, or wanting to refactor it before I touch it. I'm half serious about this post.
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.
Honey I shrunk the code :omg:
-
Honey I shrunk the code :omg:
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.
-
I like standards. I'm button-down that way.
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 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.
-
Shouldn't your user name be in Title Case?
- I would love to change the world, but they won’t give me the source code.
haha
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.
-
The problem with coding style guides is that they try to put everything in it. Just start creating one with only a few guidelines that are easily enforceable.
I'd rather be phishing!
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;