-
How to plan a program...
I have really gotten into making my ascii based rpg but I find myself getting lost in my code. I always see people around here saying you should always plan your programs before you make them, but I dont know exactly the best way to plan it. I already did a search on google but I could't find anything good, so I posted here :). If anyone has any tips please post em! Thank you!
-
Grab some paper and a pen...doodle a bit, doodle some more, write some variable names down, doodle a bit more, go get something to eat, come back, talk to some friends online, doodle a bit, go get some caffeine, come back, do any doodling which might be relevant to the program, perhaps plan out classes and structs and functions a bit, at least what you want them to do...find a good way to organize it all, and then do some coding.
-
I only plan if I get in over my head in something, and just can't figure something out....Basically, I just use Visio and draw out a nice flow chart, and draw the different path's of the programs and such...After that, I go into greater detail, and then do each different path 1 at a time, and more and more detail (depending on the size of hte program), and go from there...After that, It usually takes me under an hour to actaully code the program
-
The best way is to take a problem, then take a solution and start writing out all the different steps required to get to the solution. Then you divide those up again etc. You this until you can clearly see where you are going with your program and have all the big tasks divided into smaller tasks. Then you start coding. Don't get irritated when half-way through the programming you have to go back and revise your plan a bit.
And never forget:
"Weeks of coding can save you hours of planning!!"
(personally i still prefer weeks of coding though :D)
-
DivX: I personally prefer the other way around, working from the problem-space outward and mapping a solution onto code. I find it tends to result in more robust programs, as often a problem space for one program intersects another, and the solutions are in partial intersection as well.
-
Starting an application is usually more difficult from the beginning. You need to plan on 'where' exactly to start coding, then from there you just branch off creating functions to do specific things... soon after you have a set of functions which you can use together to make a working application. What I do is print off my work, and on the way to school I look over my code for errors or ways which may be more efficient. It also helps to make the code look neat, it doesn't matter how long it is as long as you can read it with ease, and don't forget to add comments so that you don't get lost in your own code in the future when referencing it.
-
Usually when i am first given an assignment, i quickly judge what methods would work best and just remember what i decided on using. Then when it comes down to sitting at the computer and coding it in i just remember what would have been the easiest way to do it, and i just do it. Of course i'm not a genius and it doesn't always work out smoothly, but then i just go over what doesn't work and then it does:)
-Bill