Tagged articles
Template Method
42 articles · Page 1 of 1

DabaoshiAug 16, 2026 · Backend Development
This article dissects Java’s AbstractQueuedSynchronizer (AQS), explaining its three core components—volatile state, CAS, and a FIFO wait queue—how exclusive and shared modes operate, the step‑by‑step lock acquisition flow, ReentrantLock implementation details, fairness trade‑offs, and the underlying template‑method design pattern.
AQSConcurrencyJava
0 likes · 15 min read

The article explains the Template Method design pattern, showing how to lock a fixed process skeleton in a parent class while delegating variable steps to subclasses, contrasting it with the Strategy pattern and illustrating its use in real‑world frameworks.
Design PatternFinalHook Method
0 likes · 14 min read

The article explains why ad‑hoc third‑party integrations quickly become unmaintainable, identifies four common pain points, and presents a layered architecture using template method, strategy and factory patterns that abstracts common concerns such as retries, logging and signing, dramatically reducing duplicated code and maintenance effort.
JavaStrategy PatternTemplate Method
0 likes · 20 min read

The article explains why the guideline “favor composition over inheritance” is useful but not absolute, illustrates a fixed‑workflow scenario where inheritance simplifies implementation, and provides concrete code examples and decision criteria for choosing between the two approaches.
CompositionInheritanceOOP
0 likes · 7 min read

This article walks through eight essential design patterns—Factory Method, Prototype, Adapter, Decorator, Observer, Strategy, Template Method, and Chain of Responsibility—showing concrete Spring Boot 3.5.0 code examples, explaining the problems each pattern solves, and highlighting their practical advantages for clean, extensible backend development.
AdapterChain of ResponsibilityDecorator
0 likes · 24 min read

The article explains how the Template Method pattern pervades Spring’s core classes—such as JdbcTemplate, AbstractApplicationContext, and various *Template classes—by fixing the overall algorithm flow while delegating the variable steps to subclasses, and contrasts it with the Strategy pattern.
BackendJavaSpring
0 likes · 13 min read


java1234Mar 24, 2026 · Backend Development
This article explains how Spring employs five core design patterns—Factory, Singleton, Proxy, Observer, and Template Method—detailing their roles, code examples, and how they contribute to Spring's modular, extensible architecture.
Factory PatternProxySpring
0 likes · 8 min read

This article walks through ten classic design patterns—Factory, Proxy, Template Method, Strategy, Observer, Chain of Responsibility, Singleton, Builder, Adapter, and Decorator—showing how they are realized in Spring Boot 3.x with concrete e‑commerce, payment, and user‑system examples, and explains their benefits, trade‑offs, and best‑practice usage.
BuilderFactory PatternObserver Pattern
0 likes · 39 min read

This article walks through seven core design patterns—Singleton, Factory, Builder, Strategy, Observer, Proxy, and Template Method—explaining their purpose, providing complete Java implementations, and showing how they are applied in JDK and Spring contexts.
BuilderProxyTemplate Method
0 likes · 21 min read

This article offers a systematic, high‑concurrency‑focused walkthrough of core Java design patterns—including Singleton, Factory, Strategy, Template Method, and Observer—complete with code examples, pros and cons, selection guidelines, and interview‑ready explanations to help candidates impress interviewers and secure offers.
JavaTemplate Methoddesign patterns
0 likes · 36 min read

This article systematically breaks down the eight most common design patterns used inside the Spring framework, explains how the template pattern powers bean lifecycle, compares classic and Spring‑specific implementations, and provides concrete code examples and step‑by‑step walkthroughs to help you ace interview questions.
Bean LifecycleJavaSpring
0 likes · 48 min read

This article explores how to apply core design patterns—Observer, Factory, Proxy, and Template Method—in Java middleware development, illustrating each pattern with practical code snippets and explaining the design rationale for building maintainable, extensible, and flexible services.
Factory PatternObserver PatternTemplate Method
0 likes · 8 min read

This article explains the core concepts of Java’s AbstractQueuedSynchronizer (AQS), its exclusive and shared modes, the template‑method design it uses, and walks through the actual source code showing how ReentrantLock implements both fair and non‑fair locking, complete with diagrams and code snippets for interview preparation.
AQSConcurrencyJava
0 likes · 10 min read

The article examines how a growing e‑commerce login module becomes tangled with duplicated code and scattered logic, then demonstrates a step‑by‑step refactor using strategy‑factory, template method, chain‑of‑responsibility and decorator patterns to achieve clear responsibilities, extensibility, and easier maintenance.
Chain of ResponsibilityDecorator PatternStrategy Pattern
0 likes · 18 min read

This article provides a comprehensive, code‑first guide to the most common design patterns—including Strategy, Simple Factory, Singleton, Proxy, Factory Method, Observer, Template Method and Adapter—explaining their concepts, real‑world use cases, and complete Java implementations with Spring Boot integration.
AdapterJavaProxy
0 likes · 21 min read

This article introduces design patterns, lists the most common patterns such as Strategy, Factory, Singleton, Proxy, Factory Method, Observer, Template Method, and Adapter, and walks through concrete Java code examples, step‑by‑step explanations, and practical scenarios that demonstrate how each pattern solves specific design problems.
AdapterFactory PatternProxy
0 likes · 23 min read

This article demonstrates how to use the Template Method, Factory Method, and Strategy patterns in a Java Spring e‑commerce fulfillment system to clearly separate channel‑specific order handling, improve code maintainability, and enable rapid addition of new order types.
JavaOrder ProcessingStrategy Pattern
0 likes · 6 min read

This article reviews nine widely used design patterns—Singleton, Builder, Factory, Strategy, Template Method, Chain of Responsibility, Proxy, Adapter, and Observer—explaining their concepts, common implementations in open‑source projects such as Spring, Dubbo, MyBatis, and providing concrete code examples and visual diagrams to help readers understand and apply them when reading source code.
AdapterBuilderChain of Responsibility
0 likes · 26 min read

This article demonstrates how to generate website sitemap.xml files in Java by combining four design patterns—Strategy, Factory, Template Method, and Builder—along with the Open/Closed Principle, providing extensible, maintainable code illustrated with enums, configuration classes, and concrete implementations.
Factory PatternJavaOpen/Closed Principle
0 likes · 16 min read

This article walks through a step‑by‑step refactoring of repetitive Java code, illustrating how to extract common methods, use reflection, apply generics with lambda expressions, leverage inheritance and the template method pattern, and finally combine factory, template, and strategy patterns into a clean, reusable solution.
Factory PatternJavaSpringBoot
0 likes · 13 min read

This article explains how Spring applies classic design patterns such as Simple Factory, Factory Method, Singleton, Adapter, Decorator, Proxy, Observer, Strategy, and Template Method, illustrating each pattern with implementation details, core code snippets, and their significance for loose coupling and extensibility in backend development.
AdapterBackendTemplate Method
0 likes · 15 min read

This article describes how a game‑account order system with scattered core code and no design patterns was refactored into a clean three‑layer interface architecture using a strategy‑template approach, detailing the design, implementation, testing, gray‑release strategy, and post‑deployment safeguards.
JavaStrategy PatternTemplate Method
0 likes · 12 min read

The article explains the six SOLID design principles, emphasizes the importance of the Open‑Closed principle, and demonstrates how to achieve extensible database schemas and APIs using type fields, extendable JSON columns, bitmap role encoding, and strategy/template patterns with concrete Java code examples.
Open/Closed PrincipleStrategy PatternTemplate Method
0 likes · 15 min read

The Template Method pattern defines an algorithm’s fixed skeleton in an abstract class while delegating variable steps to subclasses via abstract or hook methods, enabling reusable, maintainable code through a final template method, concrete implementations, and practical examples such as online shopping and JDK’s AbstractList, with benefits of encapsulation and extensibility but potential complexity from inheritance.
Design PatternJavaTemplate Method
0 likes · 10 min read

This article explores common design patterns—including Strategy, Chain of Responsibility, Template Method, Observer, Factory, and Singleton—explaining their real‑world business scenarios, core principles, and providing concrete Java code examples to help developers write more maintainable and extensible software.
Chain of ResponsibilityTemplate Methodfactory
0 likes · 23 min read

This article explains how to handle time‑consuming Excel uploads by using a template‑method design, wrapping the process with an AOP aspect, and executing the actual upload asynchronously in a thread pool, while recording logs and error details for later inspection.
AOPFile UploadJava
0 likes · 10 min read

This article demonstrates step‑by‑step how to improve existing Java code by applying the Strategy, Factory, and Template Method design patterns, reducing duplicated if‑else branches, adhering to the Open‑Closed and Single‑Responsibility principles, and making the logic more extensible and maintainable.
Factory PatternStrategy PatternTemplate Method
0 likes · 11 min read

This article explains how the Austin Java backend project applies several classic design patterns—including Chain of Responsibility, Template Method, Builder, Strategy, Producer‑Consumer, Singleton, and Proxy—detailing their benefits, drawbacks, and specific code locations for each pattern.
BuilderChain of ResponsibilityJava
0 likes · 6 min read

This article provides a comprehensive overview of the design patterns used in Spring, including Simple Factory, Factory Method, Singleton, Adapter, Decorator, Proxy, Observer, Strategy, and Template Method, with explanations of their implementation, principles, and practical code examples.
BeanFactorySpringTemplate Method
0 likes · 13 min read

This article introduces six classic design patterns—Strategy, Chain of Responsibility, Template Method, Observer, Factory, and Singleton—explaining their real‑world business scenarios, core principles, and providing clean Java implementations to help developers write more maintainable and extensible code.
Chain of ResponsibilityFactory PatternJava
0 likes · 25 min read

This article introduces several classic design patterns—Strategy, Chain of Responsibility, Template Method, Observer, Factory, and Singleton—explaining their business scenarios, core definitions, Java implementations, and how to apply them in real-world projects to improve code maintainability and extensibility.
Chain of ResponsibilityJavaTemplate Method
0 likes · 27 min read

This article explains how Spring’s core container uses classic design patterns—Simple Factory via BeanFactory, Factory Method with FactoryBean, Singleton, Adapter, Decorator, Proxy, Observer, Strategy, and Template Method—illustrated with code snippets and diagrams to show their implementation and purpose within the framework.
BeanFactorySpringTemplate Method
0 likes · 15 min read

The Vivo Internet Server Team demonstrates how applying classic design patterns—factory, template method, strategy, and state—alongside finite‑state machines or workflow engines can dramatically improve the scalability, maintainability, and extensibility of a visual marketing automation engine for rapidly changing business scenarios.
Factory PatternStrategy PatternTemplate Method
0 likes · 19 min read

This article explains the Template Method design pattern, illustrating its algorithm skeleton and step customization with Java code examples, and demonstrates real‑world applications in Spring, MyBatis, and other backend frameworks, highlighting advantages, drawbacks, and practical implementation details.
Design PatternJavaMyBatis
0 likes · 12 min read

This article explains the Template Method design pattern, illustrating its structure with Java drink‑making examples, discussing hook methods, and showing real‑world usages in JDK’s Comparable and Spring’s ApplicationContext, while highlighting advantages, drawbacks, and practical scenarios.
Design PatternHook MethodInheritance
0 likes · 16 min read

This article provides a comprehensive overview of the design patterns used in the Spring framework—including Simple Factory, Factory Method, Singleton, Adapter, Decorator, Proxy, Observer, Strategy, and Template Method—explaining their implementation, underlying principles, and practical significance with code examples.
AdapterBeanFactoryDecorator
0 likes · 15 min read

This article explores nine core design patterns implemented in Spring—simple factory, factory method, singleton, adapter, decorator, proxy, observer, strategy, and template method—detailing their implementation mechanisms, underlying principles, code examples, and practical significance for building loosely coupled, extensible Java applications.
AOPJavaSpring
0 likes · 16 min read


JavaEdgeOct 25, 2020 · Backend Development
This article explains why duplicate code harms maintainability, then demonstrates step‑by‑step refactoring techniques—using factory and template method patterns, custom annotations with reflection, and BeanUtils—to consolidate business logic for different cart types and API calls while preserving extensibility.
AnnotationsFactory PatternJava
0 likes · 15 min read

This article explains the Template Method design pattern, illustrating its structure with Java code examples—including an abstract Drinks class, concrete Tea and Coffee subclasses, hook methods, and real‑world usages in JDK sorting and Spring's application context—while highlighting advantages, drawbacks, and typical scenarios.
Design PatternHook MethodJava
0 likes · 12 min read

This article explains the Template Method design pattern, illustrates it with real-world soup recipes, provides JavaScript code simulations for both abstract and concrete classes, compares the processes, and discusses abstract class limitations in JavaScript, offering a clear guide to implementing the pattern.
Code ExampleDesign PatternJavaScript
0 likes · 11 min read

This article describes the business flow, storage schema, template‑method based code framework, workflow integration, Redis‑based lock mechanism, and two major refactoring iterations that improve the permission‑application approval process for the Do platform.
BackendMySQLTemplate Method
0 likes · 11 min read


DevOpsSep 5, 2016 · Backend Development
The article explains how a framework acts as a semi‑finished product that relies on abstract classes, the Open‑Closed principle, reflection, XML or annotation configuration, and conventions to let developers extend functionality while keeping the core immutable.
AnnotationsJavaOpen/Closed Principle
0 likes · 7 min read
