From: Barry K. <bk...@in...> - 2002-11-19 20:25:46
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <title></title> </head> <body> Nat Pryce wrote:<br> <blockquote type="cite" cite="mid...@ba..."> <pre wrap="">On Tue, 2002-11-19 at 16:54, Barry Kaplan wrote: </pre> <blockquote type="cite"> <pre wrap="">Nat Pryce wrote: </pre> <blockquote type="cite"> <pre wrap="">How do overloaded methods help you remove the if statements? </pre> </blockquote> <pre wrap="">Components of the system need to determine Position quantity based on the aspects Long/Short, Cash/Margin/etc, Daytrade/Overnight/etc. But for the most part, those components are closed to the actual values of these aspects -- they were constructed with the values. Those components do not even know what the values/subtypes of LongShort, etc are, but can use them to to lookup position quantities and perform their work. As the values/subtypes of LongShort etc are extended, the components are closed to those changes/extensions. I guess this description is kind of vague, but maybe it gets the point across (?). </pre> </blockquote> <pre wrap=""><!----> I'm still not sure why overloaded methods help avoid if statements, since to call the appropriate overloaded method your code must already have statically typed values to pass to the method. Therefore your code can just as easily call a method with a descriptive name as call a method with the same name as another method but different argument types.</pre> </blockquote> <br> Its not the overloaded methods per se. Its the parameterized getQuantity. It just so happens that getQuantity provides two sets of aspects on which to obtain the value. Thus I need to mock both methods.<br> <br> -bk<br> <br> </body> </html> |