A unique solution to every problem

2015-05-02 2 min read

    A thought experiment I’ve had on my mind is this idea of a programming language that only has a single way of solving every programming problem. Regardless of the problem, multiple people writing code independently would end up with the same exact code. No such language actually exists (yet) but it’s fun to think about extreme cases in order to understand where we stand now. With this programming language the only differentiation between developers would be time since the end result would be the same. Beyond that, if there was always a unique solution to every problem this language would be able to write the code itself.

    On the other extreme you have current languages which provide a ton of flexibility with dozens of ways to solve a simple problem. In this world developer skills are paramount. You want to make sure you find the approach that solves the current problem but is also written in a way that’s flexible enough to be easily modified for whatever the future brings. Enforcing a structure that’s based on best practices makes it easy to write code that grows with the team.

    A great example of this is the rise of JavaScript frameworks. JavaScript is extremely flexible and gives the developer a wide range of paradigms to choose from. This leads to the same problem being solved hundreds of different ways depending on the style and mood of the author. The fact that it actually has a book dedicated to the “good parts” highlights how flexible the language is and how easy it is to go off track. Despite being close to twenty years old, only now are we seeing frameworks being developed that take a very opinionated view of how JavaScript should be written. There’s nothing in the language itself to enforce a standard so each framework takes on the responsibility. This allows large teams to collaborate on large projects without having to worry as much about individual styles and decisions.

    Software engineering is a new industry and I suspect we’ll see more and more standardization as it evolves. The current approach is to use general languages for a wide range of problem domains but I think we’ll start seeing more and more languages that are specialized by problem domain. This won’t get us to the language with a single way of doing things but it will it a lot simpler to solve problems in a well defined and standard way.