Greetings! Template Method pattern is a behavioral pattern. We put our businesss logic in abstract in a super class and let the sub classes override specific steps without changing the original structure. Source code for this post can be found in my github account. [ source-code ] When we have a common steps to do something but some steps vary, we can do it using bunch of if else statements. But the problem is things are tightly coupled and when new things need to be added we have to change our class. This leads our class difficult to main. For these kind of problems Template Method can be used. Definition of Gof; "Defines the skeleton of an algorithm in a method, deferring some steps to sub-classes. Template Method lets sub-classes redefine certain steps of an algorithm without changing the algorithm's structure." "Don't call us, we'll call you. - allow low-level components to hook themselves into a system, but the high-level components dete...
May all beings be happy, be well, be peaceful, and be free