Breaking down coding problems with flowchart

Breaking down coding problems with flowchart

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.

flowchart.png

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.

  1. It provides insight into solutions.
  2. It helps examine the logical outcomes of a process.
  3. It helps to represent the program in it's entirety.
  4. 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.

  1. It is simple to understand.
  2. It helps in communicating the logic of a system to others.
  3. It helps in analysis as it is used to clarify the logic of a system.
  4. It helps in program documentation.

Disadvantages of a flowchart.

  1. A flowchart can become clustered when the logic is complex, thus making is hard to understand.
  2. If alterations are needed, it will require complete.
  3. 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.

Algorithm

  1. Start.
  2. Collect input of a, b, and c.
  3. Let sum = a+b+c.
  4. Let average = sum/4.
  5. Output sum and average.
  6. End.

Flowchart.

IMG_20200609_213205_540_1591734762366.jpg The illustration above is a simple guide and the same applies to solving complex problems.

I've got a recap.

  1. Know what the problem is.
  2. Express it in an algorithm making it as simple as possible(even for a kid to understand).
  3. Draw the flowchart.
  4. 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😉.