{"id":4926,"date":"2014-03-30T16:56:20","date_gmt":"2014-03-30T16:56:20","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/when-to-call-a-reference-property-delegate-collection-of-common-programming-errors\/"},"modified":"2014-03-30T16:56:20","modified_gmt":"2014-03-30T16:56:20","slug":"when-to-call-a-reference-property-delegate-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/when-to-call-a-reference-property-delegate-collection-of-common-programming-errors\/","title":{"rendered":"When to call a reference property &ldquo;delegate&rdquo;?-Collection of common programming errors"},"content":{"rendered":"<blockquote>\n<p>I know what delegation is and how it works but for me parentController is a more meaningful name. delegate, that could just be anything.<\/p>\n<\/blockquote>\n<p>I think you&#8217;ve answered your own question here. A <em>delegate<\/em> is a helper object that &#8220;could just be anything&#8221; as far as the delegating class is concerned. The name <em>parentController<\/em> assumes something specific about the relationship between the two objects. If you know that that relationship will always exist, then it&#8217;s appropriate to use that name. On the other hand, if the two objects only happen to have that relationship, but the relationship isn&#8217;t important to the fact that one object is using the other as a helper, then use <em>delegate<\/em> (or something similar).<\/p>\n<p>So, is it necessary that the objects in question have a parent\/child relationship? Are you sending messages to <code>parentViewController<\/code> specifically because it&#8217;s the parent? Or is it conceivable that some other object could respond to the same messages?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I know what delegation is and how it works but for me parentController is a more meaningful name. delegate, that could just be anything. I think you&#8217;ve answered your own question here. A delegate is a helper object that &#8220;could just be anything&#8221; as far as the delegating class is concerned. The name parentController assumes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4926","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4926"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4926\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}