Skip to main content

Programming Paradigms

In the tech world, programming paradigms mainly fall into three groups: object-oriented, functional, and imperative. At Trew Knowledge, we generaly prefer functional and imperative approaches. However, we don’t strictly adhere to any one paradigm, as the best approach is highly situational and subjective. When you’re coding, it’s important not to force a piece of code to follow a specific style just for the sake of it. For example, WordPress itself mostly uses an imperative approach, and trying to insert object-oriented code where it doesn’t naturally fit can backfire. Similarly, mixing objects into a functional setup without a good reason might lead to issues. We generally prefer functional and imperative approaches but opt for object-oriented methods when dealing directly with real-world objects. We tend to avoid complex object-oriented patterns like factories and singletons, which can lead to unnecessary complexity. While these patterns have their place, they should be used thoughtfully and not just because it seems like the done thing. This trend of adopting practices without fully understanding their purpose is known as cargo-cult programming. It’s essential to grasp why and when a particular programming style is advantageous. If you’re working with entities that naturally map to objects (like WordPress posts), object-oriented programming makes sense. However, don’t default to object-oriented programming unless it truly adds value to the code you’re working on.