Builder Pattern and Inheritance in Java

Pere Villega published on
1 min, 149 words

Categories: java

At Gumtree we are currently doing some changes to the back-end of the site. To that aim we have spent some weeks building tools and scaffolding that will facilitate our next tasks. Planning is important if you want quality.

Given that for this particular project we are using Spring MVC, we wanted a way to build our model objects without duplication and to keep things in sync with minimal effort. The builder pattern is a fit, but adding inheritance makes things much more complex than they seem at first glance.

I’ve written about it in a post in our Gumtree dev blog, where you can find some code samples along the explanation of the issue.

As always, feedback via Twitter/Email is more than welcome.