Principles for Better Object-Oriented Programming

…that you can brag to your interviewer about

Sean Au Jong
2 min readJul 9, 2023

Has your interviewer ever asked you about object-oriented programming? It always starts with what an object is, and what the four pillars of OOP are. But if you really want to impress your interviewer, try bringing up some of these principles:

What is Object-Oriented Programming (OOP)?

OOP is a programming paradigm based on objects, which contain both state and behavior. OOP is popular because:

  1. Altering state is intuitive in imperative programming
  2. Abstraction simplifies business logic into inputs and outputs

This is different from functional programming which:

  1. Focuses on transforming data though declarative programming
  2. Simplifies concurrency through its stateless/immutable nature

Introducing the SOLID principles

Languages or concepts will either support the four pillars of OOP, or they will not. This is not up to the developer.

However, SOLID is a set of “optional” principles that object-oriented design should strive to adhere to. SOLID only determines how “good” your design is, not if it is object-oriented (thus they are principles).

More principles for good code — coupling and cohesion

On the topic of writing good code, you should also have an understanding of coupling and cohesion.

Conclusion

Understanding these concepts are key to writing good OOP code. Next time your interviewer asks you about OOP, make sure you also talk about good practices.

--

--

Sean Au Jong
Sean Au Jong

Written by Sean Au Jong

I write articles that show you what I used to learn software engineering as a university student. Always just one explanation away to greater understanding!

No responses yet