Thread: Designing Programs

  1. #1
    Registered User BellosX's Avatar
    Join Date
    Sep 2001
    Posts
    19

    Designing Programs

    hey guys,

    Do you fully design your programs before you start coding? Or do you simply sit down, start coding and then work your way from there?

    I know with some large projects it can be a bit hard to simply start coding, because you don't really know where to start, so I have sometimes thought it would be easier if I simply designed it properly first, and then coded from the design, so I know exactly where I am.

    What are you thoughts?

    If you do fully design your programs before you code them, what methods do you use in designing them? Do you use some form of conceptual design, or do you list possible variables and functions and work your way around that?

    Any details would be appreciated,

    Cheers!

  2. #2
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    For me, i will 'at least' write some pseudocode, or the list of main processes of my program before i start coding. I am a fan of the structured approach, as oppose to RAD, though it has its advantages.

    Usually flow-charts are used in real world applications, like ones written for business. For personal projects, i think pseudocode is enough if you're not doing anything major.

  3. #3
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    I just sit down and start coding. Sometimes I will just write a framework with empty functions that do nothing, and then write code for them as I go through it.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Well it depends really. If the program is pretty trivial you can usually get away with just sitting down and coding. If your program/game is of any considerable length you simply CAN'T do that and expect it to work out the way you want. Whether you write out an object hierachy and interaction chart or flowcharts try to get in the practice of doing some kind of designing before you program and you will be much better off.

  5. #5
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    I usually get the idea in my head and think about it for a few days, playing with different ways to solve the problem. When I come up with something I like, I usually jot down some fairly random things on small pieces of paper which I then proceed to lose within the next few days... I also add comments in the program of what I want to add later once I start coding.
    Away.

  6. #6
    Registered User
    Join Date
    Jan 2003
    Posts
    42
    I would absolutely reccomend at least some design phase before working on a project of any length beyond something absolutely trivial. You'll find that the larger the program, the more revising you'll end up doing if you don't design beforehand.

    I do it this way:
    1) I write down an entire concept for the program, with paragraphs and lines explaining anything I feel is important. I try to think about what I want in the program to begin with. This helps to get all your ideas down on paper (or in my case, a beautiful little handwritten HTML file) so you don't end up thinking "Oh no, I wanted this too" later on, and get forced to change something.

    2) Using the concept as a guide, I flesh out the entire program's skeleton. I create all of the classes, and any fields I'll need for them. I'll also write empty functions with their return types (no code inside, though maybe some comments). Every function is documented with preconditions and postconditions, so I won't forget what they're supposed to do (and because it's just good design practice).

    3) Using my completed design, I simply fill in the code. This process really cuts down on the amount of redesigning you'd do if you did it on the fly. I try to work from the bottom up, so I can ensure that each component works when I finish them, in order to avoid those small, hard to find errors when things get more complicated.

    I'd say that a design phase is too much of a hassle for someone who is just learning (and doesn't have the knowledge yet to work out a good design anyway) a language. Anyone who feels comfortable with the language they are using should consider designing first, then coding later.

    #edit: grammar#
    Last edited by Vorok; 05-29-2003 at 03:45 PM.

  7. #7
    Registered User BellosX's Avatar
    Join Date
    Sep 2001
    Posts
    19
    Thanks for your replies

    I think my current project might be a bit ambitious to head for a full on design. As you said Vorok, it wouldn't be beneficial while I'm still learning, so I might start with something a little more primitive and work my way up from there.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Recommend upgrade path for C programs
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-22-2007, 07:32 AM
  2. Communication between programs?
    By johny145 in forum Windows Programming
    Replies: 3
    Last Post: 06-01-2005, 10:14 PM
  3. POSIX/DOS programs?
    By nickname_changed in forum C++ Programming
    Replies: 1
    Last Post: 02-28-2003, 05:42 AM
  4. executing c++ programs on the web
    By gulti01 in forum C++ Programming
    Replies: 4
    Last Post: 08-12-2002, 03:12 AM
  5. How do you design programs?
    By compjinx in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 01-30-2002, 09:14 PM