CODESYS and PLC Philosophy…

Hi all! I’m continuing to make good progress on my new CODESYS book — Claude has definitely helped keep things moving.
Along the way, though, I’ve been wrestling with something, and I want to put it to the group.
The OOP Problem
CODESYS gives you real object-oriented programming: methods, protected variables, encapsulated code. On paper, that’s a great thing. It makes total sense when you’re building OEM equipment that’s never meant to be opened up and modified by the end user’s maintenance team — lock the logic down, expose a clean interface, and move on.
But that’s not the world most of my clients live in. Take the plant I was at last week. If I’d handed their maintenance guys a nicely encapsulated OOP program, they wouldn’t have known where to start. And that’s not a knock on them — it’s just not how they were trained, and it’s not how the plant operates day to day.
There’s a school of thought that says maintenance shouldn’t be modifying machines in the first place — that changes should go back through the OEM or a system integrator. In theory, sure. In practice, that’s often not realistic. Plenty of smaller plants simply can’t afford to bring in the OEM every time something needs to change. Plenty of OEMs, meanwhile, don’t have the in-house capability for higher-tech modifications — machine vision, robotics — and may not have a trusted integrator they can lean on either.
The larger plants I work with are a different story. Many of them do have real internal capability to make material handling or machine modifications on Allen-Bradley and Siemens platforms — the “Big Boys” of this industry. And that’s actually a big part of what I do: my training and consulting work is aimed at building up exactly that kind of in-house capability, drawing on a long career of programming and building machines.
Still, the field is changing fast. Structured Text and OOP — real computer-science-style software development — is clearly where the technology is heading, whether the plant floor is ready for it or not.
I’d Like Your Take
This is where I want to open it up. I work primarily in the US, but I know program design philosophy — and expectations around who touches the code after commissioning — can look pretty different elsewhere. If you’re a PLC programmer or system integrator, I’d genuinely like to hear how this plays out where you are:
How do you approach program design when you know plant personnel, not just the OEM or an integrator, will be the ones making changes and upgrades down the road? Do you scale back the OOP and encapsulation on purpose, or do you build it in anyway and train around it? And for anyone working outside the US — particularly in Europe — how does the balance between structured, encapsulated code and maintainer-friendly, transparent code tend to shake out compared to what I’m describing here?
I’d love to hear your experience in the comments, or feel free to reach out directly. This is exactly the kind of real-world tension I want to make sure my book addresses honestly, rather than just repeating the textbook answer.
— Frank Lamb

Hi Frank,
My take is that technicians aren’t necessarily programmers, and we shouldn’t expect every technician to understand computer science principles just to troubleshoot or maintain a system. I try to keep my programs simple and transparent so a competent technician can get online, follow the logic, and understand what’s happening. You might have one technician who understands all the advanced programming concepts, but what happens when that person quits? Now you’ve built a system that depends on one person’s knowledge. To me, good control code should be built for the next person who has to troubleshoot it, not just the person who programmed it.
Hey Frank,
My two cents is that what is changing is not the way we program or how we approach it, but the complexity of the systems we are automating, and the expectations of those systems.
Even things that used to be simple in principle have become more complex as we try and obtain higher up times, manage more data, or have more flexible systems. Conveyors tracking their package data and re-routing on failure, interfacing with WMS to receive and log package tracking are far more complex than simple move the object for example.
All this to say, in my experience the issue isn’t OOP, ST, but complexity of requirements. Translating to ladder something better written with more “complex” tools leads to even more complexity, not less, and would be just as unmaintainable by local maintenance, at least in terms of the want for them to be able to understand and update any part of the system.
It is on the engineering to simplify the top level control software to be understandable, while also handling the complexity of the system. This requires more sophisticated design approaches and tooling to do right, and sometimes OOP can provide a toolset to reduce complexity.
Maintenance is already comfortable with all the black boxes in the field, drives, the plc runtime itself, external smart devices are often systems running c++ that we are perfectly happy assuming their correctness and not having to be able to edit that portion of the software. The top level portion of the control can still be understood even if much of the internals are too complex for a maintenance tech. This is just another black box where diagnostic and in/out of that system must be used for troubleshooting.
Systems are becoming more complex. The existence of this complexity is not a design choice, but a result of the systems becoming more complex. This complexity exists regardless of implementation decisions, when those decisions are right sized for the project. We cannot expect to expand what we try to automate without expansing toolsets. So either one must define the problem as unsuitable for PLCs, even when it’s toolsets match the problem set, and let other systems take over, or we get comfortable with the new complexity and put it on the design and engineering of the systems to make a best effort to make the system as approachable as possible to local maintenance.
Thanks