Prototype Design Pattern is a creational design pattern which will be used when there is a need to create multiple object with the same class and will be involved in lot of configurations. By using Prototype Design pattern we can clone a existing object with same configurations values, with same property values into a different memory location, that will exclude the costly operations. This will save us both time and resources. When to use? and Why? Creating new objects by cloning other objects. Allows for adding any subclass instance of a known super class at run-time when there are numerous potential classes that you want to only use if needed at run-time. Reduce the need for creating sub classes public interface Shape extends Cloneable { public Shape makeCopy(); } public class Circle implements Shape { public Circle() { ...
Why S.O.L.I.D SOLID principles are design principles that enable us manage most of the software design problems. Objective of SOLID is to make software design more understandable, flexible and maintainable. Why SOLID was promoted Rigidity - Every change affects many other parts Fragility - Things breaks in unrelated places Immobility - Cannot reuse the code outside of its origin context Because of these we ended up with these End up with tight or strong coupling of the code with many other modules. Tight coupling causes time to implement any new requirements, bug fixes and some times creates unknown issues End up with code which is not testable End up with duplication of code End up creating new bugs when changing the code If followed SOLID Achieve reduction in complexity of the code Increase readability, extensible and maintainability Reduce errors and implement re-usability Reduce tight coupling S.O.L.I.D Principles Single Responsibility...