Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6227247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:10:54+00:00 2026-05-24T09:10:54+00:00

I may just be missing a key concept here. I understand the ‘dumb’ data

  • 0

I may just be missing a key concept here. I understand the ‘dumb’ data objects. I also understand that roles are stateless collections of methods applied to a dumb object when it takes on that role. I also understand that a context assembles the actors that will take place in the algorithm being implemented. But what the roles know about each-other, and weather they must be defined within the context, or outside it is unknown to me.

Say a context has 2 roles, start and end. Our use-case is string concatenation, so we will be assigning a string to each role.

some psudocode:

context concat {
    role start {
        method concat() {...}
        method get_value {self->as_string}
    }
    role end {
        method get_value {self->as_string}
    }

    // According to the docs I have read, the context simply kicks off a method in
    // a role, the role handles the rest.
    start.concat(?)    
}

Now for 3 different combinations of how concat() (the method) and start.concat(?) (the call) may need to be:

Roles are aware of other roles in the same context (forcing roles to be non-reusable in other contexts, which seems wrong to me.)

concat{ self.get_value + end.get_value }
start.concat() // Not passing 'end' as an argument, 
               // it is already aware of end because
               // it is defined in the same context

Roles are not aware of the other roles in the context, and thus need them passed in as arguments (Which seems a pain as a context could have any number of roles, if the context starts by kicking off a method we could need to pass 30 ‘roles’ into the one method call as arguments, then chain them all the way!)
(Note: In this one the role definitions may be moved outside the context, and re-used in multiple contexts)

concat( end x ) { self.get_value + x.get_value )
start.concat(x)

To me the most obvious choice seems to be to not force context to kick off a method and nothing more. Then put the interaction logic into the context, and the non-interactive parts into roles. (Note: In this one the role definitions may be moved outside the context, and re-used ina couple of contexts)

concat() UNDEFINED
start.get_value + x.get_value

This seems to contradict this though:
http://en.wikipedia.org/wiki/Data,_Context_and_Interaction#Execution_Model

  1. the Context invokes a Role method on the first object to take part in the use case.
  2. From that point forward, Roles invoke each others’ methods to carry out the use case.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T09:10:55+00:00Added an answer on May 24, 2026 at 9:10 am

    In DCI the roles are usually aware of the context, and the context can act a repository for all the relavant roles. I.e. case number two where the role can access the context, and ask it for the objects playing the other roles it needs.
    This is implementation detail though. Passing the needed objects into role methods can work too. The important part is that the roles interact with each other through the role methods (that is, not through role player methods, since that creates an unfortunate coupling).
    Roles are – generally speaking – not expected to be candidates for reuse across contexts. A context roughly corresponds to a use case, and the roles implement the behavior of the use case. In general that logic is not reusable across use cases.

    Hope this helps.

    Also you may want to check out the artima article introducing DCI, and the object-composition google group.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I may just be missing something obvious here, so I apologize if this is
I just realized that i may not be following best practices in regards to
I'm importing data that may or may not exist already in my database. I'd
This is quite obscure, I may just be missing something extremely simple. Scenario 1
I'm not sure if I'm just missing something here, but is it possible to
I know I'm just missing something stupid here. Anyone see what I'm doing wrong?
I just realized a function may be defined inside another function in C: void
This may be a stupid question but im just starting to learn Rail thats
This may apply to other mobile operating environments than just Symbian... However, the issue
This may sound like a stupid question but I'm a beginner not just to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.