Questions tagged as 'design-pattern'

1
answer

Modeling for user permissions

I think this question is more about modeling analysis actually do not know if it fits into the standard questions discussed by meta.pt.stackoverflow.com . I need to make my system in a way that almost everything will have user permissions, I ma...
asked by 28.03.2014 / 18:23
1
answer

What are the correct practices for manipulating events in PHP?

I've created some classes and an interface to handle events for a small MVC application. My intention is to implement the Observer pattern, but I do not know if you agree, since I still confuse it with PHP. In the following code, did I do it the...
asked by 30.12.2013 / 01:38
3
answers

How to implement the default presented in C # with EntityFramework?

I'm thinking of a way to apply the pattern ( multi-tenant ), raised on this issue ( Standard that has contributed to the reliability of software that needs to meet complex models such as multi-business models ) EntityFramework . As th...
asked by 17.09.2014 / 15:22
1
answer

Class Patterns [duplicate]

I'm not getting Portuguese literature, so I found an article in English that I did not quite understand the concept , could someone help me explaining the differences: Write a Class with methods within the Class: function MyClass() {...
asked by 03.07.2015 / 15:25
2
answers

Difference between DTO and ViewModel?

In this question we can see what ViewModel is: Pra does a ViewModel serve in ASP.NET MVC? In this other question we can see what is DTO: What is a DTO? But after all: What's the difference between DTO and ViewModel? When should w...
asked by 07.06.2018 / 22:04
2
answers

What exception should I post according to each situation?

In PHP, we have several types of exceptions that can be thrown. Among them: BadFunctionCallException BadMethodCallException DomainException InvalidArgumentException LengthException LogicExc...
asked by 09.02.2015 / 19:29
2
answers

How to apply the Singleton pattern correctly?

The class PEHandlerService needs to have a single instance and I do not want to use synchronized because of the slowness, I created the following code: public class PEHandlerService extends PlanilhaHandler { private LanguageH...
asked by 27.03.2015 / 13:19
1
answer

Should a user model have all the actions that involve it?

When I search, I see that in MVC we should separate the models so that it becomes more organized and easier for an upcoming developer to understand the system. I have the basic actions like login, registration, logout. Would it be correct,...
asked by 18.10.2017 / 13:17
1
answer

Design pattern Observer applied to events

I'm studying the design patterns and I'm trying to apply a real situation to them. And an example I made was in the event scenario: In this scenario every event has participants to register. So, I have implemented the Observer standar...
asked by 24.12.2014 / 11:07
1
answer

Referral in the Flyweight project standard

There's one thing in the Desing Flyweight Pattern that's making me really confused. Briefly, the standard says that to save memory in a situation where you use several similar objects, you use a factory that returns references to the same object...
asked by 14.03.2014 / 05:08