Tagged articles
5 articles
Page 1 of 1
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.

CObject Constructioncustom allocator
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