|
Re: Style is Substance
|
Posted: Oct 12, 2004 7:10 AM
|
|
No, please don't ever make these part of the language specification or the compiler. Coding standards are the lamest discussion I've ever taken part in.
Here's a little story. First job out of college. I freak out on all 3 of my fellow programmers because no one is following coding standards. I want hungarian notation and strict formatting with tabs, etc. etc. We come together and make some standards and we all follow them. Then, the company goes big. We hire 20 new people and everyone starts coding. We make sure to tell all the new developers about our coding standards and we even try to enforce them a bit. But guess what, it doesn't work and for that matter it some people take it personally. I quickly learned that coding style is something very unique to different people.
I have a 4 page document on my personal coding standards and I always do things identical for every class I write. I even force myself to javadoc EVERYTHING. But guess what... If I forced some other developer to conform to my standards, they'd probably end up setting fire to their computer, killing me, and then killing themselves. The reason being that they don't work well with my standards. They have their own asthetic that when they code makes them feel all warm and fuzzy. Now they are forced to code in a style that everytime they do it, they get more and more pissed off, because to them it seems completely stupid.
Here's another example. One place I worked had a set of coding standards. They said, "all class variables must start with an underscore." My first thought was, "Oh man! Underscores are ugly little characters that should be banned from existance. Even Sun suggests that underscores be avoided like the plague." So, I either suck it up and write the litte "_" before all my variable names, hate coding and sub-consciously end up producing bad code really slowly in a junvenile passive agressive ploy, or I just code like I do.
Here's my conclusion. If you are not able to see around coding style and read the actual code, well, you probably shouldn't be coding. Likewise, if you have coding standards and any one single person says, "these things suck!", then your standards are probably to strict and you need to burn them or loosen them (I prefer burning). Okay, so here's my philosophy: If you write the code, do it however you want. Feel free. But when you are reading someone elses, or even fixing it up a bit, please be a grown up and don't rewrite the entire class because they don't use your style. Learn to read the code not the style and you'll be a happier more well balanced person.
I particularly like the thread about code views. I think that in order to make these practical, the code should be stored without any whitespace except that necessary to enforce language syntax. This way it can always be reduced to the same version no matter what. The problem is that every IDE, editor and line printing program needs to be updated to support the viewer (I like to call it a code-lense). Not likely, so, I fall back to my earlier ranting and raving.
|
|