tag:blogger.com,1999:blog-14570545.post115005073996668177..comments2023-10-03T14:02:23.078+02:00Comments on Thoughts and Fragments: Solving Method Contract ProblemsSergio Bossahttp://www.blogger.com/profile/09315991044338298083noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-14570545.post-1151948827485536612006-07-03T19:47:00.000+02:002006-07-03T19:47:00.000+02:00Hi Alessio,thanks for your answer.> Regarding the ...Hi Alessio,<BR/><BR/>thanks for your answer.<BR/><BR/>> Regarding the fact we have MilitaryClock <BR/>> and MilitaryDisplay, and StandardClock <BR/>> and <BR/>> StandardDisplay, maybe an <BR/>> AbstractFactory <BR/>> could be a solution.<BR/><BR/>Using an AbstractFactory gives you a different solution for a different usage context.<BR/><BR/>When you have a single Display class and many Clocks, Sergio Bossahttps://www.blogger.com/profile/09315991044338298083noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1151936967202945882006-07-03T16:29:00.000+02:002006-07-03T16:29:00.000+02:00Hi Sergio,for the interfaces weak constraints in d...Hi Sergio,<BR/><BR/>for the interfaces weak constraints in documentation, I agree they are good but maybe not enough, but that's the most we can have actually :-)<BR/><BR/>For what regards the example of Clock and Display, as long as we don't have a displayTime method which does if/else on the possible concrete type of the Clock paramater, it could be just a matter of taste :-) Regarding the Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1150543680839780902006-06-17T13:28:00.000+02:002006-06-17T13:28:00.000+02:00Dmitriy said ...> Visitor works, but I feel (only ...Dmitriy said ...<BR/><BR/>> Visitor works, but I feel (only my <BR/>> personal opinion) that Visitor is <BR/>> a complex pattern and might <BR/>> introduce <BR/>> unwanted complexity for the <BR/>> problems <BR/>> that are not complex to solve <BR/>> themselves.<BR/><BR/>Yes, I agree, it might be more difficult to implement, even if I think its major drawback is that you have to change the Sergio Bossahttps://www.blogger.com/profile/09315991044338298083noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1150513163538198202006-06-17T04:59:00.000+02:002006-06-17T04:59:00.000+02:00Sergio,Visitor works, but I feel (only my personal...Sergio,<BR/><BR/>Visitor works, but I feel (only my personal opinion) that Visitor is a complex pattern and might introduce unwanted complexity for the problems that are not complex to solve themselves. The example of CoR that I showed deviates from the classic "GoF" structure and uses simpler "Dispatcher" that handles the "chain" itself.<BR/><BR/>The main point though is that the main principle Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1150443099946286002006-06-16T09:31:00.000+02:002006-06-16T09:31:00.000+02:00Errata: Obviously, StandardClock and MilitaryClock...Errata: <BR/><BR/>Obviously, StandardClock and MilitaryClock both implement the Clock interface!Sergio Bossahttps://www.blogger.com/profile/09315991044338298083noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1150442872301361522006-06-16T09:27:00.000+02:002006-06-16T09:27:00.000+02:00Hi Dmitriy,thanks for your answer.> Perhaps anothe...Hi Dmitriy,<BR/><BR/>thanks for your answer.<BR/><BR/>> Perhaps another solution would be <BR/>> to <BR/>> use "Chain of Responsibility" <BR/>> pattern, that is have different <BR/>> Display handlers that know how to <BR/>> handle a particular type of a <BR/>> Clock. <BR/>> For example: [CUT]<BR/><BR/>I see your point, but I think that the "Chain of Responsibility" pattern is better suited for Sergio Bossahttps://www.blogger.com/profile/09315991044338298083noreply@blogger.comtag:blogger.com,1999:blog-14570545.post-1150422828341486112006-06-16T03:53:00.000+02:002006-06-16T03:53:00.000+02:00Perhaps another solution would be to use "Chain of...Perhaps another solution would be to use "Chain of Responsibility" pattern, that is have different Display handlers that know how to handle a particular type of a Clock. For example:<BR/><BR/>DisplayDispatcher implements Display {<BR/> <BR/> private List displays = new LinkedList Display();<BR/><BR/>public void setDisplays(List displays) {<BR/>this.displays = displays;<BR/>}<BR/> <BR/>public Anonymousnoreply@blogger.com