Skip to main content

Questions tagged [builder-pattern]

2 votes
1 answer
151 views

As far as I know about builder pattern, for example, an object, Student: public class Student{ private String name; private int age; //setter and getter } to apply builder pattern to ...
wcminipgasker2023's user avatar
0 votes
0 answers
157 views

I started using factory methods in JPA Entity classes. But I'm not sure if it's an anti-pattern. If it is , then where do I place them instead ? A similar sample is below @Builder @Entity Class ...
kommradHomer's user avatar
5 votes
6 answers
3k views

I would want to have a builder for creating a complex object, for example Employee. I would want to be able to create my objects in two ways: Case 1. Get Employee with default values Case 2. Get ...
CuriousGuy's user avatar
0 votes
1 answer
158 views

I'm working on a library of C++ wrappers/bindings, for another, C-ish, API. The C'ish API has a "launch" function, which, among other things, takes a launch configuration structure (well, ...
einpoklum's user avatar
  • 2,808
0 votes
1 answer
137 views

I need assistance with the QueryBuilder that generates OData query. Following is my implementation and it approach has couple of issues If user forgets to SetRootTable then it will cause serious ...
Sunny's user avatar
  • 945
2 votes
2 answers
164 views

I am working on a tool that scrubs Do-Not-Call (DNC) phone records from a skip-traced CSV file. I have this PhoneModel for child phone entries for each row. It consist of the following fields: isDNC ...
Mike Warren's user avatar
3 votes
1 answer
278 views

In the Design Patterns: Elements of Reusable Object Oriented Software, the Gang of Four present the following canonical form for the Builder pattern: In Appendix B the following is mentioned ...
user32882's user avatar
  • 267
3 votes
3 answers
567 views

I am trying to explain and understand a way to create object which cannot have "default" instances. Typically I want classes which represent, as closely as possible, the real-life concept I ...
Patrick Wright's user avatar
-1 votes
1 answer
237 views

I am working on a program to automatically design heater units based on varying client specifications. The process for creating each heater is quite involved and requires multiple optional steps ...
JS Lavertu's user avatar
1 vote
1 answer
790 views

I stumbled on following problem, and I'm curious if it could be done better. A while ago I wrote a factory class that looked something like this: public class Foo { private IDbContext ...
Draeggiar's user avatar
4 votes
2 answers
940 views

Shoutout to David Arno for teaching me about the builder design pattern via this thread! I have since used that pattern althroughout the code base to abstract out creating models from data stores, ...
Mike Warren's user avatar
-1 votes
3 answers
326 views

I have an Exam class that represents an examination/test: public class Exam { public int Id { get; set; } [Required] [StringLength(maximumLength: 30, MinimumLength = 1] public string ...
Amal K's user avatar
  • 111
5 votes
2 answers
474 views

The book Design Patterns: Elements of Reusable Object-Oriented Software says to use the builder pattern when The algorithm for creating a complex object should be independent of the parts that make ...
Nishant Ingle's user avatar
1 vote
2 answers
1k views

I'm working on a java project for the university. The project is a card game in which you travel around a 2D map and fight against some enemies. My part consists of creating the deck and the cards. I ...
Matteo Paolucci's user avatar
2 votes
2 answers
1k views

Consider the product class: class Car { private String color; private String model_num; //getters and setters for the above fields } Consider builder class 1: class CarBuilder1 { private ...
user3760100's user avatar

15 30 50 per page
1
2 3 4 5