When OO and FP meet: returning the same type

In the left corner, we have Functional Programming. FP says, “Classes shall be immutable!” In the right corner, we have Object-Oriented programming. It says, “Classes shall be extendable!” The battlefield: define a method on the abstract class such that, when you call it, you get the same concrete class back. In Scala.Fight! Here comes the …

Read moreWhen OO and FP meet: returning the same type

What FP taught me about OO: Liskov Substitution Principle explained

TL;DR – functional programming taught me that LSP is a special case of PLS: Principle of Least Surprise. One thing that bugs me while reading Java: I’m reading along, come to a method call, ctrl-click on the method name, and get a list of implementations of the interface. IntelliJ can’t tell me exactly what will …

Read moreWhat FP taught me about OO: Liskov Substitution Principle explained