Java Builder Pattern and Fluent-API - how to create complex objects with Java

preview_player
Показать описание
Java Builder is a pattern that can help you to create complex objects.

Every time we create a new instance model, we must ensure that this entity is valid in our code. Thus the validation and constraints are critical to guaranteeing the API design direction.

Extracting this creation path to another class in a complex object makes code more testable and readable; plus, it follows the Single of Responsibility principle.

This video will explain two ways to create complex objects with two patterns: Builder and fluent-API or DSL — the main difference between the tradeoffs and how to do it in Java.

Builder Pattern and Fluent-API - how to create complex objects with Java.

#BuilderPattern #FluentAPI #Java #OtavioSantana #complexobjects #JavaBuilderPattern #BuilderPatternandFluent-API

Рекомендации по теме
Комментарии
Автор

This approach is awesome.

Thanks for sharing!

iagosaito
Автор

This is very helpful. Thank you. Any resource (book, link) where I can read more patterns in this practical way?

techtalkswithrajitha
Автор

Um duvida, qual seria a vantagem do Builder em relação a fazer um Person person = new Person(); e passar os atributos via sets ?

Naicson
Автор

First of all, congrats about you work. I'm a supporter of your work. Lombok generate something similar to Intelij create it. I think builder make code cleaner and linear. This approach make your code more flexible when you have some rules about the initial state of the object. I should confess that I didn't find justification to use Fluent API. But to design is very powerfull. Can you share another context sample to use Fluent API?

antoniolazaro
welcome to shbcf.ru