Post a Job  |   Ask a Question?   |   Already registered? login or register
Asish Panda
11/01/2017 08:28 PM

Builder design patterns vs factory design patterns


What is the main difference between factory design patterns and builder design patterns... When I used factory design patterns and when I used builder design patterns.... How hibernate Internally uses builder design patterns... Can any one pls help me....
Spam    3 Comments

Asish,Panda
11/01/2017 20:32:36
I think if we create custom object then we can go for builder design patterns.

Haribabu,Kothappalli
11/01/2017 21:58:49
Factory DP: --> The main purpose of Factory DP is meant for creating Object that means hide the complexity of creating the object. for example if you try to Create a Object one class in to your class, your must know complete instantiation of creating object of another class and our class tightly coupled with other class, if you go for factory class it will create a object and given to you. here we don know complete instantiation of object but you get the object by the help of Factory DP and our class decoupled with other class. Builder Design DP:--> This is also meant for creating a object. the difference is here create a object with pre populated data and create a object then give to you with populated data. Example: In hibernate Configuration c = new Configuration().configure(); Here configure method work as a builder DP because In configure() we don't pass any data but you get configure object with pre populated data means Hibernate.cfg.xml file is populated in configure and given to you that's way configure method act as builder DP. I think you understood other vicei tell with another example.

Asish,Panda
11/01/2017 22:28:52
Thanks Haribabu.. Nice Explaination...

Languages :
xml