What Is SOLID Programming?


Introduction

Software design is a methodology to create guidelines to develop software using software components and defined objectives. Software design includes all the activities related to the development of the software. These activities involve conceptualising the software to be developed, framing if the software is to be developed, implementing the guidelines based on which software will be developed, commissioning the guidelines based on which software will be developed, and if changes are required modifying the complex system. 

Software design is targeted to solve problems and make guidelines to develop software. Software design includes the design of the algorithm and deciding the architecture of the software. 

Software design is created to solve the intended problems. To create software design, software requirement analysis needs to be conducted. Therefore, software requirement analysis is a part of the software development process.   

The software development process is subdivided into small sequential steps so that effective and efficient software needs to be developed. The software development process can be completely described using the software development lifecycle.

Different methodologies are used to describe the software development process, such as agile, waterfall, prototyping, spiral model, iterative and incremental software development process, rapid process of software development, and extreme process of software development.

Agile is one of the techniques of developing software. Agile software development includes steps to develop software. These steps include a collaboration of teams and end-users. The agile software development process is based on adaptive planning, evolutionary development, quick delivery and continuous improvement. Agile software development advocates the malleable responses to requirement changes, available resources, and understanding the related problems.

Agile software development principles are based on satisfaction of customers by quick delivery of software, motivating customers by welcoming their change in requirements, accommodating changes and delivering the software again, maintaining cooperation between software developers and end-users, maintaining face-to-face communication, developing software at a constant pace, and paying attention to the critical point of software development.

In agile software development, the software development work is broken down into small iterative steps. These iterative steps include planning, analysis and design, coding and testing, and when the software is developed, acceptance testing is done. Finally, each iteration is ended up into a software product that is demonstrated to the end-users.

The iterative risk involved in the software development process is reduced, and changes can be incorporated quickly. As a result, the software product is released after multiple iterations. Thus, the main advantage of the software development process is to make changes quickly in the developing software and handle the risk in the software development process.

The waterfall model develops software into a linear sequential phase. However, the waterfall model of software development involves different sequential steps, and each phase of software development is based on its previous step. As a result, the waterfall model is less iterative and less flexible. The waterfall model largely progresses in one direction and includes the idea conception of software development, initiation, analysis and design of the software development, coding, testing and deployment of the software development process, and appropriate software maintenance.

The waterfall model was purely developed for the manufacturing and construction industries. The waterfall model includes the requirement analysis phase, the design phase, the implementation phase, the verification phase, and the maintenance phase.

In the waterfall model, requirement analysis is done to create the development of the product, analysis is done to find the models, schema, and business rules to develop the software, design of the software is created to develop the architecture of the software, coding of the software is done to develop, prove, and integrate the software. When the software is developed, it is checked to find the errors in the program; thus, developed software undergoes a debugging phase. The developed software is installed when the errors are removed, and support and maintenance are extended.

Another model of software development is software prototyping. In the software prototyping model, software prototypes are developed. The software prototypes provide incomplete functionality of the software. Still, the software prototype reflects all the functionality included in the software delivered to the end-user.

The developed prototype may be different from the final product. However, the prototypes are useful in developing the software as they can get the end-users feedback.  The prototypes are also used to compare the final product to the software prototype used to develop the software. Finally, the prototype is used to estimate the software and to judge whether the Gantt chart can be fulfilled or not.

There are two types of prototypes, namely, horizontal prototypes and vertical prototypes. Horizontal prototypes are developed to reflect user interactions. Horizontal prototypes are also used for user interface visualization. Vertical prototypes are used to obtain the detailed requirements of a given function. A vertical prototype helps in refining database design and working on complex requirements.

There are different types of requirements such as Throwaway prototype, Evolutionary prototype, and Incremental prototype. 

The next model in the domain of software development is Iterative and Incremental Development. In this model, the software is developed by repeatedly executing the development cycle, and the software development cycle phase is small. It is used to take advantage of each phase of software development in the next phase.

The software under development is improved each time the software is developed and used. Thus, the software is continuously improved in each software development phase, and this process continues until a well-defined software is developed.

The Iterative and Incremental software development process includes the initialization step, iteration step, and project control list. The initialization step is used to develop a basic version of the software. The basic version is used to get user feedback. The iterative software development process is controlled by the list dictating the task to be performed. The task list is updated regularly by the analyses phase. Finally, the user feedback decides the iteration. In each iteration, software structure is analyzed, modules of the software are developed, the usability of the software is checked, reliability and efficiency of the software are examined, and it is observed that how much percentage of the objective has been achieved.

The next model in the software development process is a spiral model. The spiral model is a risk-driven model of software development. Each software project has its associated risk a particular software development model is selected.

The spiral is based on six characteristics: defining artefacts concurrently, performing four types of basic activities in every cycle, determining the risk involved in the software development process, and improving the effort level in the software development process. Further, the risk The software development process determines the level of details to be worked on in the desired software development. 

The spiral model also tracks the progress of the development of the software. To track the software development, three-track points are used. These points include – life cycle objective, life cycle architecture, and initial operational capability. 

The next model in the development of software includes Rapid-application development (RAD). This model is oriented towards the adaptive process of software development and less focused on planning. 

The Rapid-application development model is used to develop user interface requirements. To develop the user interface of the software, user interface developers use user interface development tools. The rapid development model also uses an adaptive software development model, agile software development model, spiral software development model, and unified software development model.

The Rapid-application model includes the following phase – Reuiremnet Planning phase, User design phase, construction phase, and Cutover phase. 

SOLID

To improve software design, SOLID was introduced. SOLID is a composition of five design principles used to develop software. With the use of SOLID, the understandability of software designs increases, the flexibility of the software design improves, and the maintainability of the software design is enhanced.

The five principles that SOLID composed of is as follows:

  • Single Responsibility
  • Open-Closed
  • Liskov substitution
  • Interface Segregation
  • Dependency Inversion

The Single-responsibility principle

This principle states that each module in the software must do one functionality. Therefore, each module of the desired software must be responsible for one particular function of the software. Further, each module must be encapsulated. Finally, each module of must is responsible for accomplishing a particular role.

If the module has to be changed that it must have a valid reason. The change in the module must be done if the technical functionalities of the module are changed. If the technical functionalities are not related, then they should not be kept in the same module. 

Coupling two software functionalities in the same module is a bad software design as it creates a problem if the changes are required in the software design.

Creating a class that do only one single task make the class more robust. Separate tasks and creating a class that can do only one task are achieved using the separation of concerns principle. Each class must deal with a single task. A program that follows a principle of separation of concern is known as a modular program. The principle of encapsulation achieves the modularity of the program. With the help of information hiding, related information is combined.

When the modules are separated, they can be easily upgraded, reused, and cause independent development. In addition, separating and hiding modules leads to easy maintenance of the module. 

The modules are separated to achieve abstraction. The Object-Oriented programming language such as C++ and Javaimplementsnt the principle of separation of concern by using objects. Procedural language such as C implements the separation of concern principle by enclosing the functionality into procedure or functions.

Open-closed principle

This principle advocates that all the modules must provide the possibility to extend the functionality and restrain module modification. This principle can be implemented by using a generalization. In programming, generalization is implemented by inheritance or delegate functions. 

A module can be extended either by adding new elements to it or adding new features to it. If this is possible, then the module is said to be open. Conversely, the module is said to be closed if other modules can not use it.

Inheritance is one of the concepts that is used to implement the open-close principle. A class can be open as well as close. An open class allows to be reused and allow the addition of a new feature with the use of inheritance, but at the same time, the class can also be closed as it can be compiled, saved down to a predefined library and can be used if required, but it can not be changed.

The open-close principle can be implemented using the abstract interface. The interface is used to change its functionality, and multiple interfaces can implement polymorphic behaviour.

Liskov substitution principle 

This principle states that its subclass objects can replace superclass objects, and it should not reflect changes in the applications. The objects of the subclass and objects of the superclass must act similarly. 

The subclass method can accept the same parameter values as that of the superclass. In the case of the return value, the method’s return value that belongs to the subclass must be the same as that of the return value of the method of the superclass.

Interface Segregation Principe

This principle states that dependency on the method should not be made if it is not required. In this principle, great interfaces are broken down into small ones, so the useability increases. In addition, the Interface Segregation Principle decouples the developed system, and thus it makes it easier to make changes in the developed system and redeploy the developed system.

Interfaces are used to provide the abstraction to make code easy. In addition, the user interface helps in describing the critical issues of the software. 

Dependency inversion principle       

The dependency inversion principle states that modules in the software must be loosely coupled. This principle states that a dependency relationship exists between a high-level module and a low-level module. According to this principle, the high-level module should not inherit a low-level module. Instead, the high-level module and low-level module should implement interfaces. 

With the help of this principle, interactions are designed. The interaction between the low-level modules and high-level modules must be such that, if required, it may change without influencing the class structure.

The interaction between modules must be designed in such a way that modules are not tightly coupled. For example, in software design, the low-level modules are absorbed by high-level modules. When this architecture is followed, it results in a complex system. The complexity of the system reduces reusability. 

The main objective of the dependency inversion principle is that it reduces the degree of coupling between modules.

The dependency inversion principle is considered a good principle to be used in coding. The coupling between the modules can be reduced if interactions are abstract. According to this principle, the interface must be used in the class. All classes must connect through interfaces, no Inheritance should be done using concrete class, and the implemented method should not be overridden.

Conclusion

SOLID is a design principle to be used in the software development process. This process of software development is Object-Oriented Programming. SOLID stands for single reusability principle, open-closed principle, Liskov substitution principle, interface segregation principle, and dependency inversion principle.       

Robert C. Martin developed these SOLID principles. According to Robert C. Martin, these software design principles will change the software development process. According to t Martin, if good software design peirncpes are not used, it will be rigid, immobile, and viscous. 

The main objective of SOLID principles is to reduce dependencies, and changes in one section of the software must not influence other sections of the software.

SOLID principles make the design easy, more understandable, more maintainable, and developed software will be extended easily.

Using these software design principles, it becomes easier for software developers to avoid software development issues and develop more adaptive, more effective, and better agile software.    

The drawback of SOLID programming is that it may increase the overall size of the software. In addition, many times, SOLID principles become a time-consuming process.