Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factory Pattern #32

Open
Jazarumag opened this issue Dec 16, 2023 · 0 comments
Open

Factory Pattern #32

Jazarumag opened this issue Dec 16, 2023 · 0 comments

Comments

@Jazarumag
Copy link

The Factory pattern allows you to encapsulate object creation logic. This is useful when you need to instantiate different classes depending on the program conditions, in this case the hotel type. Attached UML:
image
Positive Consequences:

  • By creating separate factories for international and domestic hotels, you can avoid code duplication and make it easier to manage differences in booking processes, pricing structures, and regulations. This reduces the complexity of your code and simplifies future maintenance and updates.
  • The factory pattern allows you to easily add new types of hotels without modifying existing code. You can simply create new factories for different hotel categories (e.g., luxury, budget, all-inclusive) or specific regions. This makes your application more flexible and adaptable to changing business needs.

Negative Consequences:

  • Implementing the factory pattern requires additional upfront design and development effort. You need to define separate interfaces and factories for different hotel types, which can add complexity to your codebase, especially for smaller projects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant