Reputation
778
Next privilege 1,000 Rep.
See votes, expandable usercard
Badges
5 21
Newest
 Curious
Impact
~14k people reached

  • 0 posts edited
  • 1 helpful flag
  • 72 votes cast
Jun
4
comment OOP design for conditional event processing queue
Also I am not sure that it truly solve my problem. In process(), how can I get the event (x,y) position from IAbstractEvent? How can a different runnable get "Application name which just launched" from IAbstractEvent as well? This will most probably involve some dynamic casting and runtime type checking.
Jun
4
comment OOP design for conditional event processing queue
I ran into some problems with this approach. In my design, the conditions depends on the events and not the other way around. The events should have no knowledge of what may happen when they are raised. Maybe my formulation of the problem wasn't clear enough, or I don't understand your implementation correctly. The constructFactory() call implies that the event know about "DrawCircle" before conditions are checked, while I was trying to have the "DrawCircle" decision taken based on the conditions.
Jun
2
comment OOP design for conditional event processing queue
So the idea is to centralize the reflection in an abstract factory, then the concrete factories will know enough about the types they handle to avoid further manual casting. This is certainly better than having each event handle their own dynamic casting. I'll see how this can work for me.
Jun
2
comment OOP design for conditional event processing queue
@Ixrec : "===", javascript background huh? :p. I could use enumerations to "tag" my class types and check these at runtime. It would save some of the problems caused by dynamic casting, but it still doesn't "feel" like the "right" solution. Also, the SFML approach works by coupling the event dispatch loop with "action" code, like window manipulation and such. The 3rd layer seems to be what creates all the problems.
Jun
1
comment OOP design for conditional event processing queue
Thanks for the suggestion Snowman. Inversion of control is precisely what I'm trying to achieve here. At first I thought I would be ok by passing the triggering event down to the IRunnable and letting it be handled in the runnable's implementation. I just don't know how to handle it down the chain. I'll look at the wikipedia article more closely for additional clues.
Jun
1
asked OOP design for conditional event processing queue
Mar
20
awarded  Curious
Jan
13
answered why empty function are needed
Apr
17
awarded  Notable Question
Sep
21
awarded  Yearling
Aug
27
awarded  Popular Question
Aug
21
awarded  Nice Question
Jun
21
awarded  Popular Question
Oct
19
awarded  Nice Question
Oct
9
awarded  Notable Question
Sep
21
awarded  Yearling
Sep
11
asked Is it possible to outsource design properly?
Jun
3
comment How to unit test with lots of IO
I want to test if my hardware behaves correctly without building a full emulator for it. I cannot creates a stub complex enough to simulate every behavior for my hardware. How can I know if option #38 = 4 and option #45 = 1 doesn't break everything?
Jun
3
asked How to unit test with lots of IO
Mar
23
awarded  Nice Question