-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8f2092
commit 1c548a7
Showing
3 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,83 @@ | ||
--- | ||
title: "Clean Architecture Part1. Chap2." | ||
title: "Clean Architecture Part1. Chap2. A Table of Two Values" | ||
excerpt: "" | ||
coverImage: "/blog/assets/hello-world/cover.jpg" | ||
coverImage: "/blog/assets/clean-architecture-2-cover.jpg" | ||
date: "2019-04-20" | ||
ogImage: | ||
url: "/blog/assets/hello-world/cover.jpg" | ||
url: "/blog/assets/clean-architecture-2-cover.jpg" | ||
categories: ["clean"] | ||
--- | ||
|
||
Every software system provides two different values to the stakeholders: `behavior` and `architecture`. Software developers are responsible for ensuring that `both` those values remain high. Unfortunately, they often focus on one to the exclusion of the other. Even more unfortunately, they often focus on the lesser of the two values, leaving the software system **eventually valueless**. | ||
|
||
## Behavior | ||
|
||
The first value of software is its behavior. Programmers are hired to make machines behave in a way that makes or saves money for the stakeholders. We do this by helping the stakeholders develop a functional specification, or requirements document. Then we write the code that causes the stakeholder’s machines to satisfy those requirements. | ||
|
||
When the machine violates those requirements, programmers get their debuggers out and fix the problem. | ||
|
||
Many programmers believe that is the entirety of their job. They believe their job is to make the machine implement the requirements and to fix any bugs. | ||
|
||
`They are sadly mistaken.` | ||
|
||
## Architecture | ||
|
||
The second value of software has to do with the word “software”—a compound word composed of “soft” and “ware.” The word “ware” means “product”; the word “soft”… Well, that’s where the second value lies. | ||
|
||
Software was invented to be “soft.” It was intended to be a way to easily change the behavior of machines. If we’d wanted the behavior of machines to be hard to change, we would have called it hardware. | ||
|
||
To fulfill its purpose, `software must be soft—that is, it must be easy to change.` When the stakeholders change their minds about a feature, that change should be simple and easy to make. The difficulty in making such a change should be `proportional only to the scope of the change, and not to the shape of the change`. | ||
|
||
It is this difference between `scope` and `shape` that often drives the growth in software development costs. It is the reason that costs grow out of proportion to the size of the requested changes. It is the reason that the first year of development is much cheaper than the second, and the second year is much cheaper than the third. | ||
|
||
From the stakeholders’ point of view, they are simply providing a stream of changes of roughly similar scope. From the developers’ point of view, the stakeholders are giving them a stream of jigsaw puzzle pieces that they must fit into a puzzle of ever-increasing complexity. Each new request is harder to fit than the last, `because the shape of the system does not match the shape of the request`. | ||
|
||
I’m using the word “shape” here in a unconventional way, but I think the metaphor is apt. Software developers often feel as if they are forced to jam square pegs into round holes. | ||
|
||
The problem, of course, is the architecture of the system. The more this architecture prefers one shape over another, the more likely new features will be harder and harder to fit into that structure. Therefore `architectures should be as shape agnostic are practical`. | ||
|
||
## The Greater Value | ||
|
||
Function or architecture? Which of these two provides the greater value? Is it more important for the software system to work, or is it more important for the software system to be easy to change? | ||
|
||
If you ask the business managers, they’ll often say that it’s more important for the software system to work. Developers, in turn, often go along with this attitude. But it’s the wrong attitude. I can prove that it is wrong with the simple logical tool of examining the extremes. | ||
|
||
- `If you give me a program that works perfectly but is impossible to change, then it won’t work when the requirements change, and I won’t be able to make it work. Therefore the program will become useless.` | ||
- `If you give me a program that does not work but is easy to change, then I can make it work, and keep it working as requirements change. Therefore the program will remain continually useful.` | ||
|
||
You may not find this argument convincing. After all, there’s no such thing as a program that is impossible to change. However, there are systems that are practically impossible to change, because the cost of change exceeds the benefit of change. Many systems reach that point in some of their features or configurations. | ||
|
||
If you ask the business managers if they want to be able to make changes, they’ll say that of course they do, but may then qualify their answer by noting that the current functionality is more important than any later flexibility. `In contrast, if the business managers ask you for a change, and your estimated costs for that change are unaffordably high, the business managers will likely be furious that you allowed the system to get to the point where the change was impractical.` | ||
|
||
## Eisenhower's Matrix | ||
|
||
I have two kinds of problems, the urgent and the important. The urgent are not important, and the important are never urgent.1 | ||
|
||
There is a great deal of truth to this old adage. Those things that are urgent are rarely of great importance, and those things that are important are seldom of great urgency. | ||
|
||
The first value of software—behavior—is urgent but not always particularly important. | ||
|
||
The second value of software—architecture—is important but never particularly urgent. | ||
|
||
Of course, some things are both urgent and important. Other things are not urgent and not important. Ultimately, we can arrange these four couplets into priorities: | ||
|
||
- Urgent and important | ||
- Not urgent and important | ||
- Urgent and not important | ||
- Not urgent and not important | ||
|
||
Note that the architecture of the code—the important stuff—is in the top two positions of this list, whereas the behavior of the code occupies the first and third positions. | ||
|
||
The mistake that business managers and developers often make is to elevate items in position 3 to position 1. In other words, they fail to separate those features that are urgent but not important from those features that truly are urgent and important. This failure then leads to ignoring the important architecture of the system in favor of the unimportant features of the system. | ||
|
||
The dilemma for software developers is that business managers are not equipped to evaluate the importance of architecture. `That’s what software developers were hired to do.` Therefore it is the responsibility of the software development team to `assert the importance of architecture over the urgency of features.` | ||
|
||
## Fight for The Architecture | ||
|
||
Fulfilling this responsibility means wading into a fight—or perhaps a better word is “struggle.” Frankly, that’s always the way these things are done. The development team has to struggle for what they believe to be best for the company, and so do the management team, and the marketing team, and the sales team, and the operations team. It’s always a struggle. | ||
|
||
Effective software development teams tackle that struggle head on. They **unabashedly squabble with** all the other stakeholders as equals. Remember, as a software developer, you are a stakeholder. `You have a stake in the software that you need to safeguard.` That’s part of your role, and part of your duty. And it’s a big part of why you were hired. | ||
|
||
This challenge is doubly important if you are a software architect. Software architects are, by virtue of their job description, more focused on the structure of the system than on its features and functions. Architects create an architecture that allows those features and functions to be **easily developed, easily modified, and easily extended**. | ||
|
||
Just remember: If architecture comes last, then the system will become ever more costly to develop, and eventually change will become practically impossible for part or all of the system. **If that is allowed to happen, it means the software development team did not fight hard enough for what they knew was necessary.** |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.