This is the 1st article of a series that explores the difference between OOP design, and parametric polymorphism with Type Classes, as both are possible in Scala. By Alexandru Nedelcu.
A black box is a device, system or object that can be viewed in terms of its inputs and outputs. This means that the input and output are well specified, such that we can form a useful mental model for how it works. Note that the mental model doesn’t have to be correct, it just has to be useful, such that we can operate the system without breaking it open and taking a look at the implementation.
The article is split into:
- Motivation
- Abstraction
- Black Box Abstraction
- What is OOP?
- Are OOP and FP orthogonal? Can they mix?
- What are Type Classes?
- Ideological clash
- OOP values
- Static FP values
- Degenerate cases
- What do you want? OOP is a paradigm based on the concept of “objects” and their interactions, objects that contain both data and the code for manipulating that data, objects that communicate via messages. Good read!