Tagged articles

Open-Closed Principle

24 articles · Page 1 of 1
samdeepthink
samdeepthink
Aug 30, 2026 · Fundamentals

Understanding the Open‑Closed Principle Through Spring’s Extension Hooks

The article explains the Open‑Closed Principle, shows how Spring leaves empty hook methods like onRefresh() for extensions, demonstrates the concept with a Java demo, compares inheritance‑based and interface‑based extension approaches, and discusses trade‑offs and practical guidelines for designing extension points.

Design PatternsExtension HooksJava
0 likes · 10 min read
Understanding the Open‑Closed Principle Through Spring’s Extension Hooks
Dabaoshi
Dabaoshi
Aug 8, 2026 · Fundamentals

Strategy Pattern: Replacing Conditional Branches with Pluggable Algorithms

The article explains how the Strategy design pattern solves the maintenance nightmare of tangled if‑else or switch statements by extracting each algorithm into its own strategy class, detailing the roles, selection mechanisms, Java examples, and when the pattern is appropriate.

ComparatorDependency InjectionDesign Patterns
0 likes · 14 min read
Strategy Pattern: Replacing Conditional Branches with Pluggable Algorithms
Dabaoshi
Dabaoshi
Aug 5, 2026 · Fundamentals

Abstract Factory Pattern: Building Whole Product Families, Not Just Single Products

The article explains the Abstract Factory pattern by contrasting product families with product hierarchies, showing why the Factory Method fails for bundled products, presenting the pattern's structure and code, and detailing its open‑closed principle tilt and appropriate usage scenarios.

Abstract FactoryDesign PatternsJava
0 likes · 17 min read
Abstract Factory Pattern: Building Whole Product Families, Not Just Single Products
LuTiao Programming
LuTiao Programming
Mar 24, 2026 · Backend Development

10 Years In, I Discovered Spring Boot + Decorator Pattern for Elegant Extension

After years of piling logging, caching, and security directly into Spring Boot services, the author shows how applying the Decorator pattern—implemented via dedicated @Service beans and @Primary/@Qualifier wiring—creates a clean, extensible chain that respects the Open/Closed Principle, while outlining practical steps, trade‑offs, and pitfalls.

Decorator PatternJavaOpen-Closed Principle
0 likes · 10 min read
10 Years In, I Discovered Spring Boot + Decorator Pattern for Elegant Extension
Ray's Galactic Tech
Ray's Galactic Tech
Oct 19, 2025 · Backend Development

How @Configuration Embodies the Open/Closed Principle in Spring Boot

Spring Boot’s @Configuration annotation serves as a practical implementation of the Open/Closed Principle by providing declarative, type‑safe bean definitions, enabling closed‑for‑modification business logic while remaining open for extension through modular configuration, conditional beans, and auto‑configuration mechanisms.

Auto-configurationConfigurationDependency Injection
0 likes · 7 min read
How @Configuration Embodies the Open/Closed Principle in Spring Boot
JavaScript
JavaScript
Aug 25, 2025 · Frontend Development

Switch Statements Break the Open/Closed Principle – Use Objects or Maps Instead

The article explains why traditional switch statements violate the Open/Closed principle in JavaScript, outlines the maintenance problems they cause in large front‑end codebases, and demonstrates how object literals or Map structures provide cleaner, more extensible alternatives.

Code MaintainabilityOpen-Closed Principlemap
0 likes · 5 min read
Switch Statements Break the Open/Closed Principle – Use Objects or Maps Instead
MoonWebTeam
MoonWebTeam
Jul 24, 2025 · Fundamentals

Mastering the Open-Closed Principle: Benefits, Pitfalls, and Real-World Examples

This article explores the Open‑Closed Principle (OCP) in depth, covering its definition, evolution, practical applications, common misconceptions, code comparisons, and best‑practice guidelines to help developers balance extensibility with simplicity in modern software design.

Open-Closed PrincipleSOLIDTypeScript
0 likes · 19 min read
Mastering the Open-Closed Principle: Benefits, Pitfalls, and Real-World Examples
KooFE Frontend Team
KooFE Frontend Team
Feb 5, 2025 · Frontend Development

Making React Components Open‑Closed: Extensible Patterns and Refactoring

This article explains how the Open‑Closed Principle applies to React development, demonstrating anti‑patterns and refactoring techniques—including base components, composition, higher‑order components, and custom hooks—to create extensible, maintainable UI elements while keeping tests simple.

CompositionCustom HooksHigher-Order Components
0 likes · 7 min read
Making React Components Open‑Closed: Extensible Patterns and Refactoring
php Courses
php Courses
Aug 9, 2024 · Backend Development

Applying the Strategy Design Pattern with the Open/Closed Principle in Laravel

This article explains how to apply the Strategy design pattern together with the Open‑Closed Principle in Laravel, showing step‑by‑step code examples for defining a strategy interface, implementing concrete payment strategies, and creating a context class that dynamically selects the appropriate payment gateway while keeping the system extensible and maintainable.

Design PatternsLaravelOpen-Closed Principle
0 likes · 12 min read
Applying the Strategy Design Pattern with the Open/Closed Principle in Laravel
Ubiquitous Tech
Ubiquitous Tech
Nov 10, 2023 · Backend Development

Java: Elegant Sitemap Generation Using 4 Design Patterns and the Open/Closed Principle

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.

Design PatternsFactory PatternJava
0 likes · 16 min read
Java: Elegant Sitemap Generation Using 4 Design Patterns and the Open/Closed Principle
JD Tech
JD Tech
Jul 14, 2023 · Fundamentals

Exploring the Open‑Closed Principle in Software Architecture to Reduce Cognitive Load and Improve Efficiency

The article examines how applying the open‑closed principle and domain‑driven design in software architecture can lower programmers' cognitive load, streamline development, and enable cost‑effective, scalable evolution of complex systems, especially in fast‑iteration internet services.

DDDOpen-Closed PrincipleSoftware Engineering
0 likes · 16 min read
Exploring the Open‑Closed Principle in Software Architecture to Reduce Cognitive Load and Improve Efficiency
Code Ape Tech Column
Code Ape Tech Column
Apr 6, 2023 · Backend Development

Applying the Open‑Closed Principle and Bitmask Design for Extensible System Architecture

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.

Design PatternsOpen-Closed PrincipleStrategy Pattern
0 likes · 15 min read
Applying the Open‑Closed Principle and Bitmask Design for Extensible System Architecture
21CTO
21CTO
Jan 3, 2022 · Frontend Development

Unlock Front-End Power with Open-Closed, Functional Programming, and Messaging

This article explores how core software engineering concepts—Open‑Closed Principle, functional programming, and message mechanisms—are applied in modern front‑end development, illustrating each with real‑world frameworks like React, Ant Design, and Redux, and providing code examples to deepen understanding.

Open-Closed Principlefunctional programmingmessage-passing
0 likes · 18 min read
Unlock Front-End Power with Open-Closed, Functional Programming, and Messaging
21CTO
21CTO
Aug 19, 2020 · Backend Development

Eliminate If‑Else Chains with Enum‑Based Strategy in Java

This article demonstrates how to replace cumbersome if‑else statements with a clean enum‑driven design in Java, using an abstract rule class, concrete channel implementations, and an enhanced enumeration that binds each channel to its processing logic, adhering to the open‑closed principle.

Design PatternEnumJava
0 likes · 5 min read
Eliminate If‑Else Chains with Enum‑Based Strategy in Java
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 PatternsJavaOOP
0 likes · 26 min read
Understanding the Strategy Pattern with Java Examples
macrozheng
macrozheng
Jun 5, 2020 · Fundamentals

Why Interface‑Oriented Programming Makes Your Code Flexible and Extensible

This article explains the concept of interface‑oriented programming, using everyday analogies and Java code examples to show how defining contracts via interfaces decouples components, improves extensibility, and follows solid design principles such as the Open‑Closed Principle.

Open-Closed Principledependency inversioninterface programming
0 likes · 11 min read
Why Interface‑Oriented Programming Makes Your Code Flexible and Extensible
Hujiang Technology
Hujiang Technology
Oct 26, 2017 · Frontend Development

Design Patterns in Front-End JavaScript Development

This article explains how to apply common design patterns such as Singleton and Observer in front‑end JavaScript, demonstrating practical extensions using Function.prototype, discussing the Open‑Closed Principle, and providing code examples for flexible, maintainable code without invasive modifications.

Design PatternsJavaScriptOpen-Closed Principle
0 likes · 10 min read
Design Patterns in Front-End JavaScript Development
Architects Research Society
Architects Research Society
Nov 6, 2016 · Fundamentals

Applying Conway’s Law to Improve Architecture and Team Productivity: Lessons from Credera at SpringOne

At SpringOne, Credera engineers Jason Goth, Micah Blalock, and Patricia Anderson explained how they leveraged Conway’s Law to redesign a client’s technical architecture and processes, overcoming productivity decline by restructuring teams, applying the open/closed principle, and introducing new communication roles, ultimately accelerating high‑quality code delivery.

AgileConway's lawOpen-Closed Principle
0 likes · 6 min read
Applying Conway’s Law to Improve Architecture and Team Productivity: Lessons from Credera at SpringOne