Connecting Tech Pros Worldwide Forums | Help | Site Map

Select design pattern which allow extrapolate repeat of code in separate classes

Member
 
Join Date: Sep 2007
Posts: 77
#1: Jul 7 '08
....
...
...

Both of the procedures have repeating sections of code: sending an e-mail and adding a log entry.

Task:
*1.Select a design pattern (substantiate your choice) that would allow extrapolating repeating sections of code in separate classes
2.The selected programming pattern must support the appropriate level of abstraction to allow for additional handlers (ie. marketing modules) to be hooked into any business procedure.

Anyone can give me some advise? use which design pattern?
After I choose the specific design pattern, do you think i need to write the code
as well? I not sure what this task want me to do. thanks.

DrBunchman's Avatar
Moderator
 
Join Date: Jan 2008
Location: Winchester, UK
Posts: 930
#2: Jul 7 '08

re: Select design pattern which allow extrapolate repeat of code in separate classes


Hi perhapscwk,

The question doesn't ask you to write any code but then I'd double check with whoever set you the work to be sure. As for the design pattern I'd have thought that your own classes/text books will give you a better idea of the sort of answer that is expected here - I presume that you've had some lessons on this stuff?

Dr B
Member
 
Join Date: Sep 2007
Posts: 77
#3: Jul 7 '08

re: Select design pattern which allow extrapolate repeat of code in separate classes


Quote:

Originally Posted by DrBunchman

Hi perhapscwk,

The question doesn't ask you to write any code but then I'd double check with whoever set you the work to be sure. As for the design pattern I'd have thought that your own classes/text books will give you a better idea of the sort of answer that is expected here - I presume that you've had some lessons on this stuff?

Dr B

I go to interview and this question is one of the test question..I fail it.
SO want to know how to answer. thanks.
DrBunchman's Avatar
Moderator
 
Join Date: Jan 2008
Location: Winchester, UK
Posts: 930
#4: Jul 7 '08

re: Select design pattern which allow extrapolate repeat of code in separate classes


Ah I see, sorry to hear that and sorry I can't help you here.

Dr B
Member
 
Join Date: Sep 2007
Posts: 77
#5: Jul 7 '08

re: Select design pattern which allow extrapolate repeat of code in separate classes


anyone can help?

thanks.
DrBunchman's Avatar
Moderator
 
Join Date: Jan 2008
Location: Winchester, UK
Posts: 930
#6: Jul 8 '08

re: Select design pattern which allow extrapolate repeat of code in separate classes


Moved to the Software Development Forum - you might get a bit more general exposure here.
Nepomuk's Avatar
Moderator
 
Join Date: Aug 2007
Location: Germany
Posts: 2,466
#7: Jul 8 '08

re: Select design pattern which allow extrapolate repeat of code in separate classes


Quote:

Originally Posted by perhapscwk

....
...
...

Both of the procedures have repeating sections of code: sending an e-mail and adding a log entry.

Task:
*1.Select a design pattern (substantiate your choice) that would allow extrapolating repeating sections of code in separate classes
2.The selected programming pattern must support the appropriate level of abstraction to allow for additional handlers (ie. marketing modules) to be hooked into any business procedure.

Anyone can give me some advise? use which design pattern?
After I choose the specific design pattern, do you think i need to write the code
as well? I not sure what this task want me to do. thanks.

Sounds to me like generic programming, maybe combined with Inheritance. This would allow "repeating sections of code in seperate classes" (e.g. addText(string blabla) or setTextFormat(char format)) and have "the appropriate level of abstraction to allow for additional handlers" (e.g. setEMailAddress(string address) or postComment()) to be added.

I don't know, if such an answer was requested, but it's what I would answer in short.

Greetings,
Nepomuk
Reply