Conclusion

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

In the last demo, you refactored ContactCard to have a configuration that defines which contacts are relevant to each other.

In this lesson, you got an introduction to the SOLID principles. Specifically, you learned:

  • Side effects from a method refer to changes in your system’s stored values or state, which the method makes but are not directly tied to generating the output. Some examples include saving a log entry or updating the UI when you change a saved property. Side effects aren’t necessarily a bad thing, but if you have too many side effects and start losing track of them, your system will do things you don’t expect — and bugs will appear.

  • SOLID is a group of five principles that help you design and build software in a more organized way, allowing you to easily receive updates and new features without adding complexity.

  • The Single Responsibility principle states that each type should have a focus on one area. This means your system may end up with many types, but they’ll all be easy to maintain.

  • The Open-Closed principle defines that a system should be open for extension but closed for modification. When you need to add more features to a system while leaving the existing one intact, you shouldn’t be forced to modify existing files to add new features. Instead, you should be able to create new child types to provide the new functionality and include them in your system with only minor changes to existing code.

In the next lesson, you’ll learn about the other three SOLID principles: Liskov Substitution, Interface Segregation and Dependency Inversion.

See forum comments
Download course materials from Github
Previous: Demo 2 Next: Quiz:Single Responsibility & Open-Closed Principles