Object-Oriented Programming: Reducing, Reusing, and Recycling Code
As we saw in the previous chapter, the key to a healthy codebase is organization and no redundant code. Though functions are one vital way of reducing, organizing, and reusing code, there is a much more effective way. This methodology is called object-oriented programming (OOP).
OOP is the backbone of most modern programming languages. In fact, to effectively use most modern languages such as Java, C++, C#, Python, and many others, a solid understanding of OOP is not only vital but mandatory. OOP is, for the most part, novel to PLC programming. Many PLC programmers are not fully aware OOP is supported, much less how to use it.
OOP offers many capabilities that, when leveraged correctly, can create very organized codebases that have no redundant code. There is a lot to understand about OOP and how to properly leverage it. This chapter is going to introduce the concept by exploring the following topics:
- ...