Skip to content

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

Dabaoshi

Author

Dabaoshi

Follow or choose interest

Practical utilities

50 public articles

307 article views

Interactions are cumulative records on this author's public articles, not unique people or profile visits.

Works

50 public articles · 50 articles in the current works window · 10 on this page

Works are ordered by publication date, newest first. Public statistics and works are read separately.

Bridge Pattern – How to Avoid Multiplicative Class Explosion in Structural Design

The article explains how the Bridge design pattern separates two orthogonal dimensions—such as order type and notification channel—into independent hierarchies, replacing inheritance‑driven class explosion with compositional bridges, and demonstrates its rationale, code, real‑world examples, and differences from similar patterns.

Design Pattern #10 – Composite Pattern: Organizing a Group of Objects

The article explains how the Composite pattern solves the pain of handling tree‑like structures—such as orders with nested packages—by providing a uniform component interface that eliminates instanceof checks, discusses transparent vs safe variants, shows real‑world library examples, and outlines when the pattern is appropriate.

Design Patterns 09 – Adapter Pattern: Connecting Incompatible Interfaces

Adapter pattern acts as a translation layer that lets existing classes with mismatched interfaces interoperate without modification, illustrated through a logistics API integration example, with detailed object and class adapter implementations, trade‑off analysis, standard library and Spring examples, and a comparison with decorator and proxy patterns.

Proxy Pattern Explained: Static, JDK Dynamic, and CGLIB Implementations

This article introduces the structural Proxy pattern, demonstrates three implementations—hand‑written static proxy, JDK dynamic proxy, and CGLIB subclass proxy—explains their mechanisms, trade‑offs, and limitations, and shows how Spring AOP selects between them for cross‑cutting concerns like logging, transactions, and caching.

Builder Pattern in Java: Clean, Immutable Construction for Complex Objects

The article explains why traditional telescoping constructors and JavaBean setters fail for objects with many optional fields, and demonstrates how the Builder pattern—both the simplified static inner class version and the full GoF version with a Director—provides readable, step‑by‑step assembly, mandatory validation, and immutable results, with guidance on when to apply it.

Factory Method Pattern: Deciding Which Variant to Create

This article walks through the evolution from direct object instantiation to Simple Factory and finally to the Factory Method pattern, explaining why scattering new statements is problematic, how Simple Factory centralizes creation but still violates the Open/Closed principle, and how the Factory Method delegates the decision to specialized factories, complete with code examples, role definitions, and guidance on when to apply each approach.