Automate? Always!

Automate? Always!

Some years ago I gave a talk, titled "Automate? Always!", to stimulate a discussion about automation in software engineering. Today, I am putting the argument in writing to reach a bigger audience.

Note: in this post I refer to any automation in software development lifecycle: spanning from editor macros to deployment scripts (I confess my preference for the latter as you will perceive).

Please bear with me because this will be a bit longer than other posts, although there is more to say that can fit a single article.

Common thinking: automation is cost-saving

Let's start with this quote ?our goal should be to automate all the activities that are repeated while creating and maintaining the system? (Priti Biyani, ThoughtWorks, emphasis mine). ThoughtWorks suggests that repetion triggers automation, and, I note, the implicit background is of a greenfield project and its evolution.

In a less solemn, more graphical, way xkcd #1205 conveys the idea of time-saving.

Is It Worth the Time? from xkcd webcomic

If you do not spare time, Randall suggests, it is senseless implement some automation.

You can find more examples in literature, blogs, and journals. The assumption is the same: automation is justified by time-saving, that is cost-saving.

Although this is plain common sense, I felt that reality is more nuanced and found a good list of reasons by Mattias Geniar. He enumerates six justifications:

  • to save time,
  • to gain consistency,
  • to gain speed, momentum and velocity,
  • to schedule tasks,
  • to reduce boring or less fun tasks,
  • to keep sysadmins and developers happy.

Here we start to see two new perspectives: psychology and operation. We can easily add that automation in software helps:

  • reducing human mistakes and manual errors,
  • improving process quality, through the design and analysis effort,
  • achieving more, for example by allowing people to do things without detailed knowledge of a system internals.

The rest of this article tries investigating these additional reasons for automation so you can better judge some less direct and intangible elements that may suggest that investing in automation is the right thing to do in a specific context.

Automation creates opportunities, cost-saving is a side-effect

I articulate seven dimension that adds value to the automation effort: exploring, process improvement, the ripple effect, human satisfaction, learning, inspection & validation, and tracking.

Exploring

You face a new application, a new system: people who worked on it has left, documentation is poor. What can you do?

Add automating is a way to understand an existing system. You may see the system as black box, and try to automate configuration changes, or write some deployment scripts. Maybe you add a CI pipeline replacing ad-hoc build scripts that assume a specific developer configuration.

All these activities require some level of reverse engineering and experimenting with the system in a semi-scientific way: you experiment and validate your hypothesis how the system interact with the environment. Configuration, dependencies, relations will emerge as the result of your trial-and-error attempts to automate it.

Improvement

Any automation removes a manual process. Isn't self-evident? Not always. Removing human intervention is not simple and obvious: you may face resistance, power play, fear. Your automation must be transparent, and valuable.

Transparency has two sides: one is the visibility of automation inner workings, the other is tracking automation steps for auditing and debugging.

Value can have multiple facets:

  • an administrator reduces the time for a task,
  • a user has to wait less for a result,
  • more tasks completed without errors,
  • costly mistakes prevented by early checks.

In general, we should consider both direct positive effects and negative, preventive effects, gains as well as reduction of costs.

Documenting

All of us have met a system poorly documented. Trying to automate is a way to describe its behavior.

This approach is similar to the effect that many bloggers describe: to learn something a great technique is forcing ourselves to write about it. It is similar to implementing automated tests for an application: each test defines exactly a little bit of system's behaviour.

The value of automation is in what we may call "actionable documentation": not a passive document, that requires interpretation, but something you can use to act on the system.

Automating to document implies that the automation code is published in an easy-to-access location, where anybody interested in the target system will look for information.

Ripple Effect

Consider now these unintended positive effects:

  • success in automating a piece may induce or permit automating other pieces,
  • it may start a virtuous emulation trend and more people automates their chores with great gains for the overall organisation,
  • shows technical feasibility lowering barriers for other implementations,
  • demonstrates value to management.

Most of the items listed are psychological and reflects onto the organisation performance.

Satisfaction

Subtler psychological effects, less quantifiable though real, are:

  • happier people, delegating boring chores to machines and focusing on more interesting topics,
  • simplicity and ease of use, compared to following playbooks or ticking checklists,
  • that sense of accomplishment that any developer knows when a program is complete and works as expected,
  • when the automated task was quite complex, we reduce the mental effort for executing the task.

Learning

I mentioned before the idea of automate to learn, let's talk now what one can learn.

The most obvious things to pick up are new technologies and learning scripting languages. Less prominent are infrastructure concepts, experience with real practical constraints. What a magnificent way to appreciate network latency is copying files across the pond! Master how parallelism really works trying to minimize deployment times across a bunch of machines.

Inspect & Validate

Legacy, and a thrill goes down the spine of any engineer. Legacy system, legacy code, how can we trust it, how can we touch and change it? Well, automation is a way to inspect and review an existing component. Writing a build script, a deploy script, a script to change configuration, forces the author to review existing manual configurations, question their settings, and add automated validation checks along the process.

I have often encountered configuration files that are just a chaos of unrelated properties, with no organisation nor standard names. Like coral or stalactites, it grew unnoticed in the darkness. Time to question, refactor, and clean it!

Track

One last element to address is the gain in visibility. Automation makes easy to identify usage, dependencies, and configuration. Instead of searching for a Word document which states that you need to install version X of a component, this dependency is stated in plain view in an automation script.

Automation allows collecting information and store it in a central place. An example is building an organisation-wide dependency database, crucial to manage security issues (Software Bill of Materials, SBOM).

Conclusions

“Automate ALL the things” (Niall Murphy et al., Site Reliability Engineering) is a fundamental idea of modern software engineering. It's about delegating more to machines and moving to a declarative style.

Consider what to automate first, plan for adding incrementally more automation to your daily work, prioritise considering all effects, both direct and indirect.

Don't fall into the trap of automating the wrong thing, at the wrong time: xkcd #1319

Automation from xkcd webcomic

Capture the state before and after, better with at least one hard, objective metric. Communicate what you achieved, showing the benefits. Tell broadly displaying the measures: it will inspire others.

Finally, do not forget that DevOps is not about automation. Automation supports the DevOps perspective.

References

When to Automate and Why

Why do we automate?

Functional Tests - How to Decide What to Automate?

Niall Murphy et al., Site Reliability Engineering, O′Reilly 2016


What do you think? Am I wrong?

Kenneth Cochran

Senior DevOps Engineer with 18+ years of experience

2 年

I don't think the cost savings and productivity gains can be overstated. Two centuries ago 90% of the world lived in multi-generational poverty. Today it world poverty hovers at around 10%. Most of this prosperity is due to automation. What the XKCD comic and other illustration missed is that the cost savings of automation isn't measured in minutes and hours. It's measured in decades and centuries and on scales far larger than an individual, team or even company. They have a ripple effect that benefits the economy for current and all future generations that far outweighs the time and effort it took to implement them.

回复

要查看或添加评论,请登录

Giulio Vian的更多文章

  • Only Build Your Binaries Once

    Only Build Your Binaries Once

    One of the principles highlighted, many years ago, in Continuous Delivery is: Only Build Your Binaries Once (Chap.5 p.

  • Only Build Your Binaries Once (versione italiana)

    Only Build Your Binaries Once (versione italiana)

    Uno dei principi evidenziati da Continuous Delivery, già molti anni fa, è Only Build Your Binaries Once (Cap.5 p.

  • Designing CI/CD pipelines in 2023

    Designing CI/CD pipelines in 2023

    Here's a long article just in time for the Christmas holidays. Today I want to give you an overview of what to expect…

  • La pipeline CI/CD nel 2023

    La pipeline CI/CD nel 2023

    Ecco un lungo articolo in tempo per le vacanze natalizie. Oggi voglio darvi una panoramica su cosa prevedere in una…

    1 条评论
  • Rilasci non-funzionali

    Rilasci non-funzionali

    Cosa sono i rilasci non-funzionali? è presto detto: sono rilasci "tecnici" senza alcun cambiamento funzionale. Qualcuno…

  • Non-functional Releases

    Non-functional Releases

    What are non-functional releases? It is easy to say: they are “technical” releases with no functional changes. Someone…

  • Packages or Containers?

    Packages or Containers?

    In a previous article I considered the principle that DevOps collects from Lean, namely the importance of minimizing…

  • Pacchettini o Containers?

    Pacchettini o Containers?

    In un precedente articolo ho considerato il principio che DevOps raccoglie da Lean, ossia l'importanza di minimizzare…

    1 条评论
  • Automatizzare? Sempre!

    Automatizzare? Sempre!

    Alcuni anni fa ho tenuto una conferenza, dal titolo “Automate? Always!” (Automatizzare? Sempre!), per stimolare una…

  • Is DevOps no more than automation?

    Is DevOps no more than automation?

    One big misconception about DevOps is that it is just automation, no other purposes. Nothing is more wrong.

    2 条评论

社区洞察

其他会员也浏览了