199 reputation
110
bio website
location
age
visits member for 2 years, 3 months
seen Jun 23 at 19:01

Dec
13
awarded  Popular Question
Oct
6
awarded  Popular Question
Aug
14
awarded  Popular Question
Jun
20
comment Data classes: getters and setters or different method design
@kevincline: Good idea! A shame I already finished this project, but something I'll keep in mind next time I need something like this. Thanks!
Dec
24
awarded  Critic
Dec
9
comment Using PDO with MVC
I suggest you take a look at this StackOverflow question, and in particular the answer by tereŇ°ko. Long story short: you should not think of the model as one class, but as a layer consisting of mappers and domain objects (and optionally a service layer, which I personally don't use). The mapper communicates with the database, and the domain object is a representation of the data that also checks input.
Dec
9
awarded  Enthusiast
Nov
27
comment Should I use the factory design pattern for every class?
Mmm, thanks for all your help! I'll think about it...
Nov
27
comment Should I use the factory design pattern for every class?
@PauloMadeira: There is no difference, but using a factory method instead of a constructor would mean that you could easily change that factory method to do extra things. Like returning an object of a derived class or like passing an argument to the constructor. Isn't that a big advantage?
Nov
26
comment Should I use the factory design pattern for every class?
I was aware there are multiple types of factories, but I use a different factory type depending on my needs. For example, I've got a Request class on which I can call Request::factory (so a factory method). But I think I can specify my original question a bit more: wouldn't it be handy to create a Factory Method for every class to use instead of a constructor? Since one can do this using a single base class, it wouldn't make the code more complex. What do you think about that?
Nov
25
comment Should I use the factory design pattern for every class?
@user1598390: But is that really a better than idea than having a static factory method? Why so? What's the advantage over having one very tightly coupled class? To me that sounds not good at all...
Nov
25
comment Should I use the factory design pattern for every class?
Is your static Factory class a better idea than static factory methods in each class? So do you prefer Factory::getCar() over Car::factory(). If so, why?
Nov
25
comment Should I use the factory design pattern for every class?
@user1598390: I understand that. But do you advise me never to use the new operator and use the factory pattern for every class?
Nov
25
comment Should I use the factory design pattern for every class?
@BillMichell: That would be really handy! Do you happen to know something like that for PHP?
Nov
25
comment Should I use the factory design pattern for every class?
@Oded: Maybe you're right. I just feels inconsistent...
Nov
25
comment Should I use the factory design pattern for every class?
Even when you otherwise might have to rewrite loads of code because you use new Object(); everywhere?
Nov
25
comment Should I use the factory design pattern for every class?
But if I use it for every class my code is more consistent. Furthermore, it would also mean I wouldn't have to rewrite code when I found out I need to use a factory after all. So you think that is not as important as added complexity?
Nov
25
asked Should I use the factory design pattern for every class?
Nov
17
awarded  Citizen Patrol
Sep
13
accepted Data classes: getters and setters or different method design