Figuring out programming for the cloud

In the last dozen years or so, we’ve witnessed a dramatic shift from general purpose databases (Oracle, SQL Server, etc.) to purpose-built databases (360 of them and counting). Now programming languages seem to be heading in the same direction. 

As developers move to API-driven, highly elastic infrastructure (where resources may live for days instead of years), they’re building infrastructure as code (IaC). But how to build IaC remains an open question. For a variety of reasons, the obvious place to start was with imperative languages like C or JavaScript, telling a program how to achieve a desired end state.

But a new model of declarative languages — like HCL from HashiCorp or Polar from Oso — has emerged, where the developer tells the program what the desired end state is, not overly worrying about how it gets to that state. Of the two approaches, declarative programming might well be the better option, resulting in leaner, safer code. Let’s look at why this is.

The why of declarative programming

When I asked Sam Scott, co-founder and CTO of Oso, whether we really needed another programming language, his answer was “yes.” The longer version: “With imperative languages there is often a mismatch between the language and its purpose; that is, these languages were designed for people to build apps and scripts from the ground up, as opposed to defining configurations, policies, etc.”

Introducing new, declarative languages like Oso’s Polar may actually save us from language proliferation, Scott went on: “It’s not just about introducing another language for solving a specific set of problems. Rather, it’s creating something to avoid people from having to invent their own language time and time again to do some form of embedded logic.”

Take, for example, the JSON code written for AppSync authorization:

Copyright © 2020 IDG Communications, Inc.

Source link