Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Hibernate Basics!
You have completed Hibernate Basics!
Preview
As a step away from Hibernate, this lesson demonstrates a popular design pattern in coding called the **builder** design pattern. This pattern is used to write *readable* code that creates and configures an object.
Design Pattern Resources
- Overview & description of patterns: https://sourcemaking.com
- Code samples for patterns: https://github.com/iluwatar/java-design-patterns
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
This pattern, called the Builder Pattern,
is used to address a few common pit falls.
0:00
Mainly, the one of classes
that have many fields.
0:05
Creating an object is accomplished
by calling the classes constructor.
0:08
But, if the class has five
instance feilds, like ours does.
0:12
We might end up with a constructor
that has five perameters.
0:16
But the code that we type to
instantiate an object with
0:20
five perimeters isn't that readable.
0:22
And what if we want to be
able to create an object,
0:25
while specifying only
a couple field values?
0:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up