---
title: "Discussion on \"Factory Method Pattern\" | Hashnode"
description: "Discussion on \"Factory Method Pattern\". Stop Using new Everywhere\nAt some point, every codebase reaches this stage\nif (type.equals(\"CAR\")) {\n    return new Car();\n} else if (type.equals(\"BIKE\")) {\n    return new Bike();\n} else if (type.equals(\"TRUCK\")) {\n    return new Truck();\n}\n\nIt works..."
url: "https://hashnode.com/posts/factory-method-pattern/69453c1691bd08c12f14870e"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Factory Method Pattern](https://alishakausheen.hashnode.dev/factory-method-pattern?utm_source=hashnode&utm_medium=feed)

Stop Using new Everywhere At some point, every codebase reaches this stage if (type.equals("CAR")) { return new Car(); } else if (type.equals("BIKE")) { return new Bike(); } else if (type.equals("TRUCK")) { return new Truck(); } It works...

Dec 19, 2025 · 3 min read · alishakausheen.hashnode.dev  
Read the article

-   [#creational-design-patterns](https://hashnode.com/tag/creational-design-patterns)
-   [#factory-design-pattern](https://hashnode.com/tag/factory-design-pattern)
-   [#lld](https://hashnode.com/tag/lld)
-   [#design-patterns](https://hashnode.com/tag/design-patterns)
-   [#system-design](https://hashnode.com/tag/system-design)

## Written by

[Alisha Kausheen](https://hashnode.com/@AlishaKausheen)

@AlishaKausheen

  
[View profile](https://hashnode.com/@AlishaKausheen)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
