OOPs concepts - manishKapasiya/Object-Oriented-Design-and-design-Principles GitHub Wiki

App vs Infra/Framework/Platform developers

App developers are the ones which uses some Infra/Framework/Platform like AWS, Spring, Java to develop application, whereas Infra/Framework/Platform developers are the ones which develop these Infra/Framework/Platform. The later developers implement most of the Design patterns we discuss, whereas the App developer just use these Infra/Platform/Framework.

L.L.D vs H.L.D

For a simple non distributed system HLD can be just logical layering and interaction between them and LLD can be actual class and method structures in those layers.

Layered Architecture

Separation of concerns, each layer is independent. We prefer coding against Interface in-between layers.

Inheritance, Encapsulation, Polymorphism, Overloading, Overriding, Abstraction

Inheritance: code resuability Encapsulation : Data hiding Polymorphism : Compile-time polymorphism Overloading and Run-time polymorphism Overriding

Abstract classes and Interfaces

Abstract classes : contains common functionality implementation and allow the extending classes to inherit it. Interface : is a contract which just declares the functionality and the implementing classes are responsible to provide the implementation. But as of Java 8 we can have default or static methods in Interface. This functionality is added to provide the backward compatibility so that old interfaces can be used to leverage the lambda expression capability of Java 8. For example 'List' or 'Collection' interfaces do not have 'forEach' method declaration. Thus adding such method will simply break the Collection framework implementations. Java 8 introduces default methods so that List/Collection can have a default implementation of forEach method, and the class implementing these interfaces need not implement the same.

Why we should not remove Abstract classes now?

Because the purpose of both is different. above question explains it.

Enum

Enums should be used instead of String if we know that the value of something is fixed to avoid any possible bugs in the code.