Programming Method
-
At best, the way I program typically involves a primary nested loop, and procedural calls. I also use a ton of "flags" to transmit conditions through out the code. All of this is OK until I begin to patch the program to correct bugs, or add enhancements. After a while the code becomes difficult to follow because I have forgotten the function of the flag, the patch, and the documentation begins to be obtuse.
Any advice on organization from those with experience?
-
Comment Comment Comment - the alpha and omega for maintaining code.
@honoluludesktop said:
I also use a ton of "flags" to transmit conditions through out the code.
Instance variables?
I used to have a bunch of those as well - but now I try to make more custom classes that takes care of it's own section of the code. -
Custom Classes? Guess I am not there yet. Just beginning to understand that methods are procedures>_< While I conceptually understand parent child, I don't have a clue as to implementing it. Will I live long enough?-)
-
A concrete example here, but I noticed in your dxf plugin you would benefit from using
elsif
instead ofelse if
- it would greatly reduce the indenting in a few cases and make the code more read-able.Each if requires an end, so using
elsif
you could eliminate quite a fewend
statements.if condition # do this elsif condition # do that elsif condition # do the other else # default action end
-
Jim, Thanks again:-)
Advertisement