If you’re familiar with containers you’ve likely heard the terms “declarative” and “imperative” in contrast with one another. To many of us, they’re just buzzwords, and understanding the conceptual differences between them can help your team make better informed decisions around how to build and manage applications. To find out how, let’s take a step back to define the differences, and give examples of how declarative infrastructure can maximize the efficiency of container deployments.
Definition of Declarative vs. Imperative Programming
Packt Hub defines ‘declarative programming’ as “the form or style of programming where we are most concerned with what we want as the answer, or what would be returned.” Developers are not concerned with how they get there, but rather with the answer that is received. In contrast, in imperative programming developers care about the “how”, the step-by-step process to get to an answer. Imperative programming developers ultimately want the same result as declarative programmers, but they tell the compiler to do things a certain way in order to achieve the answer.
Let’s use the popular pets vs. cattle analogy to further break down imperative vs. declarative infrastructure. In a “pets” model, or with imperative programming, a team may have a single server or small cluster of servers upon which they’re entirely reliant. If a server goes down, it’s devastating--just like a pet being sick. In a “cattle” model, or with declarative programming, a team deploys a cluster or group of servers with failover protection baked in, so if any one server goes down, the rest of the herd is still alive and functional. No singular server (or any storage location) is too precious in a “cattle” cloud computing model, and many teams choose to automate things like configuration management with orchestration tools.
Why Declarative Infrastructure for Containers?
Simply put, declarative infrastructure is the “how” for any trusted container orchestration platform. Opinionated decisions are coded into the platform and, as referenced earlier, the platform will drive to the pre-defined correct answer. As organizations quickly move to deploy their applications in containers, they may find a few things to be true:
There’s a talent shortage: Many teams need to quickly hire developers with expertise in Kubernetes, which are in high demand and short supply. A May 2019 Forbes article estimates that over 5 million IT jobs will be added globally by 2027. According to research from talent search platform DICE, Kubernetes is within the top 2 requested skills of those 5 million open roles.
Container setup becomes much simpler: Containers can be deployed from a single source controlled file, containing environment, configuration, and access specifications for your application. One can easily define and deploy applications composed of multiple microservices, each containing an individualized image from a repository/registry.
Your organization’s resources are already overprovisioned. Regardless of which Cloud environment a team may choose, resources such as CPUs, hardware, storage, and IP addresses are generally costly and in high demand. It quickly becomes difficult to manage scaling up and down based on demand as more applications run on the same infrastructure.
Implementing a single orchestration solution can provide tremendous lift in various areas. Look for one that can codify the following:
Container setup and configuration management
Rather than spending time training current developers in all of these foundational areas, relying on declarative infrastructure to take care of the basics helps them get back to their job: shipping excellent code to meet business objectives.
Click here to learn more about Critical Stack, a container orchestration solution from Capital One, that leverages declarative programming to maximize your productivity in the Cloud. Our developer tier is available to check out now. If you’re new to containers, trying to solve resource gaps, or have a need for speed and automatic scaling, Critical Stack may be the right solution for your use case.