Tyrr
Tyrr
CC#
Created by FraznoFire on 11/12/2024 in #help
Naming factories “class”factory always a good idea?
thats right. simple rule of thumb: Factory is to generate things
10 replies
CC#
Created by FraznoFire on 11/12/2024 in #help
Naming factories “class”factory always a good idea?
"Factory" on the other hand tells you that it will return "a product" but does not mention the input args, so it can be a Factory that will just generate something with no input provided
10 replies
CC#
Created by FraznoFire on 11/12/2024 in #help
Naming factories “class”factory always a good idea?
"Resolver" is very intuitive, it clearly states that it is to fetch something from some input then return result
10 replies
CC#
Created by FraznoFire on 11/12/2024 in #help
Naming factories “class”factory always a good idea?
"...but I thought it might give more of a clue..." personally when i have such thought about naming anything in my code, i just do it. Conventions are to help making code understandable, but they dont cover every case, sometimes can even make it harder to figure out what it does
10 replies
CC#
Created by FraznoFire on 11/12/2024 in #help
Naming factories “class”factory always a good idea?
its okay to name a class SomeThingFactory if its main purpose is to create objects, but if its more complex, then go for more accurate name
10 replies
CC#
Created by FraznoFire on 11/12/2024 in #help
Naming factories “class”factory always a good idea?
i'd probably separate these two into VendorThingResolver using VendorThingFactory, or make VendorThingResolver implement IFactory<VendorThing> but it's not such a big deal anyways i guess, as long as class name gives a clear hint of what it does for other devs
10 replies