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,
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.
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.
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.
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.
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.
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.