Many sources for good software architecture will use objects, pointers, memory allocation in their solutions. The PLC programming language 61131-3 Structured Text is really limited in this regard, more like a limited version of Pascal. Reasons for this are often cited as i.e. safety and determinism.

Here are some of the limitations

No pointers
No objects
No memory allocation
No first class functions

How do I build a good architecture with these limitations, even ANSI C architecture/design pattern sources use a little bit of dynamism like callbacks or lists of function pointers etc.

I try to use the good SOLID principles, and other "best practices" but for me that's more programming in the small, not the big picture.

I have been researching a bit, and "data-oriented design", "entity components system" are perhaps the closest "possible" paradigms I've found given these limitations.

How do I build a good architecture with these limitations?


  • 1
    $\begingroup$ This question seems far too broad. There is a whole research field devoted to software engineering and architecture in PLC programs (including IEC 61131-3); the findings of an entire field can hardly be summarized in a single SE answer. Also IEC 61131-3 (and esp. ST) is no longer as limited as you say since the 2013 version has quite a few OOP additions. You might want to look into those. $\endgroup$
    – dkaeae
    Dec 14, 2018 at 14:42
  • $\begingroup$ @dkaeae Thanks for your comment. Most of the papers I've looked at seems disconnected from reality with toy examples. Do you have any specific sources I should be looking at? I'm using Siemens btw, so no 2013 extensions I'm afraid :) $\endgroup$
    – krakers
    Dec 14, 2018 at 16:24
  • $\begingroup$ I believe most authors who work on real-life code are actually legally forbidden from publishing such code (remember we are talking about code in an industrial setting, not open source projects); hence most examples are, as you have said, rather oversimplified. (Source: I actually worked on a research project in which this was the case.) That being said, the ETFA conference or the IEEE Trans. Industrial Informatics journal probably have several papers on what you are looking for. $\endgroup$
    – dkaeae
    Dec 14, 2018 at 17:02