215 reputation
27
bio website
location Canada
age
visits member for 2 years, 5 months
seen Jul 14 at 0:07

Sep
12
asked Methods for systematically researching technologies to use in a project?
Aug
15
asked Should you make private properties?
Jul
23
comment How do you follow the single responsibility principle in classes responsible for behaviour?
By behavior classes I mean state machines that intercept calls or events on a class and act based on the current state- so for example if I have a class responsible for network messages any events or calls sent to it while it is in any state but "connected" get bounced off or queued. As a result the states themselves become very tightly coupled to the interface of the class they are controlling. Is this a bad approach?
Jul
19
awarded  Scholar
Jul
19
accepted How do you follow the single responsibility principle in classes responsible for behaviour?
Jul
19
comment How do you follow the single responsibility principle in classes responsible for behaviour?
I've never used DI/IoC or the Service Locator pattern- do you think it would provide the layer of indirection I need? (see comments on the other answer)
Jul
19
comment How do you follow the single responsibility principle in classes responsible for behaviour?
Even continued more- If I use an event system all I have to worry about is passing in a reference to it and registering/sending events. In that way classes with complex behavior are only responsible for sending/receiving events.
Jul
19
comment How do you follow the single responsibility principle in classes responsible for behaviour?
Continued- In that case I have to make sure the controller system now gets references to two systems, passes those references to its controller state machine, and then into its own state machine if it has one. If I want to add more systems to this I have to change all this stuff every time, and have to be careful to manage registering and unregistering of observers properly. Then what if I want the controller to get information from the networking system for display on the view? I would have to add callbacks. It gets extremely complicated at this point.
Jul
19
comment How do you follow the single responsibility principle in classes responsible for behaviour?
For example, I have a view system, controller system (as in MVC) and networking system, which all use state machines and have associated states for behavior (in the controller system a controller is just a specialized state) and some of the controller states themselves have state machines, because the behavior is pretty complex at times. Now if I want my controller state to be an observer of the view state I can just pass in that system, but what if I want my controller system to change state based on the state of the networking system (don't act on input when in a not-connected state)?
Jul
19
awarded  Student
Jul
18
asked How do you follow the single responsibility principle in classes responsible for behaviour?