What’s the Future for OO Programming Languages?

I spent most of my software career either writing, designing or architecting solutions built with a heavy object-oriented (OO) bias. I simply cannot even estimate the number of lines of C# that I’ve written or read. Even now, I love the abstract elegance of good OO code.

However, I’m left wondering how much of a future it has left.

Here are a few thoughts about where mainstream programming is going, and what choices programmers will favour.

Note: When I talk of OO in this article I’m referring to strict, compiled OO languages such as C# and Java, not to dynamic languages that support objects and classes like Python and JavaScript.

Web APIs

Microservices, the second and more complete incarnation of Service-Oriented Architecture (SOA), allow us to decompose our logic into reusable services that are accessed via open network protocols. This is crystallising into an accepted convention of REST/HTTP. The code for our microservice, i.e. what’s behind the API, doesn’t matter to the outside world. Is it OO? Is it even compiled? Who cares?

Indeed, programming web APIs is functional programming in its very nature.

This is partly why JavaScript is such a good fit for server-side code. Whilst the language has been updated to incorporate many OO features such as classes, the language is functional at its core. To define a REST API in JavaScript is really just to map a function onto a route. And since functions are first-class citizens in JavaScript, well that’s just dandy.

By contrast, take a look at some of the implementations of service interfaces in OO languages (e.g. .svc and .asmx in C#) and you’ll notice that they have shoehorned in an OO interface / class structure when in fact an API call invokes a function. You find that to even create a “Hello World” you end up with a binary of an amazing size, because of all the plumbing that’s being done for you under the bonnet.

Look at the size of a NodeJS JavaScript “Hello World” app. A kilobyte? It’s faster too. A lot faster. Functional programming and functional languages definitely have the edge in this area of programming.

Serverless Functions

I don’t know how many of you have used AWS Lambda, or its equivalents (Google Cloud Functions, Azure Cloud Functions). This is a nascent area for programming, which is coming into being because of cloud platforms. Essentially, serverless functions are pieces of code that are invoked by an event. However, they don’t have a permanent host hence the “serverless” moniker.

When an event trigger occurs, such as a message being placed on a queue, the cloud platform spins up an instance to run the code that handles the event. When it’s finished, the instance can terminate and hence free up resources. This is an amazingly powerful concept, because it really is getting as close as possible to a pay-as-you-use model.

And the programming paradigm? Functional. Dynamic. You invoke a function to handle the event and the data that comes with it. Ideal language for this type of scenario? Python.

What you can achieve with a few imports and a few lines of code in Python requires a mind-bending amount of references and components in many formal OO languages.

UI

User interface (UI) is a very interesting area from a technology point of view. My old boss always used to say that the only thing a user ever knew of your software was the screen in front of him. You’d better make that good or your users will all assume everything else is rubbish as well. No matter how unfair, that’s the way it is.

As a result, UI is the area where the real pace of change is felt. You only need to go back a couple of versions in many pieces of software (or websites) and you will cringe at the clunky interface you used to take for granted. UI sells.

Good UIs are stateful too, and hence they lend themselves to OO design. Browser-based UIs were something of an exception, as postbacks to the server to refresh HTML content were effectively functional web API calls. The trend towards single page applications and frameworks such as ReactJS and Angular have meant that even browser-based UIs are now falling in line with OO programming methods. Ironically, using JavaScript.

I see UI as one of the last great outposts of OO programming.

Frameworks

The open source movement, combined with open package repos and package managers (e.g. NPM, pypi, NuGet) have massively impacted on the way we use code. Software is built on software, and if a problem has been solved before, well you’d be insane not to reuse the solution.

In terms of language and programming paradigm the jury is out on this one. There’s such a split in the packages that are out there that it’s hard to make predictions. There is a ton of functional JavaScript code out there, just as almost everything on NuGet is probably OO.

This is an interesting one to watch. Frameworks and framework extensibility were a case study for OO design patterns. Now, the functional world has found its own patterns for extensibility and reuse. I’m interested to see what wins out in this area.

Other Trends

The trend away from installed on-premise software to Software-as-a-Service (SaaS) is only going to accelerate. This will build on the points above, but the real demise will be felt when companies are decommissioning system after system from their own datacenters to avoid having to maintain and support them.

Add to this the shift to cloud. Do the math – cloud represents huge savings and huge opportunities if embraced correctly. Less so for pure lift and shift of on-premise systems, but organizations that are architected from the ground-up to take advantage of cloud and SaaS will have huge competitive advantage. Again, this is more of the same: APIs, Serverless Functions, UI.

DevOps is a hot topic, and one close to 345’s hearts. If you look at what’s going on there you find a lot of scripting going on. Python’s very strong, but so is Ruby. Bash is very procedural, PowerShell mostly procedural but also made to support .Net. I think Python is going to win big in this area over the next few years. Just look at the AWS CLI. Python is also widely adopted within Google.

Summary

This has been a whirlwind tour of a big subject area, sprinkled with a thin layer of thoughts. By all means add your own input to the comments.

I think the big growth areas in programming are going to be (1) further decomposition into microservices and APIs, (2) serverless functions to handle asynchronous processing, (3) SaaS applications replacing installed applications.

Of these, I think the first two will be dominated by functional programming and dynamic languages.

If you’ve been used to OO you’ve probably told yourself time and again that you’re doing it the “proper” way and those functional programmers / scripters are cowboys. Free your mind to accept the fluidity of a functional language: the possibilities are huge. And realise that the scripters aren’t cowboys after all, they just have a different way of thinking. They don’t rely on compilers, they rely on tests. Which is a good thing.

2 Comments

chris May 10 2017

This is obviously the POV of a functional programmer and / or scripter, surely a pythonist 🙂

OOP and FP are not enemies as many languages like scala or F# have proved it.
Even python and js have taken OOP concepts as they are sometimes easier to use than FP.
And as you said, if you are programming a WEB API it does not really matter in the end.

However, I do not agree that dynamic / scripting languages are going to dominate microservices and web API.

I think that statically typed languages are winning the war currently (typescript slowly replaces JS in the frontend and soon in the backend imho, all FP languages except python/ruby are statically typed, etc…)

The main problem/limitation with dynamic languages is that they rely _only_ on tests (when there are tests), which is not sufficient for many tasks of a programmer.
Renaming variables or functions, adding a parameter, finding references, encapsulating into a value object, etc… are all kind of stuff that are way faster to perform in a typed language with a correct tooling.

Many thanks for your comment, it’s great that you have joined the debate on this. It’s a good point that dynamic languages are including OO elements (and also OO languages are including dynamic elements too).

I approached this article from a background of 20 years’ OOP, and so this is not an expression of preference for any programming paradigm; it’s an attempt to look at some of the trends out there and to see which style of programming appears to be stronger in different areas of computing. I’m going to come back to this in a year or two and see what the programming world looks like (from my perspective) by that time.

What I’d always stress to my developers is that they should focus on quality first, the language and technology are just tools for getting the job done 🙂