BecomeAPatron

What is my coding style?

Someone on the Blitz forum start this thread about coding style and getting things done. I replied and thought that I’d post my reply here:

What is you coding style?

Mine, I guess. I’m not sure how to answer this. I’ll tell you what, my coding style isn’t complicated or “clever”, I make it simple so that I can understand it a month later if need be.

Do you comment your code or do you feel that code should be easily readable if you have done things properly in the first place?

Yeah all the time. I think the “easily readable” argument doesn’t hold much water if someone who doesn’t know the language has to overview your code, and also a single comment before a largish chunk of easily readable code means that you don’t have to figure out what the chunk does when browsing, you can just look at the comment.

Do you use include files or do you have everything in one source file.

Yeah, a couple, but it turns out that my projects don’t have as many sub files as some other people seem to use.

Do you plan thoroughly before even typing a line of code or do you play it by ear?

Most things I plan in overview and then I just get on with it. Some more complex things I plan in more detail, either on paper, on a spreadsheet, or in my head. Sometimes the “get on with it” approach fails and requires a rewrite due to something that you didn’t account for.

Finally, do you use a todo list?

You bet! I actually have an overview to do list so that I can see major progress and then my main to do list is broken down into all sorts of sections and each item has a Prioritisation column next to it which includes High, Med, Low and I change it to DONE or NO (if I don’t do it). I put all the “cool things” I think of in a polish list instead of coding them straight away. Also I have a “Cosmetics” section in which I log things that aren’t perfect but are good enough for now. I could go on about to do lists for a while because I’ve been developing them for over 10 years and I think that I have a pretty good system now.

Please feel free to add anything else that you may think is relevent.

Maybe I’ll add something about motivation. Sometimes I don’t want to code something for whatever reason like I think it may be complicated or boring or I’m just in a procrastinating mood. Anyway, I find that the best cure is simply to start work on it (and put on some uplifting trance music (or whatever works for you)), and after say 10 minutes I find that I’m well into it and enjoying myself.

Comments are closed.