Recently we started a new project with measure and math that have different behavior for a same output. The requirements is to have at runtime the measures and calculated data in SI (International System) and IP (Imperial/Pounds) and need to use two different standards and a customs for same conditions.
Ok, this is the place where take place the concept must used in OOP, the “Inheritance”, to create an “Asbtraction Layer” that separate the application from the specific Programming.
In the picture below the first class don’t have any formula or code inside and data inside. Only shared data with the application is accessed by Class Accessor.
It becomes convenient to use the abstraction approach, when we therefore have common data that needs to be transformed differently.
Each method under the child class is a single formula and only calculation method is overriden from the parent class. Each Method dont have terminal for data access.
Each class have own data, that is accessed by accessor vi inside the class.
The aim of this article is to promote the advantages to use OOP in our application, for more detail about Abstraction and Inheritance you can follow the link below.