{"id":2000,"date":"2013-01-20T16:54:53","date_gmt":"2013-01-20T21:54:53","guid":{"rendered":"http:\/\/scientopia.org\/blogs\/goodmath\/?p=2000"},"modified":"2013-01-20T16:54:53","modified_gmt":"2013-01-20T21:54:53","slug":"static-typing-give-me-a-break","status":"publish","type":"post","link":"http:\/\/www.goodmath.org\/blog\/2013\/01\/20\/static-typing-give-me-a-break\/","title":{"rendered":"Static Typing: Give me a break!"},"content":{"rendered":"<p> I&#8217;m a software engineer. I write code for a living. I&#8217;m also a programming language junkie. I love programming languages. I&#8217;m <emph>obsessed<\/emph> with programming languages. I&#8217;ve taught myself more programming languages than any sane person has any reason to know. <\/p>\n<p> Learning that many languages, I&#8217;ve developed some pretty strong opinions about what makes a good language, and  what kind of things I really want to see in the languages that I use.<\/p>\n<p> My number one preference: strong static typing. That&#8217;s part of a more general preference, for preserving information. When I&#8217;m programming, I <em>know<\/em> what kind of thing I expect in a parameter, and I know what I expect to return. When I&#8217;m programming in a weakly typed language, I find that I&#8217;m constantly throwing information away, because I can&#8217;t actually <em>say<\/em> what I know about the program. I can&#8217;t put my knowledge about the expected behavior into the code. I don&#8217;t think that that&#8217;s a good thing.\n<\/p>\n<p> But&#8230; (you knew there was a but coming, didn&#8217;t you?)<\/p>\n<p> This is <em>my preference<\/em>. I believe that it&#8217;s right, but I also believe that reasonable people can disagree. Just because you don&#8217;t think the same way that I do doesn&#8217;t mean that you&#8217;re an idiot. It&#8217;s entirely possible for someone to know as much as I do about programming languages and have a different opinion. We&#8217;re talking about <em>preferences<\/em>. <\/p>\n<p> Sadly, that kind of attitude is something that is entirely too uncommon. I seriously wonder somethings if I&#8217;m crazy, because it seems like everywhere I look, on every topic, no matter how trivial, most people absolutely reject the idea that it&#8217;s possible for an intelligent, knowledgeable person to disagree with them. It doesn&#8217;t matter what the subject is: politics, religion, music, or programming languages.<\/p>\n<p> What brought this little rant on is that someone sent me a link to a comic, called &#8220;Cartesian Closed Comic&#8221;. It&#8217;s a programming language geek comic. But what bugs me is <a href=\"http:\/\/ro-che.info\/ccc\/17.html\">this comic<\/a>. Which seems to be utterly typical of the kind of attitude that I&#8217;m griping about.<\/p>\n<p> See, this is a pseudo-humorous way of saying &#8220;Everyone who disagrees with me is an idiot&#8221;. It&#8217;s not that reasonable people can disagree. It&#8217;s that people who disagree with me only disagree because they&#8217;re ignorant. If you like static typing, you probably know type theory. If you don&#8217;t like static typing, that there&#8217;s almost no chance that you know anything about type theory. So the reason that those stupid dynamic typing people don&#8217;t agree with people like me is because they just don&#8217;t know as much as I do. And the reason that arguments with them don&#8217;t go anywhere isn&#8217;t because we have different subjective preferences: it&#8217;s because they&#8217;re just too ignorant to understand why I&#8217;m right and they&#8217;re wrong.<\/p>\n<p> Everything about this argument is crap, and it pisses me off.<\/p>\n<p> Most programmers &#8211; whether they prefer static typing or not &#8211; don&#8217;t know type theory. Most of the arguments about whether to use static or dynamic typing aren&#8217;t based on type theory. It&#8217;s just the same old snobbery, the &#8220;you can&#8217;t disagree with me unless you&#8217;re an idiot&#8221;.<\/p>\n<p> Among intelligent skilled engineers, the static versus dynamic typing thing really comes down to a simple, subjective argument:\n<\/p>\n<p> Static typing proponents believe that expressing intentions in a static checkable form is worth the additional effort of making all of the code type-correct.<\/p>\n<p> Dynamic typing proponents believe that it&#8217;s not: that strong typing creates an additional hoop that the programmer needs to jump through in order to get a working system.<\/p>\n<p> Who&#8217;s right? In fact, I don&#8217;t think that either side is universally right. Building a real working system is a complex thing. There&#8217;s a complex interplay of design, implementation, and testing. What static typing really does is take some amount of stuff that could be checked with testing, and allows the compiler the check it in an abstract way, instead of with specific tests.\n<\/p>\n<p> Is it easier to write code with type declarations, or with additional tests? Depends on the engineers  and the system that they&#8217;re building.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m a software engineer. I write code for a living. I&#8217;m also a programming language junkie. I love programming languages. I&#8217;m obsessed with programming languages. I&#8217;ve taught myself more programming languages than any sane person has any reason to know. Learning that many languages, I&#8217;ve developed some pretty strong opinions about what makes a good [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[],"class_list":["post-2000","post","type-post","status-publish","format-standard","hentry","category-bad-software"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4lzZS-wg","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts\/2000","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/comments?post=2000"}],"version-history":[{"count":0,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts\/2000\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/media?parent=2000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/categories?post=2000"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/tags?post=2000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}