Tagged articles

Strategy Pattern

117 articles · Page 2 of 2
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 PatternsJava
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 PatternsJavaOOP
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 PatternsSoftware ArchitectureStrategy 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 PatternsJavaOOP
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 PatternsJava
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.

AdvertisementFSMState Machine
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 PatternsJavaLambda
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 PatternJava
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 PatternJavaSpring
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.

Backend DevelopmentDesign PatternsJava
0 likes · 3 min read
Mastering the Strategy Pattern in Spring: Real-World Java Examples