Results: Which approach is better? 

Voters
2 You may not vote on this poll

  • Make sensitive data of State protected, and make StateMachine a friend class of State.
    0%
  • StateMachine pass ID to Handler and provide proxy functions to access State's data.
    0%
  • Same as 2, but instead of passing ID, the StateMachine stores currentState internally.
    50.00%
  • Other: Please leave comments.
    50.00%
    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    1
    Rep Power
    0

    Design Case: Which approach is better?


    Hello all,

    I want opinions on which approach is better from software design perspective. Here is the case details:

    I have three classes: State, StateMachine and Handler. StateMachine passes a State pointer to Handler. Handler can manipulate certain data within State, but SHOULD NOT modify the rest.

    Thanks,
    Sarmad
  2. #2
  3. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,186
    Rep Power
    2265
    It might help if you provided an example of the problem you're trying to solve... the design pattern relationships are a bit ambiguous w/o a use case to contextualize them.
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn

IMN logo majestic logo threadwatch logo seochat tools logo