Tagged articles

Strategy Pattern

129 articles · Page 2 of 2
Su San Talks Tech
Su San Talks Tech
Nov 6, 2021 · Fundamentals

Unlock Cleaner Code: Master 6 Essential Design Patterns for Java Projects

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 ResponsibilityDesign PatternsFactory Pattern
0 likes · 25 min read
Unlock Cleaner Code: Master 6 Essential Design Patterns for Java Projects
Selected Java Interview Questions
Selected Java Interview Questions
Oct 25, 2021 · Fundamentals

Understanding Factory and Strategy Design Patterns in Java

This article explains the differences and similarities between the Factory and Strategy design patterns in Java, provides concrete code examples for each, and discusses how the Strategy pattern can offer more flexible behavior composition compared to the traditional Factory approach.

Design PatternsFactory PatternStrategy Pattern
0 likes · 7 min read
Understanding Factory and Strategy Design Patterns in Java
ByteFE
ByteFE
Oct 14, 2021 · Fundamentals

Strategy Design Pattern: A Comprehensive Guide

This article explains the Strategy Design Pattern, a behavioral design pattern that enables defining a family of algorithms, encapsulating each one, and making them interchangeable to improve code maintainability and flexibility in software development.

Code RefactoringForm ValidationObject-Oriented Design
0 likes · 7 min read
Strategy Design Pattern: A Comprehensive Guide
vivo Internet Technology
vivo Internet Technology
Oct 8, 2021 · Fundamentals

Applying Design Patterns to Improve Extensibility in Vivo Marketing Automation Engine

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 PatternMarketing AutomationStrategy Pattern
0 likes · 19 min read
Applying Design Patterns to Improve Extensibility in Vivo Marketing Automation Engine
Taobao Frontend Technology
Taobao Frontend Technology
Sep 10, 2021 · Frontend Development

Mastering Multi‑Platform Front‑End with the Strategy Pattern

This article walks through a real‑world multi‑app scenario, breaks down the core challenges, compares several implementation approaches—including naive if‑else, SDK abstraction, and the Strategy design pattern—and reflects on engineering trade‑offs to help front‑end engineers write cleaner, more maintainable code.

Code OrganizationDesign PatternsFrontend Architecture
0 likes · 11 min read
Mastering Multi‑Platform Front‑End with the Strategy Pattern
Java Backend Technology
Java Backend Technology
Aug 19, 2021 · Backend Development

Eliminate if‑else with Annotation‑Driven Strategy Pattern in Spring Boot

This article explains how to replace bulky if‑else statements with a clean, annotation‑based Strategy pattern in a Spring Boot application, covering interface definition, custom annotations, dynamic proxy handling, map injection, and the crucial hashCode/equals overrides for reliable handler lookup.

Design PatternsSpringStrategy Pattern
0 likes · 14 min read
Eliminate if‑else with Annotation‑Driven Strategy Pattern in Spring Boot
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Apr 29, 2021 · Fundamentals

Understanding the Strategy Design Pattern in Java

This article introduces the Strategy design pattern, explains its definition, class diagram, Java implementation examples, advantages and disadvantages, and demonstrates its use in JDK components such as Comparator and ThreadPoolExecutor, helping developers replace complex if‑else logic with interchangeable algorithm objects.

Design PatternsStrategy Patternjava
0 likes · 10 min read
Understanding the Strategy Design Pattern in Java
ELab Team
ELab Team
Apr 7, 2021 · Backend Development

How to Build a Minimal Node.js Server and Master Koa’s Middleware Architecture

This article walks through creating a simple native Node.js HTTP server, applying the Strategy pattern to decouple routes, enforcing the DRY principle with Promises, and then dives deep into Koa’s core source—including its constructor, use, listen, compose, and router modules—to reveal how the framework orchestrates middleware and request handling.

HTTP serverJavaScriptKoa
0 likes · 21 min read
How to Build a Minimal Node.js Server and Master Koa’s Middleware Architecture
Programmer DD
Programmer DD
Mar 19, 2021 · Backend Development

Simplify Multi-Payment Integration in Java with the Strategy Pattern

This article explains how to replace cumbersome if/else payment handling code with a clean Strategy pattern implementation in Java, showing both the problem scenario and a complete example including enums, interfaces, and concrete payment classes for Alipay and WeChat Pay.

Design PatternsPayment IntegrationStrategy Pattern
0 likes · 7 min read
Simplify Multi-Payment Integration in Java with the Strategy Pattern
Huawei Cloud Developer Alliance
Huawei Cloud Developer Alliance
Feb 25, 2021 · Backend Development

Turn Messy if‑else Statements into Clean, Maintainable Java Code

This article demonstrates how to replace traditional if‑else structures with guard clauses, Java Optional, and various strategy pattern implementations—including polymorphic classes, static maps, Spring‑managed beans, enums, and functional lambdas—to produce clearer, more maintainable code.

OptionalStrategy Patternif-else refactoring
0 likes · 6 min read
Turn Messy if‑else Statements into Clean, Maintainable Java Code
Top Architect
Top Architect
Jan 13, 2021 · Backend Development

Eliminating if‑else Branches with Strategy Pattern, Map, and Chain of Responsibility in Java

This article demonstrates how to replace cumbersome if‑else or switch statements in Java backend receipt processing by applying the Strategy pattern with a Map dictionary, a simple factory, and the Chain of Responsibility pattern, while also showing reflective class loading for extensibility.

Chain of ResponsibilityDesign PatternsStrategy Pattern
0 likes · 13 min read
Eliminating if‑else Branches with Strategy Pattern, Map, and Chain of Responsibility in Java
JavaEdge
JavaEdge
Nov 4, 2020 · Fundamentals

Mastering the Strategy Pattern: When and How to Replace Complex if/else

This article explains the Strategy (Policy) pattern, detailing its definition, class diagram, typical use cases, advantages and drawbacks, compares it with Factory and State patterns, and provides a practical Java implementation with sample code and analysis of related JDK components.

Design PatternsOOPStrategy Pattern
0 likes · 6 min read
Mastering the Strategy Pattern: When and How to Replace Complex if/else
Programmer DD
Programmer DD
Aug 15, 2020 · Fundamentals

Mastering the Strategy Pattern in Java: Real‑World Pricing and Payment Examples

This article explains the Strategy pattern with Java, showing how to refactor a naïve pricing module into a flexible, open‑closed design, and then extends the concept to payment processing and thread‑pool rejection handling, complete with code samples and UML diagrams.

Design PatternsOpen-Closed PrincipleStrategy Pattern
0 likes · 28 min read
Mastering the Strategy Pattern in Java: Real‑World Pricing and Payment Examples
Java Captain
Java Captain
Aug 10, 2020 · Fundamentals

Understanding the Strategy Pattern with Java Examples

This article explains the Strategy design pattern, demonstrates its use through a quote‑management example and various Java implementations, discusses the open‑closed principle, shows how to apply the pattern to different scenarios such as payment processing and thread‑pool rejection handling, and outlines its advantages and drawbacks.

Design PatternsOOPOpen-Closed Principle
0 likes · 26 min read
Understanding the Strategy Pattern with Java Examples
Xianyu Technology
Xianyu Technology
Jul 14, 2020 · Backend Development

Applying the Responsibility Tree Pattern for Versioned API Refactoring

To refactor a versioned API plagued by nested guards, the article proposes the Responsibility Tree pattern—a hybrid of Chain of Responsibility and Strategy—that routes requests through hierarchical handlers based on parameters, yielding cleaner code, easier debugging, and scalable extension for future versions.

Chain of ResponsibilityDesign PatternsStrategy Pattern
0 likes · 12 min read
Applying the Responsibility Tree Pattern for Versioned API Refactoring
Meituan Technology Team
Meituan Technology Team
Mar 19, 2020 · Backend Development

Applying Design Patterns and Domain‑Driven Design in Meituan Takeaway Marketing System

The Meituan Takeaway Marketing team shows how combining domain‑driven design with classic patterns such as Factory Method, Strategy, State and Responsibility Chain creates an extensible, maintainable reward system that adapts to rapidly changing business rules while keeping the domain model clean and SOLID‑compliant.

Design PatternsDomain-Driven DesignFactory Method
0 likes · 25 min read
Applying Design Patterns and Domain‑Driven Design in Meituan Takeaway Marketing System
58 Tech
58 Tech
Feb 14, 2020 · Backend Development

Finite State Machine Based Advertisement Status Management in the LEGO Advertising Platform

This article systematically introduces a finite state machine (FSM) based solution for managing advertisement status in the LEGO advertising platform, detailing the background challenges, problem review, two design alternatives (strategy‑factory pattern and configuration‑driven approach), their advantages, disadvantages, and a final recommendation.

AdvertisementFSMStrategy Pattern
0 likes · 11 min read
Finite State Machine Based Advertisement Status Management in the LEGO Advertising Platform
Programmer DD
Programmer DD
Jan 11, 2020 · Fundamentals

Mastering the Strategy Pattern: When and How to Use It in Java

This article explains the Strategy design pattern, its definition, roles, UML diagram, Java code examples, real‑world applications such as payment integration and compression, and provides guidance on when to use it, its advantages, drawbacks, and how to simplify it with Java 8 lambdas.

Design PatternsLambdaStrategy Pattern
0 likes · 16 min read
Mastering the Strategy Pattern: When and How to Use It in Java
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Oct 30, 2019 · Backend Development

Eliminating Complex if‑else Logic with Strategy and Factory Patterns in a Spring‑Based Java Application

This article explains how excessive if‑else statements in business code hurt readability and maintainability, and demonstrates how to replace them with the Strategy and Factory design patterns integrated with Spring, using a food‑delivery discount example and complete Java code snippets.

Design PatternsFactory PatternSpring
0 likes · 12 min read
Eliminating Complex if‑else Logic with Strategy and Factory Patterns in a Spring‑Based Java Application
macrozheng
macrozheng
Oct 29, 2019 · Backend Development

Eliminate Complex if‑else with Strategy & Factory Patterns in Spring

This article explains how to replace tangled if‑else logic in business code with the Strategy and Factory design patterns, integrates them into a Spring application, and demonstrates the resulting improvements in readability, maintainability, and extensibility for discount calculations.

Factory PatternSpringStrategy Pattern
0 likes · 13 min read
Eliminate Complex if‑else with Strategy & Factory Patterns in Spring
Programmer DD
Programmer DD
May 28, 2019 · Backend Development

Mastering the Strategy Pattern in Spring: Real-World Java Examples

This article explains how to apply the Strategy pattern within a Spring project, covering background, learning objectives, step‑by‑step code examples for query services A, B, and C, the three‑part invocation process, and both list‑based and map‑based configurations.

Design PatternsSpringStrategy Pattern
0 likes · 3 min read
Mastering the Strategy Pattern in Spring: Real-World Java Examples