5 votes
Accepted

Is it bad practice to have too many direct subclasses?

I don't think the number of descendants (in itself) is necessarily a problem. But I question whether inheritance is likely an ideal way to implement this behavior anyway. By putting the undo/redo at ...
user avatar
  • 43.9k
1 vote

Decoupling command and receiver in command pattern

The idea of the command pattern is to decouple requests (commands), invokers (asking commands to be carried out) and receivers (objects on which the commands operate, i.e. Car). A very common ...
user avatar
  • 67.8k
1 vote

Decoupling command and receiver in command pattern

I presume from your description that all of the commands in the list refer to the same object (car). E.g., it's a small script for a car. You don't actually need to create the commands right then when ...
user avatar
1 vote

Decoupling command and receiver in command pattern

You're correct in that the command pattern as normally described assumes that a command encapsulates all information that's needed for execution. As such, it can only be used to delay execution of ...
user avatar
1 vote
Accepted

Should I instantiate the state objects of a finite state machine?

There are many ways to model states. Most programming languages don't model "real world" items directly but rather have their own features that are used to compose solutions that do the ...
user avatar
  • 32.3k
1 vote

Should I instantiate the state objects of a finite state machine?

Using classes just as expensive enums isn't object oriented, it's just plain wrong :-) A possible object oriented approach would be to implement the state transitions as methods of the state objects, ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible