Power
- 2 minsIn my previous post, I described how I thought that having less choices could help one keep focus on what really matters. This reminded me of another idea that I came across when reading “Out of the Tar Pit”.
In the paper, the authors argue that power corrupts.
Power in the sense of what a programming language allows you to do. In C for example you have the power to manage memory manually. However this can be abused and as such, lead to enormous levels of complexity. By introducing garbage collection into a language, that power is gone and that is good.
Unsurprisingly, they also treat the idea of state on similar grounds. A language that allows you to introduce state at different levels of your system and at will, is providing you with a power that can be easily abused to create complex systems even though they might not seem as such when starting out. As a result, any kind of language that permits state to such a degree, should be approached very carefully if at all.
When I started thinking about the above I thought of a small example which can be seen in many languages:
a = []
a
=> []
a = "something"
a
=> "something"
I think this is the power the authors are talking about or at least an example where it’s relevant. The fact that I can so easily change what the value of the a variable is, gives me the power to do whatever I want with it across the system.
This is dangerous. It’s dangerous not because I don’t trust myself or someone else but because it is so easy to do. It’s much easier to do the above than constructing your program in a way that modifying that variable is not necessary or even better in a way that you don’t even care about having a variable. Once you accept the power that is given to you, it’s much easier to start thinking about problems with that power in mind and using it to construct your programs.
Power corrupts so the more power a language provides, the more wary and careful we should be using it.