-
Continue reading →: Abstraction
Abstraction is the ability to work with the concept/idea while safely ignoring some of its details. Rather, handle different details at different levels. Take an example of a simple fan regulator. As a consumer of it, I can focus only on regulating the speed. Here, changing the speed via the…
-
Continue reading →: Method cohesion
The Method exhibits high cohesion when a method performs one and only one operation and do what their names say they do. If they do anything else, they are less cohesive and poorly named. Examples of highly cohesive methods: GetProductName() PrintBarcode() ToLower() CalculateAge() CreateUser().
-
Continue reading →: Cohesion – the action or fact of forming a united whole.
Cohesion in the object-oriented programming tells you whether the members (states and behavior) of the class works towards a common goal or fulfills the central purpose of the class. See the class shown below. Now, look at the methods in the Program class. They are clearly doing the unrelated job. I…
