Completed: / exercises

Structured Programming

Learning Objectives: This supplementary material should be reviewed before starting the course project, but it’s already worth considering at this point. The material briefly presents one way to systematically approach solving a problem or task (for which, for example, a computer program is originally created) using a divide and conquer method, rather than jumping straight into coding with a "Stetson-Harrison" method.
Structured and Modular Programming refers to a method of designing and programming a computer program where the problem (or the program being created) is logically divided into small and simple tasks, which are implemented as subroutines, or functions in C language. The idea is to break down tasks/problems into such small pieces that they eventually reach the level of an individual statement in the programming language.
This approach to software development provides the following benefits:

The Design Process

As in the real world, planning in advance saves a lot of time and effort. Before writing even a single line of code, the program must be designed and divided into parts. Professional programmers use a variety of planning tools, but for us, pen and paper will suffice.
Plan your programs well before coding to avoid getting lost in a tangle of poorly structured code. Here’s a simple example of a purchase event:
Program Example:
Even though our plan has become more detailed, we can add even more specifics:
We can keep refining until we have such a detailed plan that we end up with an algorithm described in pseudocode!
Once the entire program is put together in this abstract form, a large part of the software project is already done, and we can start implementing the program in the chosen programming language.

More info

Explore following Wikipedia pages:

Conclusion

Often, beginning programmers underestimate the importance of planning and the time it takes. It’s easier to just jump in and start hacking away at code, thinking the problems will be fixed as they come up. This will almost certainly result in a messy codebase and spaghetti code. When dealing with difficult bugs, you’ll eventually face two choices: add more spaghetti, or start fresh from scratch. Consider yourself warned.
So let’s really make use of the structured programming approach when designing and solving programming tasks and implement code as easily understandable functions. It’s worth the effort.
?