Cohesion, Coupling and Composition

Cohesion Cohesion indicates that the depth of the relation in between to sources or dependencies. This is not related to a practical coding, but a mentality that helps to write a better maintainable code. High Cohesion means clear separation of concerns, low cohesion is the reverse. To provide high cohesion in an application, we shall separate

IS-A and HAS-A Relationships

IS-A Relationship in OOP this sort of relationship refers to inheritance, both class and interface types. In the hierarchy tree, traversing up to determine whether the relation corresponds to IS-A. Assume the situation simply; Class A implements Interface B, then we can say Class A IS-A Interface B, this is to traverse up, and the reverse

Interfaces vs Abstract Classes

1. in interfaces you cannot define a body of a method, whereas it’s optional in abstract classes; public interface Animal{ public void eat(); public String getTypeOfAnimal(final String type); } public abstract class Animal{ abstract void eat(); String getTypeOfAnimal(final String type){ System.out.println("Given type of the animal is: " + type); } } 2.Defined variables in an

Complete and simple definitions of Up Casting, Down Casting, Implicit Casting and Explicit Casting

Nowadays I am preparing for the OCP, I’ve come to the topic of instanceof operator and casting in Java. I had obstacles in understanding the complete differences between Upcasting and Downcasting, so after a brief google search I’ve found very useful resources to apprehend the subject. Especially this post has given me such inspirational insights on the

Pillars of Object Oriented Programming

This is probably the top case that is known in object oriented software development jobs and asked in many of interviews. There are many of descriptions out there on the internet, but somehow i felt the immense need of explaining things in my words. These pillars can be listed like this; 1. Encapsulation, 2. Inheritance, 3.