tag:blogger.com,1999:blog-10345428.post4091744866364151767..comments2023-09-27T00:29:23.437-07:00Comments on Making programming pay: Generics - An OO Anti-PatternPaul Beckfordhttp://www.blogger.com/profile/16046651614960778254noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-10345428.post-51559584676603857252015-09-21T22:19:14.895-07:002015-09-21T22:19:14.895-07:00You said "To know what a program does, what y...You said "To know what a program does, what you should do is run it (test it)."<br /><br />This is a complete misunderstanding of computing science, I'm afraid. When you write in your program x := 1 + 1 do you need to test it to figure out that x will be assigned a value of 2? Testing this would be a complete waste of time since you can formally verify it in your brain in 2 seconds or less...<br /><br />I'm afraid you've fallen into the same trap as the Royal Surgeons did back in the day when sterilizing your surgery utensils was considered a waste of time... You don't want to sterilize your code with formal type systems because it's a waste of time... Hint hint: writing millions upon millions of unit tests is a waste of time, when one quick formal verification takes only a few seconds. <br /><br />True, complex programs are much harder to verify, but you can verify a lot of the program ahead of time and literally run the code inside your head and verify it will work mostly, before even hitting the compile button (or the run button). If you don't know what your code should end up doing and you have to run/test it to find out, you should seriously consider leaving the programming industry for another career like trial and error engineering. But even engineers use formal methods such as mathematical calculations with well known proven formulas, to construct their bridges, buildings, traffic systems, chemical plants... No no it's not all a bunch of trial and error buffoonery.<br /><br />Are you seriously saying that one cannot understand his own program, until he runs it and sees what magic happens. Hint: determinism, deterministic, turing machine. Input, Output. Predeterminism.<br /><br />It's not magic.Retarded Engineershttps://www.blogger.com/profile/00415876211261234010noreply@blogger.comtag:blogger.com,1999:blog-10345428.post-3113300221624322422015-06-19T01:17:39.130-07:002015-06-19T01:17:39.130-07:00Hi Yardena,
I'm reviewing my blog on its 10th...Hi Yardena,<br /><br />I'm reviewing my blog on its 10th year anniversary, and looking back there is a lot I got wrong :) I think this post was about the worst though :) Yes you were absolutely correct, that OO and Generics are orthogonal concerns and can work together well if implemented properly. Betrand Meyer describes how:<br /><br />http://c2.com/cgi/wiki?GenericsVsSubtyping<br /><br />Looking back, I wonder why I was so hostile to the idea? Well I'm guessing that I was still shell shocked by prior experiences with C++ and the STL :) Plus Java 1.5 doesn't implement Generics very well, the Scala type system with its ability to express covariance and contra-variance does a much better job (not to mention Java's type erasure at runtime :))<br /><br />Now having been exposed some to much better type systems (like the on in Haskell), I now see that type systems can be really useful as a way of reasoning about the correctness of your code.<br /><br />At the time of writing this, I hadn't done any functional programming, and had only experienced type systems as a pain that mostly got in the way of the computational (OO) model. With dynamic languages that pain just wasn't there.<br /><br />Paul.Paul Beckfordhttps://www.blogger.com/profile/16046651614960778254noreply@blogger.comtag:blogger.com,1999:blog-10345428.post-19228631299038546712008-04-10T13:16:00.000-07:002008-04-10T13:16:00.000-07:00Hi Yardena,No, I wasn't aware of this. I'm not sur...Hi Yardena,<BR/><BR/>No, I wasn't aware of this. I'm not sure there is a big gap between Alan Kay and Smalltalk, and David Ungar and Randall Smith with Self and the Scandinavian view as stated here. <BR/><BR/>The gap between the Scandinavian view and Bjarne Stroustrups' view and C++ seems much larger to me. Stroustrups approach is very pragmatic:). And you know Alan Kays attitude to C++ :)<BR/><BR/>So is it the Americans versus the Scandinavians..? I don't know.<BR/><BR/>Thanks for the link, interesting...Paul Beckfordhttps://www.blogger.com/profile/16046651614960778254noreply@blogger.comtag:blogger.com,1999:blog-10345428.post-24686212830617214782008-04-10T10:59:00.000-07:002008-04-10T10:59:00.000-07:00Hi Paul,Yes, I came across Alan Kay's quote on OO ...Hi Paul,<BR/><BR/>Yes, I came across Alan Kay's quote on OO and C++ in the past :-) If you don't already know this, <A HREF="http://ootips.org/history.html" REL="nofollow">"Scandinavian vs. American"</A> approaches to object orientation may be of an interest for you - another thing I came across quite recently after hearing the terms several times.Yardenahttps://www.blogger.com/profile/15649241856669571499noreply@blogger.comtag:blogger.com,1999:blog-10345428.post-32538188559539353022008-04-10T10:31:00.000-07:002008-04-10T10:31:00.000-07:00Hi Yardena,I understand. I'm somewhat biased :) Ar...Hi Yardena,<BR/><BR/>I understand. I'm somewhat biased :) Artima ran an Article recently that makes the same point:<BR/><BR/>http://www.artima.com/cppsource/type_erasure.html<BR/><BR/>BTW. Alan Kay who coined the term "Object Orientation" is quoted to have said that when he coined the term he didn't have in mind C++.<BR/><BR/>The meaning of the term OO has been stretched and re-interpreted in many ways. I guess I should make it clear that I am referring to the original concept as pioneered at Xerox ParcPlace in the 1970's by Alan Kay and his team when designing the Smalltalk language.<BR/><BR/>Thanks for the interest.Paul Beckfordhttps://www.blogger.com/profile/16046651614960778254noreply@blogger.comtag:blogger.com,1999:blog-10345428.post-83221428461622692362008-04-10T07:37:00.000-07:002008-04-10T07:37:00.000-07:00Hi Paul,I enjoy reading your blog for some time no...Hi Paul,<BR/><BR/>I enjoy reading your blog for some time now. <BR/><BR/>Regarding this post, I think it's rather about static versus dynamic typing and not OO. Smalltalk is a dynamic language, Java is not. Generics were enhancement of the compiler with the goal of making type checking even more strict, so you advocate dynamic typing and Generics is the opposite direction, obviously. <BR/><BR/>I'm not necessarily disagreeing on the advantages of dynamic systems, but I find the terminology in this post somewhat confusing.<BR/><BR/>Keep up blogging!Yardenahttps://www.blogger.com/profile/15649241856669571499noreply@blogger.com