u/ConfidentProposal866

▲ 9 r/PLC

TwinCAT 3 OOP and company-wide libraries — how do you handle this in industry?

Hi everyone,
I’d like to get some real-world opinions and experience on this topic:
In TwinCAT 3, do you think company-wide libraries are fine to be built with OOP principles, as long as they are well documented, well tested, and provide good diagnostics externally?
At my current company, I’m more or less the only one who thinks this way. The common argument is:

„The electrician also needs to understand the code.“

My personal view is a bit different: if a library is stable, proven, and properly documented, then the source code does not necessarily need to be readable for everyone. In my opinion, the important part is that the behavior is clear from the interface, the diagnostics, and the documentation. And if there are open questions or edge cases, the standardization team should be involved.

To be clear, I am not saying that every PLC program should be written in OOP. My point is only that company-wide reusable libraries can absolutely be object-oriented, while the application layer outside the library can stay simple and conventional.

Some context about the company:
• Worldwide company with around 1,500 employees.
• 4 production sites.
• Each site has its own PLC programmers.
• Management wants more standardization and reusability across all sites worldwide.
So my question is:
• Do you use OOP in PLC libraries in your company?
• How much of the source code should be “human readable” for maintenance staff or electricians?
• Is documentation + diagnostics enough, or should the implementation itself always stay simple and directly readable?
• Where do you personally draw the line between “good engineering” and “overengineering” in PLC software?
I’d be very interested in hearing how this is handled in your companies and projects.

reddit.com