Difference between revisions of "DoDont"

From Free Pascal wiki
Jump to navigationJump to search
 
Line 8: Line 8:
 
1. Use all checks (Range, IO, Overflow, Stack) when developing. You can enable them with "-Criot" argument.<br>
 
1. Use all checks (Range, IO, Overflow, Stack) when developing. You can enable them with "-Criot" argument.<br>
 
2. Use heaptrace from time to time to see if you have any memory leaks. Enable via "-ghl" argument to get best result.<br>
 
2. Use heaptrace from time to time to see if you have any memory leaks. Enable via "-ghl" argument to get best result.<br>
3. Split huge units. Big units are ALWAYS a sign of bad design or logic.<br>
+
3. Split huge units. Big units are ALMOST ALWAYS a sign of bad design or logic. (you know it's bad when you have unrelated constructs in one unit)<br>
 
4. Split huge functions/methods. Big functions/methods are sign of bad design or logic.<br>
 
4. Split huge functions/methods. Big functions/methods are sign of bad design or logic.<br>
 
5. Name your variables/functions properly lest you will damn yourself with unmaintainable code.<br>
 
5. Name your variables/functions properly lest you will damn yourself with unmaintainable code.<br>

Revision as of 23:54, 31 October 2005

The right and wrong of Pascal Programming

All of these are almost generic tips for programing.
I've learned the right and wrong of programming the hard way, by doing things wrong first.

Right

1. Use all checks (Range, IO, Overflow, Stack) when developing. You can enable them with "-Criot" argument.
2. Use heaptrace from time to time to see if you have any memory leaks. Enable via "-ghl" argument to get best result.
3. Split huge units. Big units are ALMOST ALWAYS a sign of bad design or logic. (you know it's bad when you have unrelated constructs in one unit)
4. Split huge functions/methods. Big functions/methods are sign of bad design or logic.
5. Name your variables/functions properly lest you will damn yourself with unmaintainable code.
6. Stick with one identation style. Change only if you didn't follow a standard one.
7. The only right language for the job is the one you started the work with. And that's Pascal!

Wrong

1. Put all points from Right section here and negate them
2. Have doubts in pascal.