Quote:
Originally Posted by wireties
Express your solution in a diagram or notation of some sort (UML or simple flow diagrams and so on) first. When you start coding, comment first and fill in the code afterwards. If your style is good, the code is readable and the comments explain the algorithm. Little else is really necessary no matter the audience.
|
I've started to draw out the code before hand, but never thought of the comment first. I think I'll stick to a bunch of comments for examples, though, at least for the first few programs with teaching kids. So far it's been really helpful to be able to say here's a program to look at, the comments should explain what's happening, as usually in the first few weeks we have too many programmers at different levels to teach all at once.