My personal tips about programming
These are some ad-hoc rules of thumb about programming. I'm sure they are not true all of the time. I'd like to hear if your experiences are different - or the same.
In no particular order:
In no particular order:
- Keep it simple, stupid!
- Don't add code hooks for extension unless they are going to be used in this project and there is a definite need.
- Often getting something working quickly (call it prototyping if you like) can tell you how you should design something.
- When on a deadline, in a large project (longer than a week) doing the unknown stuff first will allow you to re-plan if something goes wrong and it's going to take longer than you think. This can apply even when you are not on a tight deadline if you want to finish the project.
- To avoid programmer block or programming avoidance, save something small and easy for the start of a programming session. Ideas are an easy bug fix or a simple class. It should only take a short amount of time and should get you going.
- On any project there will be interesting sections and boring sections. If you want to complete the project then you need to do both. Have a strategy to cope.
- For other people to use something, the end of the project involves getting a lot of non-design, non-programming stuff done. Everyone can't be a finisher and there will people who find this dull. But the project won't be done unless it's done.
- It's difficult (impossible?) to really measure maintainability. Sometimes you need to redesign things though - a good rule is when the module has been tested three times and it still doesn't work. Looking horrid is not unmaintainable.
- If it works then it's probably OK no matter how you dislike it. To finish a project you have to put up with a lot of non-ideal solutions. Nearly always there isn't the time to fix things that probably don't need fixing (because they work). In software success is almost always working product not 100% beautiful code.
- Hacking up a solution might be horrid and rot your soul but long development times will kill the project. That does more damage to your soul!
- Doing things quickly doesn't mean not trying to do things elegantly. Elegance is not complexity.
- You learn in design and programming by doing. Books are always good - but without doing you will not know and understand. Don't worry about having a horrid design or having horrid code - you learn from doing that as well.
- Learn to read others code. It's hard, perhaps harder than writing code. But you will learn a lot.
- Debugging is the art of spotting the symptoms and estimating where the bug might be. Evidence that falsifies that conclusion is better than evidence that collaborates it - even though it causes more work. Don't discard evidence without reason.
- Debugging teaches you something about how to design. Don't avoid it.
- Single-stepping code can be good at understanding what you have written and learning about how to write. Don't even be shy of it.
- There is more to debugging that using a debugger. Both skills are critical - inside the debugger and outside.
- Sometimes it's one bug. Sometimes it's more than one.
- If the symptoms you have can be explained by more than explanation, what you need to more evidence. Devise tests to find out which it is.
- The longer a document is, the less likely it is to be read.
- Good design documents are often written for yourself to clarify your thoughts, although they might be read by others who don't know the subject - including yourself at a later time.
0 Comments:
Post a Comment
<< Home