---
title: "Discussion on \"Factory Method Pattern\" | Hashnode"
description: "Discussion on \"Factory Method Pattern\". An explanation on factory method design pattern"
url: "https://hashnode.com/posts/factory-method-pattern/63415bc36401058c05f3fa57"
---

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

Discussion

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

An explanation on factory method design pattern

Oct 8, 2022 · 2 min read · thkarropoulos.hashnode.dev  
Read the article

-   [#software-development](https://hashnode.com/tag/software-development)
-   [#software-architecture](https://hashnode.com/tag/software-architecture)
-   [#design-patterns](https://hashnode.com/tag/design-patterns)
-   [#software-engineering](https://hashnode.com/tag/software-engineering)

## Written by

[Theodoros Karropoulos](https://hashnode.com/@thkarropoulos)

@thkarropoulos · Athens Greece

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

Software Engineer

## Responses 1

Markdown supported · ⌘↵ to post

[Markos Korvesis](https://hashnode.com/@MarkosK)

[Oct 8, 2022](https://hashnode.com/posts/factory-method-pattern/63415bc36401058c05f3fa57/comment/634165b4f469e9e68d3f9200)

Even though I would avoid the Greek pizza on the menu, this is a lovely and well-structured article!

I have two concerns, which are out of the scope of this article of course, but I will mention them anyway. 😝

This switch statement will eventually become hard to maintain if the pizza is tasty and the business grows to add more entries to the menu. Additionally, I would consider throwing an exception in the default branch and removing the spinach from the Greek pizza as a good practice.

Good job, [Theodoros Karropoulos](https://hashnode.com/@thkarropoulos)!

[Theodoros Karropoulos](https://hashnode.com/@thkarropoulos)

[Oct 15, 2022](https://hashnode.com/posts/factory-method-pattern/63415bc36401058c05f3fa57/comment/634165b4f469e9e68d3f9200#reply-634a9eb87b9ff55063441f85)

Hello [Markos Korvesis](https://hashnode.com/@MarkosK)!

Thanks for your kind worlds, I would also avoid spinach on my pizza by the way :P ! Actually you have a valid point how switch statements tends to become hard to maintain.
