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
This content was released on Oct 17 2023. The official support period is 6-months
from this date.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.