[Cs5500] Redesign of the game definition

Karl Lieberherr lieber at ccs.neu.edu
Tue Mar 8 16:14:23 EST 2011


Getting back to Rick's remark that the protocol should be indepedent
of the domain,
consider Anush's and Rashmi's code:
/home/lieber/.www/courses/se-courses/cs5500/sp11/GenericSCG/anush-rashmi/HSR
Game Definition/hsr/protocol

Positive {{
        public double getResult(Claim claim, List<Response> replies){
                double claimedQuality = claim.getQuality();
                if(replies.length() == 2){
                        ProvideResponse provideResponse =
(ProvideResponse)replies.lookup(0);
                        if(provideResponse.getInstance() == null){
                                provideResponse.getInstance().finishParse();
                        }
                        HSRInstance i =
(HSRInstance)provideResponse.getInstance().getInstance();

The last line is the only one depending on the domain. To stay with
Ahmed's design approach,
it is important that the protocol is independent of the domain.

Ahmed recommends to use:

Instance i = (HSRInstance)provideResponse.getInstance();

and to take the protocol code outside the hsr directory.

Anush and Rashmi: please can you test this redesign.

The benefit is, as Rick said, better modularity and reusability of protocols.

-- Karl



More information about the Cs5500 mailing list