Avoiding the Pitfalls of Using “new” Keyword

Discuss how to avoid creating dependent objects manually in order to improve maintainability using dependency injection and abstraction.

Shawn Shi
Geek Culture
Published in
6 min readFeb 12, 2023

--

Diagram by author. Icons from flaticon.com.

Background

You probably see the “new” keyword every day. In simple cases, e.g., creating instances for data transfer object (DTO)…

--

--

Shawn Shi
Geek Culture

Senior Software Engineer at Microsoft. Ex-Machine Learning Engineer. When I am not building applications, I am playing with my kids or outside rock climbing!