This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design Pattern question

 
Isuru Samaraweera
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can somebody helps to identify the design pattern to be applied for this sample scenario?

Education Institute A has student management system written using Java.
A has acquired another institute called B and plan to integrate Bs student management system with theirs'.

It is found that logic used to calculate student gpa is different.
Can we use composite pattern to solve this problem?If yes how?
Or we should use strategy pattern?

Thanks,
Isuru
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My gut reaction was that the composite pattern isn't the right one. But then I thought about it some more. How does this work if a student has grades from both institutions? For example, a student takes 5 classes at A before the merge and then takes them at a mix of A and B. Which rule is used. Even then, I don' think the composite pattern is correct though because it would probably be a separate algorithm rather than "compute GPA for A, compute GPA for B and merge".
 
Isuru Samaraweera
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,
Thanks for the reply.Just assume courses and GPA is still calculated separately.Each institute's student takes only the courses from only that institute.Only the gpa calculation algorithm changes.

So my guess is that strategy is the right answer there is no way you'll find a whole part relationship to apply composite pattern

Thanks
Isuru
 
Mike Degteariov
Ranch Hand
Posts: 145
8
Java Mac MySQL Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that "strategy" pattern, which is about interchangeable implementations that differ only by algorithm,is applicable here.

PS don't trust answers provided by mock exam producers. While the questions of some mock exams are reasonably close to those in real exam, it has been reported many times that the answers provided are very inaccurate.

--
Cheers, Mike

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isuru Samaraweera wrote:Hi Jeanne,
Thanks for the reply.Just assume courses and GPA is still calculated separately.Each institute's student takes only the courses from only that institute.Only the gpa calculation algorithm changes.

So my guess is that strategy is the right answer there is no way you'll find a whole part relationship to apply composite pattern

Correct.

Mihail Degteariov wrote:PS don't trust answers provided by mock exam producers. While the questions of some mock exams are reasonably close to those in real exam, it has been reported many times that the answers provided are very inaccurate.

I think this problem is worse on the OCMJEA than some of the others. Architecture tradeoffs tend to be subjective. I've gotten some wrong because "in the real world" the answer is different than what the exam creators think.
 
Isuru Samaraweera
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,
Thanks for the clue.

Regards,
Isuru

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic