{"id":226,"date":"2009-08-07T17:47:52","date_gmt":"2009-08-08T01:47:52","guid":{"rendered":"http:\/\/eschatologist.net\/blog\/?p=226"},"modified":"2009-08-07T17:49:16","modified_gmt":"2009-08-08T01:49:16","slug":"rebutting-big-nerd-ranch-on-objective-c-2-0-dot-notation","status":"publish","type":"post","link":"https:\/\/eschatologist.net\/blog\/?p=226","title":{"rendered":"Rebutting Big Nerd Ranch on Objective-C 2.0 dot notation"},"content":{"rendered":"<p>The <a href=\"http:\/\/weblog.bignerdranch.com\/\">Big Nerd Ranch weblog<\/a> has <a href=\"http:\/\/weblog.bignerdranch.com\/?p=83\">a new post about Objective-C 2.0 dot notation<\/a>.  They advocate <em>never using it<\/em> and they&#8217;re <em>completely wrong<\/em>.<\/p>\n<p>Given <a href=\"https:\/\/twitter.com\/eschaton\/status\/3175342818\">my reaction on Twitter<\/a>, several people have asked me to write a more in-depth rebuttal.<\/p>\n<p>I&#8217;ve already addressed <a href=\"https:\/\/eschatologist.net\/blog\/?p=160\">when and why you <strong>should<\/strong> use Objective-C 2.0 properties and dot notation<\/a> in an earlier post, so I won&#8217;t go into that here.  I&#8217;ll just repeat my response to their weblog.<\/p>\n<p>Here&#8217;s what I wrote in response:<\/p>\n<p>> I disagree most emphatically. The whole point of dot notation is that, when combined with properties, it\u00e2\u20ac\u2122s not *just* an alternative syntax for invoking methods. In fact, if that\u00e2\u20ac\u2122s how you think about dot syntax, STOP. That\u00e2\u20ac\u2122s not what it\u00e2\u20ac\u2122s for at all.<br \/>\n><br \/>\n> What dot syntax and property declarations are for is separating object *state* from object *behavior*. Classical OOP only really defines objects as only exposing behavior but the past 30+ years have demonstrated rather aptly that objects consist of both. C# was actually pioneering in this; its concept of properties is rather similar to what the combination of property declarations and dot syntax enable in Objective-C.<br \/>\n><br \/>\n> To write idiomatic Objective-C 2.0 you should use `@property` to declare properties, and use dot syntax to access them. Period. Doing otherwise is a bad idea because it will create code that isn\u00e2\u20ac\u2122t intention-revealing to other experienced Objective-C 2.0 developers. Teaching students to do otherwise is doing them a disservice, because you\u00e2\u20ac\u2122re directly contradicting those responsible for the language and its evolution.<\/p>\n<p>In short, Objective-C 2.0 has properties and dot notation as another way of expressing intent in your code.  Use them for that, don&#8217;t refuse to use them just because they weren&#8217;t in earlier versions of the language, or because they require teaching another concept.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Big Nerd Ranch weblog has a new post about Objective-C 2.0 dot notation. They advocate never using it and they&#8217;re completely wrong. Given my reaction on Twitter, several people have asked me to write a more in-depth rebuttal. I&#8217;ve already addressed when and why you should use Objective-C 2.0 properties and dot notation in&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","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":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3],"tags":[9,84,4,18,123,22],"class_list":["post-226","post","type-post","status-publish","format-standard","hentry","category-technology","tag-cocoa","tag-iphone","tag-mac","tag-objective-c","tag-oop","tag-programming"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p74loH-3E","_links":{"self":[{"href":"https:\/\/eschatologist.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/226","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eschatologist.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eschatologist.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eschatologist.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/eschatologist.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=226"}],"version-history":[{"count":3,"href":"https:\/\/eschatologist.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/226\/revisions"}],"predecessor-version":[{"id":229,"href":"https:\/\/eschatologist.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/226\/revisions\/229"}],"wp:attachment":[{"href":"https:\/\/eschatologist.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eschatologist.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eschatologist.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}