Basic Coding Skills

I recently ran across this post on AllAboutCircuits, and liked it so much the tab has been open ever since!
KeithWalker

KeithWalker

Joined Jul 10, 2017

2,071

May 4, 2021

When you are designing functional software, start with a detailed specification of what the software is supposed to do (not how it will do it). Then start designing a block diagram of the software from the top down. In other words, start with a few broad functional blocks, e.g. operator interface, data input, data processing, output functions, etc. Then break each block down one level at a time by splitting it into more detailed functions. Include flow and timing diagrams as needed. Continue to add more detailed levels until you can not simplify each one any more. At each level, define the inputs and outputs of each function. If you have existing libraries of some of the functions, e.g. standard interfaces, etc, include them in the diagram at the appropriate levels.
When you start writing the code, do it from the bottom up. Take each bottom level block and write a function that will do what is required. make each function independent of all of the others, defining the inputs and outputs. Test each bottom level function independently using real inputs or dummy data. When you have all the bottom levels written and tested, start on the next level up, incorporating the lower levels and make sure that they work together and do not interfere with each other. When you get to the top levels you will have tested, well documented code.
[image]

Last edited: May 4, 2021

-fab

P.S. Robin2 has some nice tutorials in "Introductory Tutorials" on this site as well. They too touch on software design, but in a pseudo code way.

...and there are others as well! From how to setup to using WiFi! See Introductory Tutorials...