"What are the four pillars of OOP?"

Me:(I'm not an OOP guy, but focused on design patterns)

1. Encapsulation
2. Abstraction
3. Polymorphism
4. ??(was it inheritance or composition).

Fuck, Because of the phrase "composition over inheritance". I've been mixing both composition and inheritance at the same time.

  • 0
    @torbuntu It's not an interview, but a common OOP questions that I got recommended from my relatives. I told them I'm not an OOP guy but applying the concepts of Design patterns to both OOP and FP world.
  • 2
    Oh for fucks sake.
    OOP and FP aren't related in any way.
    No opposites, not equal, nothing.
    Get your paradigms right.
  • 0
    actually thats something that you prove when you design a solution..
  • 1
    Once someone asked me what SOLID stands for. I screwed up the D - it’s apparently not Don’t Repeat Yourself. The hiring architect wasn’t happy.

    To this day I don’t understand this fascination of SOLID during recruitement. You show that your code is clean by writing it, not by recitation of formulas. Workplace is not Sunday school ffs.


    S is impossible to define and therefore useless.
    O is obsolete.
    L describes rules for code that should not be written in the first place.
    I is fundamentalism
    D (dependency inversion principle) is OK, but totally obvious.
  • 0
    @metamourge tell that to Scala
  • 0
  • 0
    @metamourge because Scala is a subset of Java and that runs on the JVM but can use the functional paradigm. Not completely pure functional programming but it uses a lot of the ideas
  • 0
    Well that's exactly what I said.
    Both paradigms don't have any common ground, meaning they don't collide with each other.
    That's why you can use them together.
  • 0
    @metamourge but you can mix the two paradigms however you want. What I was trying to say is that you could write your program entirely in a pure functional style. Scala just don't enforce that and compiles into Java Byte Code anyway.
  • 0
    The four pillars of OOP are:

    1. Sun's marketing budget
    2. IBM's marketing budget
    3. Microsoft's marketing budget
    4. Interfaces

    You can do everything that any OOP language does in C, except for interfaces. Encapsulation was even better with header files. None of that public/private/protected bullshit.
Add Comment