tag:blogger.com,1999:blog-739580098595224395.post2752182551639081803..comments2023-10-28T08:35:36.315-07:00Comments on Last of the Careless Men: Insanity of Anti-If CampaignUnknownnoreply@blogger.comBlogger4125tag:blogger.com,1999:blog-739580098595224395.post-27166328929197910702010-03-17T10:20:19.586-07:002010-03-17T10:20:19.586-07:00Hi, the point of the Anti-IF campaign is to sugges...Hi, the point of the Anti-IF campaign is to suggest that changing code is not the only way to cope with changing requirements. I can tell you that the average programmer in the field does not even *suspect* that, in principle, you should get to a point where new requirements are met by adding code, not changing it.<br /><br />Pattern-happy programmers have a different problem, but the goal is the same for every programmer, to get to a design that's robust wrt requirement changes and simple at the same time.xpmatteohttps://www.blogger.com/profile/16626755265235840659noreply@blogger.comtag:blogger.com,1999:blog-739580098595224395.post-17868197192205002352010-03-17T06:55:06.733-07:002010-03-17T06:55:06.733-07:00Ok, maybe it's the fact that I'm out of pr...Ok, maybe it's the fact that I'm out of practice with Perl, or maybe I'm misunderstanding your example, but why would you even consider using a Visitor here? Visitor is intended to simulate double-dispatch in languagdes that don't provide it out-of-the-box. I fail to see why you'd need that capability here.<br /><br />Why not just:<br /><br />my $use_exact_calculations = $surface.uses_exact_calculatons<br /><br />Usually, when I see control code based on the type of an argument, it indicates to me that there may be a misallocation of responsibility. In this case, I'd probably want to ask the plane to supply a calculation algorithm.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-739580098595224395.post-85833878582416812412010-03-17T06:39:37.067-07:002010-03-17T06:39:37.067-07:00The problem with the if-elses are that you can'...The problem with the if-elses are that you can't define a concept using them, I'm a human not a machine, machines are very good on understanding if-else-elseif-switch etc but as a human I need something different: this object model this concept and send a message to this other obj that models..and so on... This doesn't mean that you never write if-elses, that is impossible because if-elses are at the heart of computer processing but as a human you must model the world by expressing concepts not using machine language.Indrit Selimihttps://www.blogger.com/profile/00258618073806409568noreply@blogger.comtag:blogger.com,1999:blog-739580098595224395.post-68162352883828007572010-03-17T04:38:16.546-07:002010-03-17T04:38:16.546-07:00The point of the Anti-If Campaign it not to never ...The point of the Anti-If Campaign it not to never use if:s, it is to think twice before using them. Or as their web page says it; <br /><br />"The primary purpose of our campaign is to become aware of the design consequences of using IFs and of control structures in general, applied by following the path of the procedural paradigm in Object Oriented contexts. This greater awareness will enable you to understand how to achieve more effective results in terms of flexibility, comprehensibility, testability, and ability to evolve."Tommyhttps://www.blogger.com/profile/02987079709890896170noreply@blogger.com