Skip to main content
20 events
when toggle format what by license comment
Apr 7, 2024 at 16:57 vote accept CuriousGuy
Apr 6, 2024 at 18:47 answer added Greg Burghardt timeline score: 3
Apr 6, 2024 at 17:10 answer added Matt Timmermans timeline score: 1
Apr 6, 2024 at 12:45 comment added nvoigt It seems to me this is a Java-specific problem, that "named parameters" solved in pretty much every other halfway modern language.
Apr 6, 2024 at 11:08 comment added nvoigt You have mentioned no reason at all, why you need a factory, or a builder. Is there such a reason? Otherwise I'd say both is "overengineered waste" and should be avoided. If it is a hobby or school project to play around with the patterns, go ahead and create whatever pattern monster you have fun creating though.
Apr 6, 2024 at 7:48 history protected gnat
Apr 5, 2024 at 17:58 comment added JimmyJames Since there are two distinct and well-known Builder patterns (GoF and Bloch) it would be good to explicitly clarify that you are talking about the Bloch Builder here. Also, 'Factory' can be understood in a number of ways. I think you are talking about a Factory method which is (in GoF) more than just a method that returns instances (which is completely fine, IMO)
Apr 5, 2024 at 17:35 history edited CuriousGuy CC BY-SA 4.0
deleted 1 character in body
Apr 5, 2024 at 16:35 history became hot network question
Apr 5, 2024 at 16:24 answer added candied_orange timeline score: 4
Apr 5, 2024 at 14:14 comment added Filip Milovanović A builder is already a kind of a factory (a factory doesn't have to be a static class). So, I wouldn't go through a static function, unless your team absolutely insists on that for consistency with other code. You could just use new EmployeeBuilder().build() to create an instance with the default values (this makes sense, but may not be obvious to everyone, so make sure to point this out in the docs and/or documentation comments associated with the builder class).
Apr 5, 2024 at 13:27 comment added CuriousGuy It is just a simple POJO that will be used as a test data in tests
Apr 5, 2024 at 12:21 comment added Greg Burghardt Is Employee meant to be a domain object? It is difficult to answer this question because you can get a factory + builder to work, but is it necessary?
Apr 5, 2024 at 9:20 answer added user443159 timeline score: -1
Apr 5, 2024 at 8:10 comment added guillaume31 If you just need a static class name that people can type as a starter prompt for building different kinds of Employee, Factory is probably not the right name as it will get confused with the actual Factory design pattern.
Apr 5, 2024 at 8:06 answer added Ewan timeline score: 6
Apr 5, 2024 at 7:45 review Close votes
Apr 10, 2024 at 3:02
Apr 5, 2024 at 7:27 answer added sfiss timeline score: 9
Apr 5, 2024 at 7:12 comment added Ccm Returning a builder and a concrete object is going to shock others, that would be enough for me to not go that way.
Apr 5, 2024 at 7:07 history asked CuriousGuy CC BY-SA 4.0