Older Version Newer Version

Noble Noble Feb 3, 2008

Since Liberty BASIC is considered a “structured programming language” I like to use the following guide to help me develop a program in Liberty BASIC or any other programming language. Before I get started with my development steps let me explain a little bit about “structured programming” and what it is. Structured programming is based around the statement that modularization will gain you better programs. Modularization simply means the grouping of statements with relation to each other into modules (functions/subroutines). By breaking up your program in to logical sections it makes your code easier to understand, write, and debug. So, when I set out to write a new program in Liberty BASIC or any other language that uses “structured programming” style, I try and make sure that the modules that I write a no more than a page in size. To me, it makes it easier to view the entire module at a glance and it makes it much easier to understand a series of smaller modules than it does one big huge program. Depending on the size of the project that I am trying to create, after the initial designing of the modules and breaking them up, I am ready to go. With larger programs I need to write, I may have to break the modules up even further. At any rate, I continue to break the modules down until I have it in small enough chunks where it describes the problem that I am trying to solve. (You need to be able to understand the problem very thoroughly.) Some like to call this process a “top-down” design where you start with a general description of the problem you are trying to solve and work to a more specific one through module refinement. After I feel like I have the organization in order that best describes the problem and solution path, I can begin designing the overall structure of my program. This could take a considerable amount of time depending on the size and nature of your project. Be careful here and make sure that you have everything defined and that you understand everything fully. (This area usually gets allot of people into trouble later on in the process.) I am now ready to write my program. So in summary, I try to follow the outline below doing each step along the way: # Plan your program first. Don't get in a rush to start writing code. Try to ask yourself the following questions: # # What is the overall purpose you would like your completed program to achieve? a. # Does the program need input? What kind does it need?kind? How will itI process the input? b.it? # What kind of output and where willdoes the program need and how will I produce it? (The screen, the printer, a disk file?) c.Where will I save it? # How do I need thewant to display my input prompts and themy output to look tothe users of my users? d.program? # How is the best way to break my program up into simple,the simplest, easy-to-follow modules? e. # How can Iis the best way to fit all mythose modules into the completea program whereso they can communicate with each other in the most efficient manor? f.together forming a complete program solution? # Can I break the modules downup even more for better understanding? 3.further? # Write the main program leaving placeholders whereplace holders for the modules are to be placed.modules. By doing this,this you can test the logic and flow of the main program as you write it. 4. # Write each module separately testingseperately, test and debug each one before you place them intoadding it to the main program. 5. # Did I place enough comments in themy code for better understanding when I look at it later? 6. Finally, debug # Debug and test yourthe entire program. Enjoy!