As a less experienced software developer, I once held a misconception about software development productivity. I believed that productivity could only be achieved by constantly coding. During my first project, I felt like an expert programmer. However, my confidence was short-lived as I struggled to identify the root of issues that arose. This resulted in hours of frustrating searches, and at times, doubts about my programming skills.
Today, I approach programming differently. I realized that I had been learning to code in the wrong way. As a result, I shifted my focus to problem-solving and critical thinking, rather than solely relying on coding.
If you find yourself in a similar situation or are a novice to programming, this blog is an excellent starting point. I will explain why planning your project is crucial before diving into coding.
Overview
To truly grasp the importance of planning before commencing code writing, let us consider an analogy. Imagine that you possess a vast expanse of land, and you have made the decision to build your dream house. If you were tasked with building this house, how would you approach it? Would you immediately begin construction by laying the foundation, and then attempt to figure out each step as you proceed?
Now, let us imagine that you discover a malfunction in your water system, but you are unable to determine the location of the issue to fix it. What would you do? Would you demolish the entire house and start anew? Or would you search for a new home to relocate to? Hopefully, neither of these options would be necessary. It would be more beneficial to create blueprints for the house, detailing all requirements and refining the plans iteratively until they meet your needs. Typically, local governments must approve these blueprints once they are complete. Actual construction does not commence until all plans have been finalized and approved.
Similar principles apply to programming. We must first generate an idea for the program/system, followed by creating an algorithm or plan, before building and implementing the code. In truth, coding is a later stage in the project process.
**To help you understand the steps required to create a program or system, I created the following visual diagram below **
Planning Part
The planning part/process can be defined in two stages:
1- Idea planning.
2- Algorithm.
What is the idea planning?
The initial stage of the development process is called idea planning. In this phase, the concept of the program is clarified in simple, everyday language, rather than in formal programming jargon. During idea planning, it is essential to explicitly state the objectives of the program. This may involve asking questions such as:
What problem does the program aim to solve?
Who is the target audience for the program?
What features and functionality are required to meet the needs of the target audience?
How will the program be different from existing solutions on the market?
What are the desired outcomes or benefits of the program?
By answering these questions and similar ones, developers can gain a clear understanding of the scope and requirements of the project. This can facilitate the development process by ensuring that the project remains focused and aligned with the overall goals and objectives. Ultimately, idea planning sets the foundation for successful software development
In addition to writing down the idea of your program, you may also draw and label a diagram of what the program will look like.
Algorithm
After the concept of a program has been clearly defined, the next step is to develop the algorithm or the set of step-by-step instructions that will be used to create the program. There are three commonly used approaches to algorithm planning:
Storyboarding
Storyboarding is a technique used by software developers to visually map out the flow of a system's user interface. It involves creating a diagram that shows how users will navigate between the screens or pages that make up the system. While a system may have all the required features and functions, it can still fail to meet user expectations if the navigation is confusing or inefficient. Storyboarding can help developers identify and optimize the flow of a system's user interface before embarking on the actual development process.
Storyboarding is especially useful in the context of block-based programming languages such as Scratch, Snap, and Blockly! which are often used to create programs that involve multiple scenes or pages. By creating a storyboard, developers can identify potential issues with the user interface and make adjustments before proceeding to the coding stage. This can help save time and resources and ultimately lead to a better user experience. Additionally, storyboarding can serve as a communication tool for developers, designers, and stakeholders, as it helps to illustrate the intended user experience clearly and concisely.
In this diagram, you can see a simple storyboard diagram that I created for a Restaurants Search System to help mall visitors find their favorite restaurants such as P.F Chang's
pseudocode
Pseudocode is a tool that enables developers to describe how a computer program or algorithm works. It uses a combination of natural language and programming language and is independent of any specific programming language. This means that a single pseudocode can be used to represent code in various programming languages, making it a versatile tool in the development process.
One of the key benefits of using pseudocode is that it allows developers to focus on the logic of their code, without being bogged down by syntax or compilation errors. By writing out the steps of an algorithm in pseudocode, developers can map out the flow of their program in a clear and organized manner. This can be especially useful in the early stages of the development process when the details of the final code are still being worked out.
Another advantage of using pseudocode is that it can help with collaboration between developers, as it provides a standardized way to describe code logic. Additionally, it can be a useful tool for documenting code, as it provides a high-level overview of the algorithm or program that is easy to understand for both technical and non-technical stakeholders.
In general, pseudocode is a valuable tool for developers that can help to streamline the development process and improve the quality of the final product.
Let's see how we can write pseudocode for a program that checks whether a number is odd or even
Flowcharts
A flowchart is a diagram that illustrates the step-by-step solution to a problem or an algorithm. It is a visual representation of a program's logic, using symbols and directional arrows to indicate actions and decision points. By creating a flowchart, software developers can better understand the program's structure and visualize how it will execute, including any branching or looping structures.
Flowcharts are particularly useful for visualizing complex programs that involve multiple decision points and loops, such as those using if/else statements or for- and while loops. They can help developers to identify potential errors and optimize the program's performance before it is implemented.
The basic structure of a flowchart consists of directional arrows connecting the steps of a program, with each step represented by a symbol or box that describes the action or decision taking place. By following the flowchart, developers can easily understand the program's logic and ensure that it functions as intended.
Developers do not necessarily have to use all three approaches for algorithm planning. The choice of approach(es) depends on the nature and complexity of the project, as well as personal preference and familiarity with the different methods.
For example, a simple program may only require pseudocode, while a more complex program with multiple decision points and loops may benefit from the use of flowcharts and/or storyboarding. In some cases, a combination of approaches may be most effective.
When deciding which approach to use, a developer should consider the specific needs of the project, the level of detail required, the target audience for the documentation, and the developer's skills and experience with each method. Ultimately, the goal is to choose the method(s) that will result in a clear, organized, and effective algorithm for the intended audience.
Here is the flowchart for the same program we wrote using pseudocode to check odd and even numbers. The basic conditional operation involves entering a number, determining whether it is odd or even, and printing the result. The chart should be something like this:
Building algorithms initially using flowcharts or pseudocode will help you create well-thought-out code that requires minimal debugging.
What are the benefits of planning your project before you start coding it?
Planning before starting a project has numerous benefits, especially when it comes to coding. It allows us to break down complex problems into smaller and more manageable parts. This makes it easier to solve these problems efficiently and effectively. By planning, we can avoid the need to spend hours trying to figure out what is wrong and how to fix it.
Planning is essential for ensuring that the final code is not only correct but also easy to understand. It helps us keep track of how the various components will interact and avoid overlaps that can lead to confusion and errors. Additionally, it helps us anticipate bugs and scale the project within certain restrictions.
Furthermore, the planning process provides us with a better understanding of the entire scope of the project at once. This allows us to develop a clearer roadmap for the development process and can help to avoid scope creep and unnecessary delays. Overall, planning is an essential part of the development process that helps to ensure the success of any coding project.