Conventions and capabilities

Computer programmers have been arguing about programming languages for decades. Is functional programming better than object oriented programming. Should we all be using logical programming instead? In the midst of the language wars, mainstream object oriented languages have been quietly adopting functional language features. Java in particular has been adding functional paradigms like mapping and filtering over streams to the language in java 8. Now why would Java add streams now, when the concepts have been around for decades? Well part of the reason is that these language filters had become so mainstream it was hard to ignore the demand for them. 

Why not just use functional languages? They have numerous advantages over object oriented languages like Java, sum types, higher order polymorphism, etc. What is the hold up? Well, while functional languages have many language features that are better, their weaknesses are typically in the tooling and the programming conventions that have developed. 

When you create a new language you do not know what is the most effective way to build things in that language. In Java it has taken  10+ years to develop post Java EE conventions that are effective. And Java has been one of the most used languages in the world for that entire time. Many languages have features that are simply ignored in professional use. In Haskell the default String type is horrible and no one uses it for professional projects. Others like Scala require you to avoid higher order types if you want compile times to be reasonable. 

Tooling is the other side of the equation. Java’s tooling has evolved in support of the conventions. Java has tooling to block certain dependencies, to auto-format code and to determine the cyclomatic complexity of methods. Today most Java professionals use either Intellij or Eclipse as their editor. These editors have had millions of dollars invested in them to support professional software development in Java. All this tooling makes Java work well once you have it setup, but getting setup is difficult. 

The final stage is when you merge conventions back into the language. Golang is the best example I have worked with. Go has merged auto-formatting into the compiler. The ‘go’ tool supports formatting the same way it supports compiling and testing. There are no arguments on the subject. Your code is either formatted to spec with the tool or incorrect. The best part is that there is no setup. It can take days to get a new Java environment working even if installing Java takes minutes.  

Leave a Reply

Your email address will not be published. Required fields are marked *