From: topmind on 15 Jun 2005 00:35 I meant that particular example (bank accounts), not OO in general there. -T-
From: Dmitry A. Kazakov on 15 Jun 2005 03:40 On Tue, 14 Jun 2005 17:33:59 -0400, CTips wrote: > Robert C. Martin wrote: >> On Sun, 12 Jun 2005 07:27:44 -0400, CTips <ctips(a)bestweb.net> wrote: >> >>>This means that you need to know _ALL_ other shape sub-classes out there >>>before you can actually implement the function intersects(). >> >> Granted. And when you add new shapes you have to modify the >> intersection visitor. That's just part and parcel of the problem. > > However, you're now left with the issue that: > a) X & Y subclass shape adding X-shape & Y-shape > b) X & Y don't know about each other, so they don't add an > X_intersects_Y function > c) intersect(X_shape, Y_shape) gets called and results in a run-time crash. > > IOW: in most dynamic dispatch languages, the type-system is not strong > enough to ensure that at compile time [or some equivalent static > analysis phase] all functions are filled in. Further, since the > information about all subclasses of the type is not centralized, it is > non-trivial for a user to guarantee that each of these pair-wise > functions has been filled in. > > Contrast this to the implementation using a big-old-switch (of switches) > statement. Each shape will have a tag to control the switch() statement. > This tag will (probably) be an enumerated type. It is relatively > straightfoward for: > - the user to determine all the pairs that are required > - the compiler to spit out a waring regarding an unimplemented pair For this to work you have to define all types (combinations of parameters) in advance. The difference is that a subtype-based [polymorphic] solution does not require such, clearly impossible to impose requirement. Yes, the problem of siblings in MD is a difficult one. You're right that for a dynamically typed language it should be hard to get it right. Though in a statically typed one, I presume, it is solvable. For example, one could ensure that adding any new subtype would preserve consistency of the dispatching table. That is, all new cells (combinations of parameters) have to be defined this (inherited) or that (overridden) way. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
From: CTips on 15 Jun 2005 07:26 Isaac Gouy wrote: > CTips wrote: > >>What language are you using? Java? Out of curiosity, why isn't main in a >>class? Is this now legal in Java? > > > > Nice => http://nice.sourceforge.net/ > > (compiles to jvm bytecode) Spent some time with the manual. From a _quick_ reading, it looks like the way its been written may still provide too much information. Try //--- separate file import test.shape; void testIntersect(Shape s1, Shape s2){ s1.intersect(s2); } Also, does nice have separate compilation, or does it effectively "compile" a whole program at a time?
From: Robert C. Martin on 15 Jun 2005 08:20 On 14 Jun 2005 13:16:18 -0700, "topmind" <topmind(a)technologist.com> wrote: > >> >>Says the person who hasn't presented objective evidence >> >>supporting his position. >> > >> > It is my opinion that paradigm preference is largely a *subjective* >> > thing. Thus, there is not much to objectively prove either way. >> >> Then why do you keep asking for objective evidence from the OO guys? >> > >If you guys also believe the benefits of OO or poly are subjective >instead of absolute, then simply say so and then we are done. That is >not the message I get from youses. Correct. The benefits of OO (and polymorphism) are not subjective, they are objective. They are also situational, not universal. There are situations in which OO is objectively beneficial, and other situations in which it is not. These situations are *small*. E.g. they occur many times within any given module. Therefore the choice to use polymorphism will make sense many times within every module -- irrespective of the domain. ----- Robert C. Martin (Uncle Bob) | email: unclebob(a)objectmentor.com Object Mentor Inc. | blog: www.butunclebob.com The Agile Transition Experts | web: www.objectmentor.com 800-338-6716 "The aim of science is not to open the door to infinite wisdom, but to set a limit to infinite error." -- Bertolt Brecht, Life of Galileo
From: Robert C. Martin on 15 Jun 2005 08:23
On Wed, 15 Jun 2005 02:46:18 GMT, Jeff Brooks <jeff_brooks(a)nospam.com> wrote: >topmind wrote: >>>>>Says the person who hasn't presented objective evidence >>>>>supporting his position. >>>> >>>>It is my opinion that paradigm preference is largely a *subjective* >>>>thing. Thus, there is not much to objectively prove either way. >>> >>>Then why do you keep asking for objective evidence from the OO guys? >> >> If you guys also believe the benefits of OO or poly are subjective >> instead of absolute, then simply say so and then we are done. That is >> not the message I get from youses. > >"Making any claim about something being 'better' than something else >requires a way to measure 'better'. Currently we don't have a good way >to do it for the procedural vs OO debate so it's is nothing more than a >personal bias." I disagree. OO allows us to restructure dependencies in ways that are objectively superior in many situations. Consider, for example, plug-ins for Eclipse, or Active/X plugins for IE. The decoupling that these plugins enjoy (and that is essential for them to be effective) is provided by OO. ----- Robert C. Martin (Uncle Bob) | email: unclebob(a)objectmentor.com Object Mentor Inc. | blog: www.butunclebob.com The Agile Transition Experts | web: www.objectmentor.com 800-338-6716 "The aim of science is not to open the door to infinite wisdom, but to set a limit to infinite error." -- Bertolt Brecht, Life of Galileo |