{"id":110,"date":"2008-08-15T17:19:53","date_gmt":"2008-08-15T22:19:53","guid":{"rendered":"http:\/\/vgable.com\/blog\/2008\/08\/15\/members-are-the-devil\/"},"modified":"2008-08-15T17:19:55","modified_gmt":"2008-08-15T22:19:55","slug":"members-are-the-devil","status":"publish","type":"post","link":"https:\/\/vgable.com\/blog\/2008\/08\/15\/members-are-the-devil\/","title":{"rendered":"Members Are The Devil"},"content":{"rendered":"<p>More and more, I am of the opinion that a member-variable is a <em>terrible<\/em> thing to have in a class.  Put more sanely, <strong>a class should have as few member variables as possible<\/strong>.<\/p>\n<p>I have squashed too many bugs in the past couple of months, where two objects had their own fields that represented <em>the same thing<\/em> .. but then got out of synch.  Only one object should ever <em>store<\/em> the same value.<\/p>\n<p>I guess you could say this is <a href=\"http:\/\/www.codinghorror.com\/blog\/archives\/001152.html\">database-normalization<\/a>, applied to general programming.  And I think in that space it makes more sense.<\/p>\n<p>A corollary is, <strong>never cache a value that can be calculated, without a measured performance reason<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>More and more, I am of the opinion that a member-variable is a terrible thing to have in a class. Put more sanely, a class should have as few member variables as possible. I have squashed too many bugs in the past couple of months, where two objects had their own fields that represented the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,12,4],"tags":[],"class_list":["post-110","post","type-post","status-publish","format-standard","hentry","category-bug-bite","category-design","category-programming"],"_links":{"self":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/comments?post=110"}],"version-history":[{"count":0,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/110\/revisions"}],"wp:attachment":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/media?parent=110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/categories?post=110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/tags?post=110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}