|The stupid question is the question not asked|
Coming up with code designby zdog (Priest)
|on Jun 23, 2001 at 03:18 UTC||Need Help??|
I've been recently working on a project where I've been having a little trouble coming up with a good code structure and I began wondering about the process of coming up with the design.
When I decide what I want my program to do, before I sit down to the keyboard, I usually grab a sheet of paper and a pencil and start drawing out how the program will run. I figure out how the different options in the program will be processed. Will the program use command line options or have the user enter them as the program runs? And how can I include the options into the code without making it look messy?
I will also try to eliminate as much as possible other forms of messiness like unecessary code repetition. I try to figure out ways to structure the args passed and returned by functions in order to make functions as reuseable as possible.
I also draw out the format of the actual output of the program and try to figure out how to adjust the code to best suit this form of output. This is especially necessary for me when I am working with web applications (which this happens to be).
I make sure that in my program I can add new features with as much ease as possible. I try to isolate the algorithms required for unique features in the program so that more common functions can be reused as much as possible in later additions to the program.
So after I contemplate these and many other factors that I could not come up with at the moment, I end up with a map that I follow while I am coding. Of course, modifications always end up being made during the coding process, but at least I am not coding blindly.
So now I ask you: Do you do something similar to me? or do you find it easier to decide on design as you go along? or do you just code the necessary algorithms (the ones that you know you will need to use) first and then form the design base on how they came out? or do you have some really unique mathod for coming up design that I could not think of?
Zenon Zabinski | zdog | firstname.lastname@example.org