The Modern Software Engineer
All the ideas in this book are deeply intertwined. There is crossover and redundancy everywhere. You can’t really separate concerns without improving modularity.
Modularity , cohesion , and separation of concerns enhance our ability to gather feedback and so facilitate experimentation .
As a result, I have looped through each of these topics many times during the course of this book. That is both intentional and inevitable, but I also think that it says something more important about these ideas.
Not only are these ideas deeply linked, but they apply nearly everywhere, and that is kind of the whole point.
It is too easy to get lost in the detail of ephemera. Which language, operating system, text editor, or framework we choose is detail that, ultimately, should matter less to us than those skills that are transferable across all of these things.
As I have said elsewhere, the best software developers I have worked with wrote good software whatever tools they chose to apply. Certainly, many of them had deep expertise and skill with their chosen tools, but this wasn’t the core of their skill, talent, or value to the organizations that employed them.
All these ideas are probably familiar to you, but perhaps you haven’t thought of them as an approach to organizing your work. That has been my intent with this book. I don’t mean only to remind you that these things are there, but to recommend that you adopt them as the driving principles beneath all that you do.
These ideas, organized around the principles of optimizing everything that we do to maximize our ability to learn and to manage the complexity of the systems that we create, genuinely form the foundation of a discipline that we can justifiably refer to as an engineering approach to solving problems with software.
If we do these things, we have a higher likelihood of success than if we don’t.
This isn’t a “crank the handle” kind of approach. You are not going to get great software by simply following my, or anyone else’s, recipe, any more than you will create a great car by following some mythical dot-to-dot-car-builder’s manual.
This requires you to be thoughtful, diligent, careful, and intelligent. Software development is not an easy thing to do well. Some forms of coding may be, but as I have already described, there is a lot more to software development than only coding.
This is a simple model for software engineering, but one that it is difficult to apply.
It is simple in that there are ten fundamental ideas in two groups and then a few tools like testability, deployability, speed, controlling the variables, and continuous delivery that can help us achieve those fundamentals, and that is all that there is. However, the implications of these ten things are often thought-provoking and complex, so that can make them difficult to apply.
Mastering the use of these tools and using these ideas as the foundational principles that underpin our designs and decisions amplify our chances of success. Using them as the basis on which we make decisions about the software that we create seems to me to be at the heart of the discipline of software development.
My objective with this book is not to say “software is easy” but rather to admit that “software is difficult, so let’s approach it thoughtfully.”
For me, that means we need to approach it with a bit more care, within a framework of thinking that enables us to find better answers to questions that we haven’t thought of yet. It’s a approach to finding solutions to problems that we have no idea how to solve.
These ten things give me this framework, and I have seen many individuals and teams benefit from applying them.
Understanding the nature of our discipline affects our ability to make progress. Recognizing the reality of the complexity of the systems that we build, and of the very nature of software itself, is important to success. Treating it lightly as a trivial exercise in coding a semi-linear sequence of instructions is always doomed to failure in all but the most trivial of programming exercises.
We need to apply mental tools that we can adapt to whatever circumstances we face. This seems to me to be at the heart of anything that we could think of as a true engineering discipline for software.
Engineering as a Human Process
The term engineering can be slippery, as it is often misapplied in the context of software development.
Most definitions of engineering begin with something like “The study of the work of an engineer” and then go on to describe the use of math and science that informs that work. So it is really about the process, our approach to doing work.
The working definition that I introduced at the start of this book hits the target for me.
Engineering is the application of an empirical, scientific approach to finding efficient, economic solutions to practical problems.
Engineering is empirical, in that we are not attempting to apply science to the degree that we expect perfect results every time. (Actually, science doesn’t work like that either; it just strives to approach it.)
Engineering is about making rationally informed decisions, often with incomplete information, and then seeing how our ideas play out in reality based on the feedback that we gather from real-world experience.
It is based on a scientific style of reasoning. We want to measure what we can sensibly measure. Take an experimental approach to making changes. Control the variables so that we can understand the impact of our changes. Develop and maintain a model, a hypothesis, against which we can continually evaluate our understanding as that understanding grows.
It is important that the solutions we find and the way in which we work to achieve them are efficient.
We want the systems we create to be as simple as they can be and run as quickly as they can while consuming the minimum resources they need to succeed.
We also want to be able to create them quickly and with the least amount of work. This is important for economic reasons, but it is also crucially important if we want to be able to learn effectively. The timeliness of feedback is a good measure of the efficiency with which we do work. The timeliness of feedback, as we explored in Chapter 5 , is also fundamental to our ability to learn effectively.
In addition to the general applicability of engineering thinking to development, it is important to recognize that the organizations and teams we work in are information systems too, so the ideas of managing complexity apply equally, if not more, to those things, too.
Digitally Disruptive Organizations
It is common for businesses and business leaders to talk about ideas like digital disruption, by which they mean digital technologies applied to re-imagining and disrupting traditional businesses. Think Amazon disrupting the retail supply chain, Tesla changing the fundamentals of how you approach car production, or Uber turning taxi services into a gig economy. These ideas are challenging to traditional businesses and to traditional business thinking.
One of the defining characteristics of organizations like these is that they are nearly always engineering-led. Software development is not a cost center or a support function; it is the “business.” Even a company like Tesla, whose product is a physical device, has shaped its organization around software ideas.
Tesla is a continuous delivery company to the extent that if someone thinks of a new idea, they can reconfigure the factory, often through software, to apply the new idea.
Software is changing how business is conducted, and to do this, it challenges many traditional assumptions.
One of my favorite models comes from Jan Bosch; he describes it as “BAPO versus OBAP.” 1 Figure 15.1 and Figure 15.2 help to explain his idea.
Figure 15.1
How most businesses plan (OBAP)
Most firms follow an OBAP model (see Figure 15.1 ). They first fix the organization, departments, teams, responsibilities, and so on. Then they decide on a business strategy and how to generate revenue and profit or other business outcomes, based on the constraints of those organizational decisions. Next they decide on a suitable architecture to base their systems on, and finally on a process that can deliver that system architecture.
This is kind of crazy. The business vision and goals are constrained by organizational structure.
A more sensible model is to treat the structure of our organizations as a tool: BAPO.
We identify business vision and goals, decide how we could achieve that technically (architecture), figure out how we could build something like that (process), and then pick an organizational structure that will support the necessary activities.
- Jan Bosch describes these ideas in his blog post “Structure Eats Strategy” at https://bit.ly/33GBrR1 and in his book Speed, Data and Ecosystems . See https://amzn.to/3x5Ef6T .
Figure 15.2
How business should organize (BAPO)
When we start thinking about the ways that we organize groups of people as a tool to achieve an end, applying the kind of engineering thinking described in this book is central to the successful wielding of that tool.
As with any other information system, managing the coupling within our organizations is one of the keys to success. In the same way that this is true for software, it is true for organizations. Modular, cohesive organizations with a sensible separation of concerns and teams that are abstracted in a way that allows them to hide information from other parts of the organization are more scalable and more efficient than highly coupled groups that can make progress only in lock-step.
This is one of the reasons that it is so difficult to scale organizations. As they grow, the costs of the coupling increase. Designing organizations to minimize the coupling between different groups of people is the modern strategy for large, fast-growing companies.
It is not an accident that the research behind the Accelerate book found that one of the defining characteristics of high-performing teams, based on measures of stability and throughput, is that they can make decisions within the team, without seeking permission from, or coordination with, other groups. Such teams are informationally decoupled.
This is important stuff. It is the difference between an organization like Amazon, which more than doubles in productivity when it doubles in size, and a more traditionally structured firm that increases productivity by only 85 percent as it doubles in size. 2
- James Lewis, inventor of the term microservices , has an interesting presentation that touches on the work of the Santa Fe Institute on Non-Linear Dynamics. See https://youtu.be/tYHJgvJzbAk .
Outcomes vs. Mechanisms
As I approached writing the conclusions of this book, I became involved in an online debate about the importance of outcomes and mechanisms. I started from a position of absolute certainty that everyone would agree with me that outcomes are more important than mechanism. I was quickly disabused of this assumption.
However, I don’t think that my interlocutors were stupid because they disagreed with me. Looking at their responses, I think they ultimately agreed with my point. They weren’t dismissing the importance of “outcomes”; what they were worrying about were some implicit things that they valued, or the mechanisms that they preferred, that helped them achieve their desired outcomes.
A successful outcome for software development is a complex idea. There are some obvious things that are easy to measure that we can begin with. We can measure commercial outcomes for some kinds of businesses and software; this is one measure of success. We can measure usage numbers, and the success of an open source software project is often measured in the number of downloads that the software accrues.
We can apply the DORA measures of productivity and quality, stability , and throughput , which tell us that successful teams produce very high-quality software, very efficiently. We can also measure customer satisfaction with our products through a variety of metrics.
Good “scores” in all of these dimensions are to some degree desirable outcomes. Some of them are contextual, and some are not, and working efficiently with quality (having good scores in stability and throughput ) is going to be more successful in any context than not, which is why I consider these measures to be such an effective tool.
The context in which I had my discussion about “outcomes being more important than mechanisms” was a debate about continuous delivery as an idea compared to DevOps as an idea. 3
My point was that I thought continuous delivery defines a desirable outcome, rather than a mechanism, so it is more useful as a general, organizing principle to guide development strategy and approach.
DevOps is an extremely useful collection of practices; if you adopt all of the practices and do them well, then you will be able to continuously deliver value into the hands of your users and customers. However, if a circumstance arises that is outside the scope of DevOps for some reason, because it is more a collection of practices, then it is less obvious how to cope.
Continuous delivery, though, says “work so that your software is always in a releasable state,” “optimize for fast feedback,” and “our aim is to have the most efficient feedback from idea to valuable software in the hands of our users.”
If we take these ideas seriously, we can use them to come up with unique, innovative solutions to problems that we haven’t encountered before.
- If you are interested in my thoughts on CD versus DevOps, watch this video on my YouTube channel: https://youtu.be/-sErBqZgKGs .
When I, and others, began work on codifying continuous delivery, we had never built a car or a spaceship or a telecoms network. Each of these activities presents very different challenges to the kinds of systems that we were building when Jez Humble and I wrote our book.
When I work as a consultant, I give my clients specific advice on targets and goals that they should strive to achieve in terms of feedback from their deployment pipelines. I generally advise my clients to aim for a result in five minutes from the commit stage and in less than one hour for the whole pipeline. “Aim to create something releasable every hour.”
If you are Tesla building a car or SpaceX building a rocket or Ericsson building a global mobile phone infrastructure, this is probably not possible because the physics of burning silicon or making things out of metal gets in the way.
However, the principles of continuous delivery still hold.
“Work so that your software is always releasable.” You can still test your software thoroughly, rejecting any change immediately if a single test fails. “Optimize for fast feedback.” Automate everything: automate tests to do the vast majority of testing in simulation so that feedback is always fast and efficient.
More deeply than this, the ideas that we can take from science, the ideas that continuous delivery is founded upon, are the most durable of all.
-
Characterize : Make an observation of the current state.
-
Hypothesize : Create a description, a theory that may explain your observation.
-
Predict : Make a prediction based on your hypothesis.
-
Experiment : Test your prediction.
To make sense of what we learn from this approach, we must control the variables. We can do this in a few different ways. We can work in small steps so that we can understand the impact of each step. We can exercise complete control over the configuration of our systems and limit the scope of change with the techniques of managing complexity that we have discussed.
This is what I mean by engineering—the ideas, methods, and tools that give us a demonstrably higher chance of success.
You may not be able to hit the feedback targets that I generally recommend, but you can use them as a target and work toward them within physical, or maybe economic, constraints.
Durable and Generally Applicable
If we were to succeed in defining an engineering discipline for software development, then it would be agnostic of technology. The principles on which it was built would be long-lasting and useful, helping us answer questions that we hadn’t foreseen and understand ideas and technologies that we haven’t invented yet.
We can try this!
My career has been spent developing software that my colleagues and I have designed, but could we apply this kind of thinking to a different form of software development? Do these engineering principles still apply to machine learning (ML)?
Figure 15.3 shows a typical ML workflow. Time is spent organizing training data, cleansing it, and preparing it for use. Suitable machine learning algorithms are selected, fitness functions are defined to apply to the input data, and then the ML algorithms are let loose on the training data. They cycle around trying out different solutions to the problem until the desired accuracy of a match to the fitness function is achieved. At this point, the generated algorithm can be deployed into production.
Figure 15.3
Typical ML workflow
If the accuracy isn’t achieved, the process cycles around with the developers/data scientists changing the training data and fitness functions to try to target an effective solution.
Once the algorithm makes it into production, it can be monitored, and if any problems are noticed, it can go back into the cycle to be retrained.
How does our engineering model fit?
Clearly, the development of machine learning systems is all about learning, and not just for the machine. Developers need to optimize their work, and approach, to allow them to learn what data to use to train their systems and what works in fitness functions to guide that training.
Training machine learning systems involves lots of data, so thinking about and actively adopting techniques to manage that complexity is essential to making good progress. It is easy and quite common, I am told, for data scientists to get lost in morasses of data and make no reproducible progress.
The development process itself is obviously going to work best as an iterative one. The assembly and preparation of training data and the establishment and refinement of suitable fitness-functions are fundamentally iterative processes. Feedback is delivered in the form of the accuracy of matches to the fitness function. Clearly, this will work best when the iterations are short and the feedback fast and clear. The whole process is one of experimental iteration and refinement.
Thinking of it that way gives us opportunities to do a better job. It will be sensible to optimize the process so that developers can cycle through it quickly to improve the quality of the learning at each iteration. That means working in smaller steps and being clear about the nature and quality of the feedback.
Thinking about each small step as an experiment encourages us to take greater control of the variables, such as version controlling our scripts and training data.
It seems somewhat bizarre to even imagine this part of the process being planned and working in anything other than a dynamic, iterative, feedback-driven process of empirical discovery.
Why empirical? Because the data is messy and the outcomes are complex enough to be not deterministic at the levels of control that are typically exercised in ML development.
That suggests another interesting question. Could you exercise more control? I had interesting conversations with an ML expert. He questioned my simple picture (refer to Figure 15.3 ). “What do you mean by monitoring? How can we possibly know the result?”
Well, if we took an engineering approach, then we would approach the release of our model into production as an experiment. If it is an experiment, then we are making a prediction of some kind and need to test our prediction. At the point that we create our ML system, we could imagine describing what it is that are we attempting to do. We could predict the kind of outcomes that we might expect to see. This is more than the fitness function. This is more like defining some error-bounds, a range, within which we would expect sensible answers to fall.
If our ML system is designed to sell more books, it is probably not doing a good job if the answer drifts into the territory of “try to take over the world.”
What about managing complexity? Well, one of the problems in ML is that the people doing it often don’t come from a software background. As a result, many of the techniques that have become normal for software development—even basic ones like version control—are not the norm.
Nevertheless, it is easy to see ways that the engineering principles in this book might be applied. Taking a modular approach to writing the scripts to assembly, cleansing the data, and defining fitness functions is obvious. This is code, so use the tools necessary to allow us to write good code. Control the variables, keep related ideas close together with cohesion, and keep unrelated ideas apart with modularity, separation of concerns, abstraction, and reductions in coupling. This is just as true of the data involved, though.
Applying these ideas to the data and selecting training data that is modular (in the sense that it focuses on the right aspects of the problem) allow developers of ML systems to iterate more quickly. This limits changes and focuses the training process and perhaps facilitates a more effective, more scalable approach to managing training data. This is one take on what data cleansing really means.
Ensuring a separation of concerns within the data and the fitness functions is also important. You can sensibly think of problems like ML systems making bad decisions based on built-in “assumptions” between things like economic circumstances and ethnic groupings or salaries and gender as representing a poor separation of concerns in the training data, as well as a sad statement on our society.
I will stop at this point, before I expose even more of my ignorance about machine learning. My point here is that if these mental tools are generally applicable, they will provide us with useful ways to approach problems, even when we are ignorant of them.
In my example here, I don’t claim that I have come up with any correct answers, but my model has allowed me to pose some questions that aren’t, as far as I understand it, commonly asked in ML circles. They are questions that we could investigate and that could possibly help us optimize the process, improve the quality of the production of ML systems, and even improve the systems themselves.
This is what we should expect from a real engineering process. It will not give us the answers, but it will provide us with an approach that guides us toward better answers.
Foundations of an Engineering Discipline
The ideas in this book form the foundations for an engineering discipline that can amplify our chances of success.
The programming language that you choose doesn’t really matter. The framework that you employ doesn’t really matter. The methodology that you pick matters less than the ideas that I have outlined in this book.
It is not that these other things have no bearing on our work; they do. They matter to the degree that the model of hammer that a carpenter chooses to wield matters.
For software, this sort of choice is a bit more than a personal preference because it has an impact on how a team works together, but in essence the choice of one tech over another has less impact on the outcome than how that technology is applied.
My intention with this book is to describe ideas that, in general, offer us guidance on how to wield our tools more effectively.
By focusing on the fundamentals of optimizing for learning and managing complexity, we increase our chances of success, whatever technology we choose to use.
Summary
The ideas in this book have formed the basis of my approach to software development for many years now. Inevitably, the process of writing this book has helped me crystallize my thinking in a way that, I hope, makes it easier to communicate them to other people.
In the latter stages of my career, I have worked, almost exclusively, on complex systems. I have been fortunate to work on a few problems that few people, if anyone, had solved before. Whenever my team and I became stuck, these are the fundamentals that we turned to. They worked as guide rails to steer us to better outcomes, whatever the nature of the problem, even when we had no clue at all about how to make progress.
These days I make my living advising mostly big multinational firms, often doing innovative things, sometimes on unprecedented scales. These ideas still hold true and guide us to solving genuinely difficult problems.
When I get to write code for myself, still something that I take great pleasure in, I apply these same ideas at the smallest and often simplest of scales.
If you always optimize your work and how you undertake it to maximize your ability to learn efficiently, you will do a better job.
If you always work, at every scale, to manage the complexity of the work in front of you, you will be able to sustain your ability to do a better job indefinitely.
These are the hallmarks of a genuine engineering discipline for software development. When we apply that discipline, we dramatically improve our chances of building better software faster.
There is something important and valuable here. I hope that I have been able to express it in a way that you will find helps you in your work.