User:

Log in user:

(step 1 of 2)


Write your email address in the white field and then click the "Confirm" button.

Log in user:

(step 2 of 2)


Write your password in the white field and then click the "Confirm" button.
Or click the "Request password" button to request forgotten password.

Log in user - Failure:


Email address has not been found!
Click the "Previous step" button to to enter your email address again.
Or click the "Register user" button to register your email address.

Log in user - Failure:


Pasword does't match!
Click the "Previous step" button to enter the password again.
Or click the "Request password" button to request forgotten password.

Request password:

(step 1 of 2)


Write your email address in the white field and then click the "Confirm" button.

Request password:

(step 2 of 2)


Your password has been sent to your email.
Please also check your spam folder.

Request password - Failure:


Email address has not been found!
Click the "Previous step" button to enter your email address again.
Or click the "Register user" button to register your email address.

Register user:

(step 1 of 5)


Write your email address in the white field and then click the "Confirm" button.

Register user:

(step 2 of 5)


Registration code has been sent to your email.
Please also check your spam folder.
Copy the registration code from your email in the white field and then click the "Confirm" button.
Or click the "Previous step" button to request the registration code again.

Register user - Failure:


Email address already exists!
Click the "Previous step" button to enter the email address again.
Or click the "Log in user" button to log in with your email address and password.
Or click the "Request password" button to request forgotten password.

Register user:

(step 3 of 5)


Set your user name in the white field and then click the "Confirm" button.

Register user - Failure:


Registration code does't match!
Click the "Previous step" button to enter the registration code again.

Register user:

(step 4 of 5)


Set your password in the white field and then click the "Confirm" button.

Register user - Failure:


User name already exists!
Click the "Previous step" button to set another user name.

Register user:

(step 5 of 5)


User has been successfully registered.
Click the "Log in user" button to log in.

User settings:

User settings:


Please log in to be able to open user settings.
Click the "Log in user" button to log in with your email address.
Or click the "Register user" button to register your email address.

User settings:


Your subscription has been successfully canceled.

User settings:


Your subscription has been successfully established.

Write comment:

Write your comment in the white field and then click the "Add comment" button.

Modular software architecture



Lego

Before we start programming, let's figure out how we're going to divide the program.

What do we gain if we divide the program properly?

The program code is divided into several shorter parts (modules). Each of these modules fulfills a specific function. The function is programmed only once in the module, but the module can be used several times in the entire program. This eliminates the need to write or copy the same code multiple times, which makes writing, debugging and modifying of the code easier.

The module is clear and easy to understand as the code is not long and only affects one feature.

The module is encapsulated, independent and fully fulfills the function. It is therefore easy to use in another project as well.

The module has a clearly defined input and output interface. With this interface we connect the module to the higher-level module, which writes the setpoints and commands into the module via the input interface and reads the actual values and states of the module via the output interface.

Appropriately named input and outpt module interface variables already indicate the function of the module.

The defined interface is excellent for testing the functionality of the module during development and also during commissioning.

If necessary, the program can easily be expanded with additional modules with new functions.

The entire program is structured and clear.

Several programmers can work on a program at the same time without conflict, since each one is working on a different module.

The work (programming, debugging, testing, documenting, troubleshooting, expanding, etc.) is efficient.

Be careful! Improperly designed architecture can later be a huge, unsolvable problem. If the program architecture is bad, even the best programming techniques cannot save the result.

© Radim-Automation, 2020–2025. All rights reserved.
Sharing of this article is permitted with proper attribution (link to the original page).


Related previous articles:


Related next articles:


Good point. Clearly annotating comments are necessary. In case of working with multiple programmers, come up with a common debug tag/bit (in case of ladder logic) assigned to each programmer so everyone knows someone’s still debugging.

I can see a great similarity between the house building project and the industrial machine automation project.

1. We need to get an idea of what the result will be, what it will be used for, and how big it will be.

2. We have to gather all the necessary requirements.

3. Depending on the size of the building / program, it is necessary to select a sufficiently large property / a sufficiently powerful PLC.

4. It is necessary to design a suitable architecture and plans / SW architecture and concept.

5. We connect technical networks to the property, taking into account the availability at the respective location. / We select other electrical components based on their compatibility with the selected PLC.

6. We need to build solid foundations for the house. / We have to program a reliable lowest program layer (hardware abstraction layer and general functions).

7. Then we can build the rest according to the requirements and plans.

8. If someone makes a new requirement now, it can only be built into the building / program if this requirement corresponds to the proposed architecture.

9. With the wrong architecture or poor foundations, even the best bricklayer / programmer cannot build the idealized building / program.

Even a simple machine or system can be designed and programmed in such a complex way that its diagnosis and expansion is only possible with extreme effort and a high risk of introducing new unwanted errors.
Do you believe?

It is better to write a modular program that is easily expandable in the future than a large monolithic program that contains all possible functions.
A large monolithic program block is difficult to modify because it contains a large number of dependencies and "hidden" rules.

The dividing of the machine program into modules can also be useful for visualization. In the visualization it is sometimes necessary to have several views. A modular view is a view that shows information about the entire machine in a structured manner.

With a correspondingly modular structure of the machine electronics, it is possible to test the machine and put it into operation part by part.

"As a result of the increasing trend to make mechanically engineered systems as flexible as possible, it has become essential to change existing programs in such a way that modular machine concepts are also reflected in the software. As a result, modularization is becoming the guiding principle for designing the programs of the future. Modularized software comprises modules that are fully functional and tested as independent entities, but they can be combined to create a single functional unit within different machines."
- Michael Braun and Wolfang Horn. Publicis Pixelpark Erlangen (2017). Object-Oriented Programming with SIMOTION.

"Investments in good code quality and good architecture are sustainable investments. Over 80% of development work is maintenance work and changes to existing code. Prof. Niklaus Wirth once said that SW is not written for the compiler, but for people who have to maintain the code. If the question of "quick and dirty" arises, the bearability of the "technical debt" must also be taken into account, because at some point the debt becomes unbearable or so great that a "fresh start" becomes cheaper. In terms of insurance, this is referred to as a “total loss”. In the case of “quick and dirty solutions”, people often “muddle” in the same style over and over again. In addition to existing bad codes, other "spaghetti lines" are no longer noticeable, a free pass...

This is how a vicious circle begins, because with the growing "technical debt", the development speed also slows down - due to unreadable and bad code. This delays the completion of new features and the project has to live with explosively increasing opportunity costs."
Translated from:
- https://blog.noser.com/kennen-sie-ihre-technische-schuld-wir-unterstuetzen-sie-bei-der-rueckzahlung/

"By continuously improving the design of code, we make it easier and easier to work with.
This is in sharp contrast to what typically happens: little refactoring and a great deal of attention paid to expediently add new features.
If you get into the hygienic habit of refactoring continuously, you'll find that it is easier to extend and maintain code."

- Joshua Kerievsky. Addison-Wesley (2004). Refactoring to Patterns.

Let's speed things up!

One man needs one hour to dig a hole 1 meter deep, 1 meter wide and 1 meter long. How much time does it take if you engage 10 men?

ChatGPT: "If one man can dig a hole that is 1 meter deep, 1 meter wide, and 1 meter long in one hour, and you have 10 men working simultaneously, you can divide the time by the number of men to find the total time it takes for the group to complete the task.

So, it would take 1 hour / 10 men = 0.1 hours (or 6 minutes) for the group of 10 men to dig the hole."

Do you agree with ChatGPT's answer?