Talking Flow charts and Pseudo-code
Before you learn any computer programming language its always a good idea to first learn what they will be used for and just how you will be using them to write applications.
Whether you use a low level language such as Assembler or a High level Language such as Python or Visual Basic – with is forms and other objects. The processes you will be trying to perform using your code and during executing a completely finished application, will most likely be used to the same effect, which ever language used. As a personal opinion, the selected programming language used is only the method by which you ask the computer hardware to perform defined processes. As such it is these processes that are needed to be defined before you even touch a single key on your keyboard.
Just as with anything you personally are doing in your life, your actions can be broken down into a set of basic processes, usually however you don’t have to write or chart these processes down before you perform them, as most things have become second nature to you. To a computer system these stores second natures and instincts are the programs that you or others have written and then called upon under different existing conditions.
Traditionally their are two methods of charting and defining an application and its processes ( the things it will do and how it will do them ). Both methods can be used individually or along side each other as application design aids.
I use these method together but in the following order :
1.. Using what is called Pseudo-code you can first write down a series of actions to be performed, using your own words. There is no need to think that you have to write in a style or language different from your usual method of talking or writing. Keep things very simple and make sure that someone else can very easily read what you have written, so that they can follow what you intend your designed actions to be.
Here I have used an example of someone watching TV at home when the power goes out in the house, using Pseudo-code to define the actions needed to solve the real issue.
I feel its very important at the start to also define all actions that are currently being performed followed by the actions that need to be performed.
Your sitting watching TV
You Notice the power has gone out
You need to find out why
Find and start to test if the mains fuse has burnt out
Has the fuse has burnt out ?
If so – Replace it , turn on the switch and get back to your program …….>
Has the power also gone out down your street ?
If it has – then report this to the power company or local provider, wait until they get it back on …….>
Is the power still on up your street ?
If so then – call a local electrical expert and wait for him to fix your problems …….>
I use some basic personal conventions here , Using a ” ? ” for a test and a “…..>” as a exit point to the full procedure being performed (i.e. you need to test the fuse box = ” ? ” and you have replaced the fuse so no other actions need to be performed “……>”
2.. Using Flow Charts
This is the flow chart above used to chart out the same power outage issue and the possible solutions as the Pseudo-code definition.
There are many flow charting applications available, I use an application that can be found in the Linux repository called DIA. You can find your own and get to learn how to using it for a flow chart diagram.
The Reason that I produce a flowchart after the Pseudo code is a simple one, its that – it is far easier during placing your thoughts ( Needed process and actions! ) down on paper or typing them into a text editor , to move or delete lines of text than it is to move the graphical flow chart objects around. Sometimes these graphical objects don’t move into other locations very well and you may be spending ages trying to do so. So Pseudo code with text only first!!!
I will let you do your own reading on flow charts and how to use them, that’s far to much for this simple post !!!
I truly recommend that even if every bone in your body just tells you to get on with coding an app in the language you love the most, that you try these methods here out. You will be amazed how fast your coding will become once you know what your application design really is !!!
In two years time when you have been using an app and trust it, yet want to make changes to it, but cannot remember what its overall design is, that these methods will pay off big time !!
Some may ask why not just use good comments inside your code ? , something you should do anyway. The facts are that an application can contain many thousands of lines of code by the time it is finished and if you are using an object orientated coding method where program flow can be a little obscure at times – well good luck with reading your way through, with many cups of coffee to help.
Its a great idea to have as a flow chart or a pseudo code document , you will find your way within moments and make your changes even faster BUT dont forget to update your charts and Pseudo code 🙂 🙂