Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) 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 | zdog7@hotmail.com


In reply to Coming up with code design by zdog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-26 00:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found