mercredi 23 mai 2018

Builder pattern working with real data (not some hardcoded data)

I am currently learning the builder pattern. All the tutorials, everything is great, but when it comes to working with real data (not hardcoded strings inside your SetFoo(), SetBar() (in the builders)), I realized that I need to pass to the builder from inside the controllers (MVC). And then my controller happens to be the director right? PS: My construct method is gone now since the data is already set from the setters of the builder. Example: fooBuilder.setBar("real data from db"); fooBuilder.setGoo("more real data from the database");

Does this violate the principles of the builder pattern?

Aucun commentaire:

Enregistrer un commentaire