In information systems, as the amount of functionality increases, the difficulty of adding new functionality often increases. The system becomes difficult to develop, and the cost of maintaining the system begins to exceed the cost of introducing new functionality. This type of situation is most often a very bad warning sign of trouble.
The client's system showed signs of erosion early on - the platform's limits began to be exceeded with increasing frequency. This was due to improper execution of functionality and led to data corruption. The goal of the project was to achieve wide-ranging scalability, which would allow stable operation with a simultaneous load of several thousand users and an influx of up to tens to hundreds of thousands of records per day. Of course, all this while maintaining uninterrupted system operation and a high level of extensibility.
High requirements forced a wide range of changes to the system architecture. One way to increase productivity is to introduce a refactoring phase into the scope of the project - an iterative modification of the code that does not result in functional changes. The goal of the refactoring process is to improve the system's quality attributes, such as maintainability, extensibility, performance, scalability, observability and flexibility.
The project prepared a plan prioritizing those tasks that required the least amount of work while producing the best results. In each sprint, 10 to 30% of technical tasks were introduced in such a way that they did not interfere with the implementation of new business requirements.
To meet the company's needs, it was decided to build a module to help optimize the execution of functionality and reduce the number of database operations. A module was introduced to mimic the operation of Messaging Queues based on Salesforce Platform Events, and mechanisms were introduced to log errors and track the number and speed of asynchronous calls, the status of system queues, platform limits and the status of major automated processes in the system.
The refactoring process over time has greatly facilitated the maintenance and development of the system, and has significantly eliminated bugs and made it more difficult to create new ones. The implementation of the project made it possible to:
- Increased speed and performance - functionality optimization made easier, reduced cyclic dependencies in logic, moved most functionality to code
- Improved scalability - it has been made possible to queue tasks and process them in case of errors, a call mechanism has been used, allowing the selection of the appropriate strategy depending on the context of the call,
- better observability - mechanisms have been introduced for logging errors and tracking the number and speed of calls, platform limits and the status of major processes in the system; generated reports show what is currently happening in the system from the technical side,
- Increased extensibility and flexibility - most of the code has been broken down into smaller classes, while taking care to maintain appropriate dependencies; any functionality can be deactivated from the administrator level,
- ease of maintenance - a well-tested and stable tool has been built on which the business logic is based.
Technologies and tools used
Salesforce, Sales Cloud, Service Cloud, Community Cloud, Marketing Cloud, AWS, Apex, Lightning Web Components.