We often say: know what is, but also know why.
Learning a method and solving a problem in practice can only mean mastering the What and How of the method.
Therefore, we need to talk about object-oriented analysis and design methods from a relatively primitive point of view, namely the basic fact of complexity. This brings us to the object oriented approach to Why.
Abstract hierarchy of complex systems
Object orientation is a design approach that relates to the real world and nature, so we need to pay attention to the world and nature in which we live first.
From anatomy to nuclear physics, from plants to animals, you’ll find that complex systems are often layered.
Below, we can summarize several manifestations of the abstract hierarchy characteristics of complex systems:
1. Complex system is hierarchical, and each layer in the hierarchical structure has its own complexity.
For example, plants contain three main structures: root, stem and leaf. The complex structure of the root can be divided into branches, hairs, apices, and crowns. Similarly, the very cross-section of the leaf shows the complex structure of the epidermis, mesophyll, and root bundles.
2. The different layers of a complex system represent different levels of abstraction, with all parts of the same level of abstraction interacting in some well-defined way.
For example, at the highest level of abstraction, roots are responsible for absorbing water and minerals from the soil; The root interacts with the stem, which carries these materials to the leaf; The leaves use water and minerals transported by the stem to make food through photosynthesis.
3. There are clear boundaries between the abstraction layers of complex systems, and there is a clear separation of concerns between the different parts of the abstraction layer.
For example, the parts of a leaf as a whole provide leaf functions (such as photosynthesis), but there is little or no direct interaction between the leaf and the root.
4. These characteristics of abstraction levels of complex systems have cross-domain commonalities.
Multicellular animals, for example, have a hierarchy similar to that of plants, with some cells forming tissues, several tissues cooperating to form organs, a group of organs forming systems (e.g., digestive, respiratory, endocrine, nervous), and so on.
5. The activities of the lower-level parts of a complex system are not directly coordinated by the centralized parts, but often some independent parts operate independently, and each part exhibits quite complex behaviors and contributes to many higher-level functions.
For example, when the parts of a plant function independently and cooperatively, we can see the higher-level function of the plant, where the whole acts more than the sum of its parts.
Five properties of complex systems
From the perspective of complexity science, we find that all complex systems have five common properties.
1. Hierarchy
Complexity usually exists in the form of a hierarchy, and a complex system consists of some related subsystems. These subsystems have their own systems, and so on, down to some lowest level of basic components.
The architecture of a complex system is a function of all its components and the hierarchies between them.
2. Relative origin
Which groups are chosen as the basic components of the system depends largely on the judgment of the system observer. What is fundamental to one observer may have a high level of abstraction to another observer.
For example, to a naturalist the pollen of a flower is a fundamental component, while to a cytologist the pollen is a high level of abstraction on which the different organelles of the cell are the fundamental components of observation.
3. Separate your concerns
Relationships within components are often stronger than relationships between components, allowing us to examine each part in isolation.
4. Common patterns
Hierarchies are usually just a few different types of subsystems in different combinations and arrangements. Complex systems have common patterns that involve the reuse of components.
For example, plant cells have blood vessels, and cells also have blood vessels, and vascular systems exist in animals.
5. Stable intermediate form
Complex systems invariably evolve from simple systems that work. As systems evolve, objects that were once considered complex become foundational objects from which more complex systems can be built.
The inherent complexity of software systems
We do see some software systems that are not complex and can be designed, developed, maintained, and used by one person. These systems may be elegant, but their usefulness and life cycle are often very limited.
Industrial-scale applications, by contrast, tend to exhibit rich behavior in feedback systems driven or emitted by real-world events. For these applications, time and space are scarce resources.
With industrial-grade software, the complexity is so far beyond the reach of human intelligence that it is difficult for a single developer to understand the full design.
Software complexity is an essential feature, not an accident.
The inherent complexity of software systems is reflected in the following four aspects.
1. Complexity of the problem domain
We are trying to solve problems in the software often inevitably involves the complexity, which contains countless competitive requirements, when a higher-priority needs would be a high priority, super high priority demand, even include some opposite requirements, such as on the one hand to increase input, and reduce the cost. This is the inherent complexity of software development.
Complexity outside of software development often stems from communication difficulties between system users and system developers. It is very difficult for users to develop an understandable form to express their needs, or even have some vague ideas, and developers often find it difficult to understand the real intentions of users, which leads to the two sides of the debate. This is neither the developer’s fault nor the user’s fault, and the nature of this phenomenon is often due to different domain knowledge on both sides.
To make matters worse, requirements often change during development.
2. The difficulty of managing the development process
The most basic task of a software development team is to create the illusion of simplicity that insulates users from a great deal of external complexity. The primary challenge for development teams is always to maintain design consistency and integrity.
3. Flexibility is possible anywhere
The construction industry has always had uniform standards and codes for raw materials, but the software industry rarely has such standards. Software provides a great deal of flexibility, which makes it possible for different developers to create various forms of abstraction for the same problem.
4. The problem of describing the behavior of discrete systems
The nature of a discrete system is that it has a finite number of possible states. In a large system, the number of possible states is very large due to combination.
Complex solutions
1. Structural design
Structured design does not consider data abstraction and information hiding, nor does it have adequate means to handle concurrency. Therefore, structured design is only suitable for dealing with simple problems, and for extremely complex systems, structured design is not scalable.
2. Data-driven design
In data-driven design, the mapping between the inputs and outputs of the system drives the structure of the software system.
3. Object-oriented design
The underlying concept of object-oriented analysis is that the designer should model the system as a group of cooperating objects, with individual objects as instances of classes that have hierarchical relationships.