Tips On Coding Style For A Software Dev Major?
Submitted
by
Gazzonyx
Gazzonyx writes "I'm a software development major in college and lately I've been trying to refine my coding style under various languages. It all started with a comment from someone about my use of white space, or lack thereof. I always prefer my code to be 'tight' in blocks with white space between blocks, regardless of the official convention of the language that I'm writing. I can never get my code to look great, like most geeks I have no sense of style. I can look at code and appreciate how well spaced, commented and indented it is, but I fail miserably at doing it myself.
I just don't like many of the things that are conventional. Full tabs for indentation drive me nuts. K&R brackets make me trace backwards constantly. I like GNU brackets, but I put the opening and closing brackets under the second letter of the function name and the enclosed code one more space in from the bracket to emphasize the codes scope. My comments are almost always directly above a block it corresponds to, with a single line break above it. I always figured that if it were an issue, I could just run 'pretty print' on my files, but somehow I've become really self conscience about the flow of my code.
Does anyone else use their own style (when allowed), or do you guys usually just stick to the convention of the language you're using? Any tips on keeping a coherent flow while also maintaining a decent amount of readability for others? Are 8 space tabs really necessary? Any language, it doesn't matter, I use C/C++, Java, LISP, VB(A/6/.NET)(sigh), ADA, PERL, BASH scripts, etc. I just want to make my code a little clearer and cleaner with some help from the guys who've been doing this for more years than I've been alive."
I just don't like many of the things that are conventional. Full tabs for indentation drive me nuts. K&R brackets make me trace backwards constantly. I like GNU brackets, but I put the opening and closing brackets under the second letter of the function name and the enclosed code one more space in from the bracket to emphasize the codes scope. My comments are almost always directly above a block it corresponds to, with a single line break above it. I always figured that if it were an issue, I could just run 'pretty print' on my files, but somehow I've become really self conscience about the flow of my code.
Does anyone else use their own style (when allowed), or do you guys usually just stick to the convention of the language you're using? Any tips on keeping a coherent flow while also maintaining a decent amount of readability for others? Are 8 space tabs really necessary? Any language, it doesn't matter, I use C/C++, Java, LISP, VB(A/6/.NET)(sigh), ADA, PERL, BASH scripts, etc. I just want to make my code a little clearer and cleaner with some help from the guys who've been doing this for more years than I've been alive."