Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Explain Factory pattern?

Answer Posted / swetha

Factory Design Pattern is a simple decision making class
that returns one of several objects depending on the data
provided. It comes under creational type of design pattern.


Example:

Suppose say that want to write the code to perform
arithmetic calculations. Initially you decided to write code
for only Addition and Subtraction. And later on you decided
to add more functionality by including Multiplication and
Division. Now, if you don't use Factory Design Pattern, we
need to change the entire code to include additional
functionality. But, when we use Factory Design Pattern, It
is easy to add additional functionality when needed without
disturbing previous code.

In factory class we create the instance of the classes
addition, subtraction, division and multiplication based on
the operator selected.

In this way Factory Design Pattern is useful.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How we can force all the validation controls to run?

990


Can viewstate be accessed in another page?

1032


How to use a Master Database in Asp.net?

1065


Can the validation occurs in server-side or client-side? If the validation occurs why should we do?

1041


What is difference between web api and web services?

1002


What is difference between mvc and asp.net? : Asp.Net MVC

1196


Can you change a master page dynamically at runtime? How?

928


What type of code, client-side or server-side, is found in a code-behind file of a Web page?

958


What do you mean by serialize?

973


When maintaining session through sql server, what is the impact of read and write operation on session objects?

988


How do I create a web form?

1040


What is localhost in asp.net?

1018


What is _dopostback in asp net?

958


Can I have a unique key as foreign key?

961


What is recordset asp?

994