Posts

Design patterns - Gang of Four (GOF) - Creational design patterns

We can categorize the GOF patterns as follows:  • Creative: Helpful in creating objects  • Structural: Helpful in dealing with the composition of objects  • Behavioral: Helpful in defining the interactions between objects and distributing responsibility Creational design patterns Abstract factory: This pattern is used to create objects

Software Development Design principles - Keep it simple, stupid (KISS)

 With KISS , a system should be designed as simply as possible, avoiding complicated designs, algorithms, new untried technologies, and so on. You should focus on leveraging the right OOP concepts and reusing proven patterns and principles. Include new or non-simple things only if it is necessary and adds value to the implementation.  When you keep it simple, you will be able to do the following better: • Avoid mistakes while designing/developing  • Keep the train running (there is always a team whose job is to maintain the system, although they are not the team that developed the system in the first place)  • Read and understand your system and code (your system and code need to be understandable to people new to it or people using it far in the future)  • Do better and less error-prone change management

Software Development Design principles - Don't repeat yourself (DRY)

Image
 With DRY , a system should be designed in such a way that the implementation of a feature or a pattern should not be repeated in multiple places. This would result in maintenance overhead as a change in requirements would result in modification being needed at multiple places. If you fail to make a necessary update in one place by mistake, the behavior of the system will become inconsistent. Rather, the feature should be wrapped into a package and should be reused in all places. In the case of a database, you should look at using data normalization to reduce redundancy This strategy helps in reducing redundancy and promoting reuse. This principle helps an organization's culture as well, encouraging more collaboration.

Software Development Design principles - SOLID

Image
 1.  Single responsibility principle (SRP) : An entity or software module should only have a single responsibility. You should avoid granting one entity multiple responsibilities. 2.  Open-closed principle (OCP) : Entities should be designed in such a way that they are open for extension but closed for modification. This means regression testing of existing behaviors can be avoided; only extensions need to be tested. 3. Liskov substitution principle (LSP) : Parent or base class instances should be replaceable with instances of their derived classes or subtypes without altering the sanity of the program. 4. Interface segregation principle (ISP) : Instead of one common large interface, you should plan multiple, scenario-specific interfaces for better decoupling and change management. 5. Dependency inversion principle (DIP) : You should avoid having any direct dependency on concrete implementations. High-level modules and low-level modules should not depend on each other direct