Search code examples
design-patternsfactory-patternn-tier-architecture

The Factory Pattern V/S Ntier Pattern


When i started to learn and spent 5 day learning nTier Architecture. My Boss is insisting me to learn Factory Pattern.

So some question arises in my mind..

  1. Can we apply nTier in Factory Pattern.

  2. what is benefit of Factory Pattern.

  3. What to choose between Factory Pattern and ntier Pattern

By the way i am c# coder in DOTNET


Solution

  • 'N-tier' and 'factory' are not comparable because they apply to different levels of detail. 'N-Tier' is a high-level concept that divides your system into very coarse components: client, application server, database. 'Factory' is a low-level pattern used to structure classes within a component - that a class or method responsible only for creating other classes can be beneficial in some cases. You should not take a single pattern like 'factory' and try to apply it - you should understand a range of patterns and learn when each is useful, because there are pros and cons to every pattern. The classic reference is http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612 - now 20 years old but still worth reading as a starting point.