In this article, I will discuss the major concerns in designing the software architecture that I learnt in my previous projects;
Separation of Concerns
It is about how to separate your system in several sub-systems.
Case Study: one of my project is making an online game client; We separated the client architecture into several modules such as render, animation, patch update, network, battle system;
Why’s important: After separating the system inside many modules, we can focus the core problems belong to the module; As we can easy to upgrade or test them without affect other parts of the software;
Note: When separating the system, we need to apply several principles like Single Responsibility (SRP), Least Knowledge ( Law of Demeter – LoD), so that the modules can be easily upgraded or changed in the future;
Ease of implementing the Business Logic
It is about how easy or simple to add / change the business logic in your system.
Case Study: I developed several online RPG games before; We had a challenge in those games, which is the system keep evolving, such as release new skills and revise some unbalance old skill; So we develop the architecture to accommodate those changing requirements;
For example, we separate the Skill system into two major part of logic, animation and data logic; When adding a skill system, the artist need to make corresponding animation and effect files, and game designer and programmer implements the logic about the skill (e.g how many damage deal to the target monster);
Why’s important: Business Logics are usually the main tasks of the developers after the system architecture are ready and deployed; Users doesn’t care how much changes in the foundation logic (e.g network protocols, database strategies, ) in your system, but they will experience the features they are using and they want; Thus, it is key to make the business logic easy and fast to implement;
Cross Cutting Concern
It’s about the common functions that should apply to most parts of your system such as authentication, logging, exception management, …
Case Study: There are the cross cutting concern things in the social networking I am developing now:
- Send Push notification for different user actions, such as users share a post;
- Login Authentication: Need to check if the user have right to do the requested actions;
- Turning HTTP request to internal Request objects;
Why’s important: It is like electric socket, water pipe, wireless hotspot in a house; The cross cutting faculties help us handling the complex logic that not related those business logic in your code; Thus, your logic become easy to understand and more important it is more clear.
It’s about how easy is your system do the testing such as unit test or continuous integration (CI).
Case Study: In my Android application, I have developed a testing framework called “SimpleTDD”, I use it to test the components or methods that being used in my social networking app. For example, the Login and Register methods, or the UI component showing a post;
Why’s important: Without the unit test, we may take several steps to trigger the code you want to test, and this cause poor efficient or resist to test thing well; With a good testing framework and technique, we make the code run correctly and work well in different possible cases;
It’s about how much information your system can tell you when there are errors or some special event happened, so that you have enough information to fix those problems.
Case Study: In my online game project, we received some bugs come from our users; At that time we didn’t what happened to users and not clue about how to fix it; Then we reviewed our code and found that there were many places we just “return” without logging where and what was happened; Thus, we added back the error log, reviewed the log and the problem was discovered and fixed it very soon;
Why’s important: Without information or log, we cannot know what’s happening to our software; Remember the famous “general protection faults”, we just know something wrong happened, but cannot do anything because we doesn’t have information to fix it; So a good logging or tracking facilities are important in our software architecture;
Scalability and Availability
It is about how stable is your system under different scenarios (e.g lack of memory) or when the loading is very high (many users are using it);
Case Study: Once I developed an online news system and the system had very high traffic in the morning period; In the developing environment, the system was running smoothly; However, it became very slow when was running in the production and in the morning; This is because too many concurrent users access the database and make very long connecting time; We solved the problem by adding a data caching layer to the architecture;
Why’s important: Stability and responsiveness are two major factors that your users will think when choosing your product; However, poor scalability and availability will degrade these two factors; So when design the architecture, we need think about how to make app scale up or how to prevent it responding slowly;