Give a code monkey a ruler...
July 28, 2008 9:24 AM
Subscribe
How do I make code LOOK beautiful? Occasionally, I see these snippets of code where everything looks very aligned and orderly, the variables all seem the same length, the functions are all neatly aligned.
My code on the other hand always looks rough and shoddy. What do the people with neat code do to make it look so neat?
I'm thinking about C++ here, but this applies to most types of code. Are there any rules I should be following to make my code also look so neat?
posted by markovich to computers & internet (13 comments total)
9 users marked this as a favorite
I would suggest reading Code Complete by Steve McConnell, which is a book dedicated to the basic principles of software construction, and one of three books sitting on the table in front of me right now.
Ahead of time I try to think of a naming convention that I like for my variables and functions then try to stick to it for that project. Finally, I go back a lot and re-edit code that I've written, replacing variable names that no longer make sense.
Like writing a book, your code will never be absolutely perfect, it's a matter of continuous refinement.
posted by onalark at 9:29 AM on July 28, 2008