Abstraction versus explicity

Real battle in programming isn’t about, if Functional Programming is better than Object Oriented. It is not also, which language is better. But it’s all about abstraction versus explicity balance. And persisting it, is the most challenging thing in all programming field.

But what I mean by that? Abstraction is act of naming things in our programs (which doing proper is hard on its own). Hiding non important details to our client. Too much details make it hard to understand system, so we must protect our client from going insane.
Explicity works in opposite way. It’s making clear, showing details of our running code. Giving clean message what is going on – even if there is enormous count of it.
And where is catch? Think for a moment, please. What is main source of bugs in our applications? In my practice, it always was implicit, global state. Some part which I wasn’t aware of, that leads to state, that my app doesn’t handle. FP provide help in making things more clear. It uses immutable data and pure functions. Ensure they doesn’t change global state. Only produce new results based on passed arguments.
OOP goes from other side. It provide tool for encapsulation. Hiding implementations and changing own state of class in controlled way. Which also help us maintain big apps.
So the hardest part is here. Finding best balance between hiding & showing details at every level of our programs. It’s about helping others to understand what we have, what we want to achieve & present how we do this. It’s giving proper count of details, that not exceed our small (about things in the head) human context.
Making use of what you learn from FP and OOP is best what we can do. Not fighting each other. It’s the understanding, whats we need. And be understanded by others via our code. This is our duty to build better things. Finding balance.

Dodaj komentarz