Important to remember in OOP (Object Oriented Programming). Why You are building an application with objects rather than just functions (procedural programming). Sometimes programmers treat objects like functions which completely defeats the purpose of objects in the first place! The purpose of this post is to explore the real benefit of OOP and how to properly structure your models.
What is a decoupled object?
Contrary to the belief of the novice OOP programmer, an object is much more than a collection of data members and associated methods. It is important to remember that an object embodies data and methods that are only relevant to itself. The term “decoupling” is used to denote the separation of software blocks that should not depend on each other.
Why is it important to separate objects?
We say that we have a the car A class with methods driveForward(), stop(), turn (), honkHorn()And changeLanes(). This item is poorly designed because one of the methods, Change lane(),…