[Tutor] Planning out your program
Sean 'Shaleh' Perry
Fri, 12 Jul 2002 17:06:12 -0700 (PDT)
On 12-Jul-2002 Britt A. Green wrote:
> I made a very crude little text adventure in Python a few months ago.
> However, as I began to add on functionality to it, it became apparent that a
> lot of the underlying code wasn't capable of being improved. The original
> code basically let one player walk amongst a dozen rooms and pick things up.
> To get it to do much more would mean a huge rewrite of what I'd already
> So I'm going to have a lot of free time this summer and want to write
> something a bit more complex. What would be the best way to plan out my code
> before I start writing?
There are many schools of thought and approaches. Flow charts, UML, object
analysis, the magic eight ball, alcohol, the list goes on and on.
Many times our first draft of a program exposes a flaw in how we thought it
would work. The key is to learn from these types of mistakes.
Go to your local library or bookstore and wander their computer section.
There are many, many books about the act of programming and design. Much of
what they say is language neutral.
Afterwards, sit down, ponder the way you would like to work it out. Code in
pieces, examine the parts, then continue. Many programming failures come from
someone trying to do everything in one pass.
One of my favorite analogies is programming is like cooking, sure you can just
throw all of the ingredients in the pot, add heat, and cook until it is done.
But you have no idea what it will taste like or how long it will take.