The architecture of the application is something that is difficult to do without even when creating a small project. And the creation of a worthy more or less large representative of the software without it, working without significant problems and with satisfactory performance, is not conceivable at all. What is the architecture of the application? What recommendations should be followed to create a quality product?
Introductory information
When creating software, it is important that it be well organized and work without problems. This is achieved thanks to a well-thought-out architecture. After all, it allows you to save a lot of effort, money and time. Also, it often depends on her whether the application will survive on the market or not. Therefore, it is necessary to carefully study the process of creating architecture, paying attention to the tasks to be solved and the criteria used. The principles of work should be not just obscure dogmas, but one that allows you to work efficiently and create high-quality software.
About the criteria
It should be noted that when someone mentions the expression “application architecture”, it must be understood that there is no universally accepted definition. But if we talk about practice, then most developers will be able to determine where the code is good and where it is unsatisfactory. Why is this possible? In many respects, this situation has arisen due to the fact that a good architecture is first of all such an approach to creating software that makes the development and maintenance process simple and efficient. The application that has been approached wisely is easy to expand and change, test, debug, and easy to understand. Thanks to this, a list of universal reasonable criteria can be formulated.
What to bet on?
When working with architecture, attention should be paid to:
- System efficiency. That is, the design of the application architecture should create such software that can solve the tasks and perform well the functions assigned to it in different conditions. First of all, reliability, performance, security, scalability (the ability to cope with an increase in load) should be mentioned.
- System flexibility. Any, even the most advanced application has to be changed over time. Indeed, existing requirements may change or new ones may be added. The more convenient and faster this process can be completed with fewer errors and problems, the more competitive and flexible the system. Therefore, it is necessary to ensure that the adopted approach does not "cut down in stone" all the actions.
- System extensibility. The ability to add new functions and entities, without violating the basic structure, indicates the soundness of the application. At the initial stage, it makes sense to lay exclusively the basic and necessary functionality. But at the same time, it should be possible to increase the opportunities provided as necessary. And in such a way that a minimal amount of effort is spent on it. This is so important that it is even formulated in the form of the second SOLID principle: software entities are open for extension, closed for modification. That is, the architecture should be such that it was possible to write new code, but did not have to change the existing one.
And what else?
The architecture of a software application is not limited to these three criteria:
- Scalability of development. The architecture should include the ability to ensure parallel development process to increase the number of people who work on the project.
- Testability of the application. Code that is easy to verify contains fewer errors and works more reliably. In addition, this also encourages the formation of a good code design, which also facilitates the subsequent work with it.
- Reusable. The system should be designed so that its individual fragments can be used in other projects.
- Good structure, readability and comprehensibility of the code. As a rule, a large number of people work on programs. Often there is a situation when new ones come or old-timers leave. Application architecture must take this into account. And all the developments should make it possible for relatively new people to quickly and easily understand the system being created. The good structuredness of the project, the absence of duplication, the adequate design and documentation of maintenance (optional, but desirable) helps in this.
And what follows from this?
Despite the presence of a large number of criteria, as a rule, the task of reducing complexity is considered a priority. And for this, they came up with nothing but to divide into parts. For most people, this is known as the divide and conquer principle. But speaking in professional language, then this is the usual hierarchical decomposition. What does this mean in practice? There is one big target system. For example: architecture of corporate software applications. It consists of many simple subsystems. Each of them has its own elements. And so on until small parts that are clear and easy to use are highlighted. What is good is that such a solution is not only the only known, but also universal. In addition to reducing complexity, it also allows you to provide system flexibility, provides scalability, and increases the stability of the final product.
Case Study
To better understand what a similar approach is, it is necessary to consider spherical software. In order not to fall into completely childishness, the client-server application architecture working through the global network was chosen as a tool. Indeed, in this case, it is necessary to consider many subsystems, some services, functional modules, subprograms, layers, as well as organize their interaction, both among themselves and with the outside world. Moreover, the more independent they are, the safer it is to focus on one thing.
Turning spaghetti code into a constructor
The right approach allows you to turn the finished product into a set of modules (subprograms) that interact with each other according to simple and well-defined rules. This allows you to control the complexity of the created application and get all the benefits that the excellent architecture provides:
1. Scalability - allows you to expand the system and improve its performance by adding new modules.
2. Maintainability - changing one part of the program does not require intervention in others.
3. Replaceability - several modules can easily perform the necessary functions.
4. Testability - often programs can be separated and separately checked (repaired).
5. Reuse - a separate module can be used in other programs and environments.
6. Maintainability - the program is easily divided into its constituent parts, which are easy to understand.
What does the process look like?
First of all, it is necessary to simulate the architecture of the application. For this, both special programs and plain paper are used. Initially, it is necessary to identify all the elements, as well as to establish a relationship between them, which will be implemented in the future. The question then becomes how to decompose. Relatively speaking, there are hierarchical, functional, and combined stages. At the same time, it cannot be said that the architecture of the web-based applications of the client-server model should be built according to a specific approach - it all depends on the goals and tasks. In order to get a good result, you need to properly decompose. And here it should already be understood what is considered correct and how best to implement it. To get a good architecture, you need to know how to adequately decompose the system. So, you need to understand which decomposition is considered correct and how it is better to carry it out. Consider what the architecture of this type of server application will look like.
Hierarchical decomposition
Many people make a mistake here by chopping the application into hundreds of classes at once. A more correct approach is to split the system into large modules (packages) that describe its operation in a general way. Then they are analyzed and, if necessary, divided into smaller objects. Before starting work, it is desirable to divide the entire system into separate semantic blocks at least mentally. Often enough to highlight only two levels (packages and classes). Despite its obviousness, this idea is not as banal as it seems at first glance. An example is a common architectural pattern such as Model-View-Controller, also known as MVC. At the first level, you can place the largest components. As an example, the following can be cited: user interface, working with a database, establishing a communication line with a specific object. And then to create classes as needed. But do not be too zealous.
Thus, the architecture of data applications transmitting only information about the state of a particular object should not be unnecessarily complicated by elements of little interest or inappropriate. Example: if a banking application displays third-party ads to its customers, it is unlikely that it will have a successful future.
Functional decomposition
The division into modules is based on the tasks that are pursued by the system. In this case, the main one can, as a rule, be divided into several smaller ones. In this case, it is necessary to ensure that they can be executed / resolved independently of each other. Based on this, it is desirable that the module is responsible for solving a certain part of the task and perform the necessary function for this. In addition, you should take care of the receipt of all the necessary data for the successful functioning. It is advisable to achieve a result in the absence of the help of other modules, only using your input data. What comes up from this? A module is understood not as some arbitrary piece of code, but as a complete program unit, which is functionally meaningful and complete.
Combined decomposition
Here we consider how the modules focus on solving tasks. Here you can highlight a combination of two points:
- High contingency. This parameter indicates that the module is focused on one narrow problem. Conjugation is achieved only in this case. If he performs diverse functions and unrelated responsibilities, then this indicates the presence of significant problems.
- Weak connectedness. This parameter indicates that the individual modules from which the system is built are independent. As an acceptable, but unpleasant alternative - weakly interconnected. But at the same time, they should be able to interact.
If you pay attention to all these points, then the architecture of the application server, client, various links and modules can successfully perform all the functions assigned to them.
Finally
Of course, it is extremely difficult to consider a voluminous topic in a small article. But on the other hand, if you describe everything that is at least of least interest, then even a whole book will not be enough. So, enterprise application architecture is one thing, a product designed for the general public is another. The question is the confidentiality of data, the functions performed and other important points on which the success of using the software and achieving the goals depends.