Tagged articles

Object Construction

7 articles · Page 1 of 1
Dabaoshi
Dabaoshi
Aug 5, 2026 · Fundamentals

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.

Builder PatternDesign PatternsImmutable
0 likes · 20 min read
Builder Pattern in Java: Clean, Immutable Construction for Complex Objects
liandk
liandk
Jun 16, 2026 · Fundamentals

Builder Pattern Explained: Simple Theory, Real‑World Scenarios & Java Code

This article introduces the Builder design pattern, illustrates its concept with everyday analogies like milk‑tea making, and provides a complete Java example that assembles a computer through step‑by‑step builders, followed by a summary of typical business use cases and a tip on avoiding confusion with the Factory pattern.

Builder PatternDesign PatternsJava
0 likes · 5 min read
Builder Pattern Explained: Simple Theory, Real‑World Scenarios & Java Code
Deepin Linux
Deepin Linux
Oct 6, 2025 · Fundamentals

Mastering Placement New in C++: When and How to Use It Safely

This article explains the concept, syntax, and practical use cases of C++ placement new, compares it with ordinary new, discusses memory‑pool and stack allocations, highlights alignment and lifetime management issues, and provides interview‑style Q&A with code examples.

C++Object ConstructionPerformance
0 likes · 35 min read
Mastering Placement New in C++: When and How to Use It Safely
Python Programming Learning Circle
Python Programming Learning Circle
May 21, 2025 · Fundamentals

Why Defining __init__ Directly Is a Bad Practice and How to Replace It with dataclasses, classmethods, and NewType

The article explains that using a custom __init__ method to create data structures couples object construction with side‑effects, leading to fragile code, and demonstrates how refactoring with @dataclass, @classmethod factories and typing.NewType yields cleaner, safer, and more testable Python classes.

Design PatternsNewTypeObject Construction
0 likes · 13 min read
Why Defining __init__ Directly Is a Bad Practice and How to Replace It with dataclasses, classmethods, and NewType
Architect's Tech Stack
Architect's Tech Stack
Jan 20, 2021 · Fundamentals

Using a Generic Builder Pattern in Java to Simplify Object Creation

This article demonstrates how a universal Builder utility can replace verbose object construction in Java, allowing developers to instantiate a class and set multiple properties—including complex collections—in a single fluent chain, while also explaining the underlying implementation and usage examples.

Builder PatternDesign PatternsFluent API
0 likes · 7 min read
Using a Generic Builder Pattern in Java to Simplify Object Creation