Questions tagged [command-pattern]
The command-pattern tag has no usage guidance.
12 questions
0
votes
3
answers
512
views
Decoupling command and receiver in command pattern
I'm writing a simulation of a car that can receive commands and act on them and I'm trying to implement it using the command pattern.
class Car {
move() {
console.log('move');
}
}
interface ...
0
votes
1
answer
142
views
Command pattern across layered architecture without shared interfaces?
I have three layers. I wish to reduce coupling between them and other modules.
I wish to use the command pattern between all layers. A command should be able to be passed from one layer to another.
...
3
votes
1
answer
220
views
Command pattern and object model integration
In a document editor application, is it better to implement the command pattern as a layer on top of the object model, or to deeply integrate it into the object model?
If commands are a layer on top, ...
1
vote
1
answer
258
views
SRP, command pattern and design problem
I'm refactoring a code base to have something more easier to read and follow SRP. However I'm at the point I'm unsure what the best design is.
Currently it looks like this: A thread receives a "...
0
votes
0
answers
52
views
Designing a proof mechanism
DataModel contains a Proof that contains all the information of its integrity along with the method with which the Proof should be verified.
In this case I designed a JWS type of proof that can be ...
0
votes
2
answers
464
views
Is there alternative to applying events synchronously in command handler in CQRS?
I have workflow where I have complex command handlers encapsulated inside aggregate. These handlers emit some events, and then further logic based on result of these events can emit more events. ...
0
votes
2
answers
1k
views
Combining synchronous and asynchronous commands when using the command pattern
Let's say I'm building a simple console app which has three commands:
Create category.
Download recipe from API to category.
Display all recipes in a category.
Assuming the app will grow, I use the ...
7
votes
3
answers
6k
views
Design pattern: How to inject dependencies into a Command pattern
I am pretty new to programming languages and only have limited knowledge about design patterns, so I hope you can help me with the following problem:
I have an application that operates on a group of ...
0
votes
1
answer
48
views
How to handle the getting of information from Model
I'm doing a Java software engineering team project in school and my team has decided on a Finance Tracker application, which contains the main components of Expense, Budget, Statistics, Suggestions ...
1
vote
1
answer
114
views
Abstracting common functionality for REST and CLI
I have made an application that deals with collections of images. Currently it has a REST api to add/remove images, create/clear/delete collections and a worker that can automatically fetch images ...
0
votes
3
answers
653
views
Intent of Command pattern?
In Elements of Reusable Object Oriented software by Erich Gamma, the intent for Command design pattern says:
Encapsulate a request as an object, thereby letting you parameterize clients with ...
5
votes
1
answer
1k
views
Why do we implement the Command design pattern like this?
I trying to learn the Command design pattern, I already know how it works and where it is used, but I'm a little bit confused about the implementation.
So I know we need to set the context by ...