-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Nitin Mekhiya
Message 3 in Discussion
<o:p></o:p>
Design patterns are Unit of construction.<o:p></o:p>
Pattern details u can get it from <o:p></o:p>
www.dofactory.com<o:p></o:p>
www.hillside.net<o:p></o:p>
Factory pattern is one of the Creational pattern.It plays role
where some object is to be Created.<o:p></o:p>
In Object system , to create Object of some class/component we
call That Object's constructor.<o:p></o:p>
For eg: If we want to create Instance of Class Employee.<o:p></o:p>
Then Code is<o:p></o:p>
Employee ObjEmployee = new Employee();<o:p></o:p>
or<o:p></o:p>
Employee ObjEmployee = new Employee("John","Male",24);<o:p></o:p>
-----------------------------------------------------<o:p></o:p>
So there would be so many places where you make instance of you
class with lot of parameters.This way if we keep writing code , it can be
expensive(any point of time you want to change the parameter...u need to make
changes at code level,...Open code ...change....compile....again deploy...)<o:p></o:p>
Instead of this<o:p></o:p>
If we implement a separate class/component named
"EmployeeFACTORY" (which implements Factory pattern Inside)<o:p></o:p>
THEN Instead of calling constructor directly , we have to say <o:p></o:p>
EmployeeFactory.getEmployee();<o:p></o:p>
And it will return the required object.<o:p></o:p>
Factory Pattern Hides the word "New" from your Layer of
code. :-)<o:p></o:p>
Going one step further....we can have our Factory supplying us
differnt Category of object at run time.<o:p></o:p>
Best Example: You making a product.Inside has <o:p></o:p>
DatabaseFactory <o:p></o:p>
At run time this Databasefactory will give you Objects (Connection,
command,Adapter) <o:p></o:p>
of Either SQL...or OLEDB...or Oracle.<o:p></o:p>
<o:p> </o:p>
Take care<o:p></o:p>
Nitin Mekhiya<o:p></o:p>
<o:p> </o:p>
Factory [Design
Pattern ]<o:p></o:p>
Reply
<o:p></o:p>
<o:p></o:p>
Recommend
<o:p></o:p>
Message 1 in
Discussion <o:p></o:p>
<o:p></o:p>
From: ShareNCares <o:p></o:p>
<o:p> </o:p>
can anyone tell me how to implement
factory design pattern in C#, pls give me some good
example frm there i can continue. pls explain how it works and wht
are the advantage it has and whether any other design pattern is
there???. i'm new to these things that why i wanna every information
i get.<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
- Nitin Mekhiya<o:p></o:p>
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]