Breaking down coding problems with flowchart
5 min read
Hellooo! In my previous article, I promised to talk about flowcharts. Well, here we are.
Do you want to get better at breaking down problems before coding? Learning to use a flowchart will go a long way in helping you improve on this important ability.
Who is this article for?
- Beginners to programming looking to utilize any problem solving technique
- Anyone willing to learn something new.
In this, we will discuss:
- Flowchart definition.
- Flowchart symbols.
- Uses of a flowchart.
- Advantages and disadvantages of a flowchart.
- How to use a program flowchart.
What is a flowchart?
A flowchart is the diagrammatic representation of an algorithm. It gives a programmer a step-by-step view into the logic of program development.
It is drawn using symbols connected together by means of a flowline. The table below shows some of the important symbols of a flowchart and what they represent.
The above table only shows the important symbols and are just enough to draw a flowchart.
Note: The rhombus symbol is used for decision making(if and else statements). Thus, the flowline can be used to give direction based on decision.
Uses of a flowchart.
- It provides insight into solutions.
- It helps examine the logical outcomes of a process.
- It helps to represent the program in it's entirety.
- It is a tool for communicating the logic of a program or system to others.
A flowchart is one of the ways to represent an algorithm. Others include: decision tables, decision trees and data flow diagram.
Advantages of a flowchart.
- It is simple to understand.
- It helps in communicating the logic of a system to others.
- It helps in analysis as it is used to clarify the logic of a system.
- It helps in program documentation.
Disadvantages of a flowchart.
- A flowchart can become clustered when the logic is complex, thus making is hard to understand.
- If alterations are needed, it will require complete.
- It is not easily reproduced(You guessed right. Imagine figuring out a mistake after drawing a page of flowchart)
So far, I've walked you through the basics of a flowchart. You might wonder why I wrote program flowchart instead of flowchart. Yes, there are different types of flowchart. To keep this article direct, I will be talking about the types of flowchart in my next article.
What is a program flowchart?
A program flowchart represents the logic of a program to be written. It serves as a guide to follow when writing code.
To draw a program flowchart, the algorithm needs to be written first. The example below will serve a guide.
Problem: Calculate the sum and average of 3 numbers a,b, and c.
- Collect input of a, b, and c.
- Let sum = a+b+c.
- Let average = sum/4.
- Output sum and average.
The illustration above is a simple guide and the same applies to solving complex problems.
I've got a recap.
- Know what the problem is.
- Express it in an algorithm making it as simple as possible(even for a kid to understand).
- Draw the flowchart.
- Write you code following the flowchart.
In case you haven't tried solving your coding problems like this, I urge you to do yourself some good. One more advantage of a flowchart is that it helps you identify where your error is coming from(pretty sure you guessed that already:) ).
See you next week! In my next article😉.