Dread Lörd Kaolian wrote:
2. Figure out which program language you are going to be working with, and then look for a good editor. For example, the free micosoft visual studio express editions are a very good place to start. http://www.microsoft.com/express
Some people find that better tools help them program, others claim they like a basic text editor and any color coding or code tree management features distract them. I find that those latter people are idiots personally, so find the best tool you can get and start playing with it.
Anyone who codes in anything other than vi is a wimp. Yeah. I said it!
To be fair though, if your intention is to only ever do programming in an ideal environment (ie; one in which you can use whatever your favorite tool is), then by all means find that favorite tool. The problem IMO, is that folks who use their favorite enhanced editor for doing programming will tend to use it as a crutch. Then, one day, they wont have it, and they'll find themselves struggling to do anything useful.
Probably not a huge deal for most situations, but as a system administrator, you may on occasion find yourself needing to edit files/scripts on a serial console with only basic text capabilities. Not a good time to figure out how to use vi. And then there's the fun of the occasions when said console doesn't handle multi-line (or even in-line) scrolling either. Nothing more fun than editing a file when you can only edit one line at a time, and you can't see the characters on that line while you're actually editing it.
This obviously matters more in interpreted rather than compiled languages.
Quote:
5. structure is key. the more things you can make identical (column spacing, line spacing, variable capitolization, etc) the easier your job will be.
This. 100x this! I'll also point out for the record, that if you use a special editing tool to write your code in, please please please please please don't do things like modify the tab size in your tool and then line things up that way. Do you know what happens when you decide that it's convenient to set your editor to use a two space tab, but then some of your spacings are made using tabs and some using spaces? When someone opens up your file in a different editor, perhaps one that doesn't have the same two space tab, your alignment is completely screwed up.
Better yet. Don't use tabs at all. Use spaces. Why? Because cut and paste doesn't always maintain tabs (and frankly, most of the time you don't want it to). You will get screwed up alignment doing that. Heaven help the next guy who moves a whole block of code around. And it's a pain in the butt for someone else to go through line by line and fix it.
Yeah. I rant about this. Cause I can.
Oh. Second on the commenting as much as possible. While a paragraph for each line is a bit much, one before each block of code isn't a bad idea at all. And I agree that the "how" is sometimes very useful. If for no other reason than it might force the guy writing it to be a bit more descriptive on the why. Reading something like "Take our data and put it together to get our answer" isn't terribly useful. If that person had taken the time to mention that he's going to take each piece of data from X function and pass it into Y function, then divide by the number of whatsits represented by the value of the num_of_whatsits variable, then his "why" might just make a bit more sense.
And frankly, if the code that follows the comment isn't something which someone might have a hard time following, you probably wouldn't need comments in the first time. I can't count the number of times I've looked at a section of code and thought "What the hell is thing doing?". Note, not "why". I usually know that this is the section of the program where we determine which whatsit is the best whatsit in wholand, or whatever. Knowing how the hell the code does this is somewhat useful as well.
And for the record, most of the time I'm looking at my own damn code. If I can't figure my own stuff out without comments, there's no way someone else is going to do so.