Questions tagged as 'design-pattern'

2
answers

Method to execute when destroying instance of a class

Is there any way to automatically execute a method by destroying an instance of a class. I have a generic SQL class, where in the constructor I call a method that opens the connection. Only I want to close this connection automatically too, with...
asked by 20.11.2014 / 13:30
1
answer

Alternative to Observable and Observer in Java 9

For testing purposes, I'm porting an application from version 7 to version 9 of Java. This application has some features that use Observer and Observable . I noticed that both have become obsolete: @Deprecated(since="9") pub...
asked by 06.10.2017 / 16:04
1
answer

What is a wrapper class?

What is a wrapper class? How can they be useful? Cite examples of usage at php or
asked by 03.02.2014 / 16:58
3
answers

Could anyone explain the term "Specification pattern", applied in Javascript?

I did some research on the net, found this website with valuable information. I work a lot with conditionals using javascript, see an excerpt from my function that receives radiogroup as a parameter and verifies whether it was selected yes or...
asked by 18.08.2015 / 13:56
2
answers

How to implement a "thin"

I'm working on a prototype of an ASP.NET MVC application, where I want to leave my lean controller (with the least amount of code possible) for that, not doing business logic on it, but yes in the business layer. I have the business layer, wh...
asked by 24.11.2015 / 23:30
1
answer

CQRS - When to use and why to use?

What are the advantages of using the CQRS (Command / Query Responsibility Segregation) standard? What are the disadvantages?     
asked by 04.04.2018 / 22:47
1
answer

Basic difference between Abstract Factory and Factory?

I was taking a look at the PHP Manual and saw an example implementation of the Factory pattern. Example: class Exemplo { // Método Factory parametrizado public static function factory($type) { if (include_once '...
asked by 10.09.2015 / 17:27
3
answers

Architecture problem where access to construction methods must be controlled

I have a tree class that will have the addition of trunks, branches, leaves and fruits. I need the class to give access to certain methods only after others and that previous ones can not be access again. Example: public class Arvore...
asked by 15.06.2015 / 23:46
1
answer

Business object validation avoiding / reducing use of if's and else's

I have a problem where I have three types of employee (EmployeeA, EmployeeB, EmployeeC), all of which will be stored in a table named Employee and their respective relationships, but these types mentioned above have different validations between...
asked by 23.06.2014 / 17:02
4
answers

How to identify and when to use Value Object?

I'm studying DDD from the books of Eric Evans and Vernon. During the reading I came across the Value Object implementation, I even understood the concept but could not abstract into a real situation within a domain. I joined the following t...
asked by 28.08.2017 / 21:04