{"id":276,"date":"2010-07-19T12:43:16","date_gmt":"2010-07-19T19:43:16","guid":{"rendered":"http:\/\/www.jacksonleung.com\/blog\/?p=276"},"modified":"2010-07-19T12:43:16","modified_gmt":"2010-07-19T19:43:16","slug":"reducing-learning-curve-overhead-with-oop","status":"publish","type":"post","link":"http:\/\/www.jacksonleung.com\/blog\/reducing-learning-curve-overhead-with-oop\/","title":{"rendered":"Reducing Learning Curve Overhead with OOP"},"content":{"rendered":"<p>A lot of people don&#8217;t understand why object-oriented programming (OOP) practices are getting so much hype. While I can&#8217;t explain all the benefits of using OOP in this article, I will cover one of the compelling cases of using OOP, you save time.<\/p>\n<p>Imagine a scenario where a new recruit has just joined your ranks. He was hired into your team to speed up your project. If your code wasn&#8217;t designed in an OOP manner, then he&#8217;ll most likely have to review a good chunk of the code in order to figure out what&#8217;s going on and how the various pieces interconnect. Some code at line 23 might be affecting line 83. Some function might take 2 integers and behave one way, and then take in 3 arrays and behave another. The code might also require certain global parameters to be set in a certain sequence before things can function.<\/p>\n<p>In OOP programming, things you don&#8217;t need to know, you don&#8217;t need to know. For example, if you were coding a shopping cart, the &#8220;scanning system&#8221; only cares to know about the price of the item. The &#8220;product&#8221; object only needs to know it&#8217;s &#8220;price&#8221;. The &#8220;shopper&#8221; only cares about the price and the total. Each of these objects can have various complex behaviors, but they&#8217;re all encapsulated within the object. For example if the &#8220;product&#8221; was perishable, and price was a function of it&#8217;s expiration, the &#8220;scanning system&#8221; and &#8220;shopper&#8221; doesn&#8217;t need to know about this. If you were to adjust how various item&#8217;s price fluctuates, you only need to focus on &#8220;product&#8221; classes. <\/p>\n<p>Whereas, in a non-OOP class, you might a very long file, class, or function, and it might be filled with all these complex checks to figure out how much the price is, but in an OOP system, the &#8220;scanning system&#8221; simply asks the &#8220;product&#8221; for it&#8217;s price. OOP code is also more intuitive, since OOP mimics real world objects and relationships.<\/p>\n<p>OOP practices are good to adopt, although there is some overhead, there will definitely be long-term savings in more ways than one.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A lot of people don&#8217;t understand why object-oriented programming (OOP) practices are getting so much hype. While I can&#8217;t explain all the benefits of using OOP in this article, I will cover one of the compelling cases of using OOP, you save time. Imagine a scenario where a new recruit has just joined your ranks. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.jacksonleung.com\/blog\/reducing-learning-curve-overhead-with-oop\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Reducing Learning Curve Overhead with OOP&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-276","post","type-post","status-publish","format-standard","hentry","category-programming","entry"],"_links":{"self":[{"href":"http:\/\/www.jacksonleung.com\/blog\/wp-json\/wp\/v2\/posts\/276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.jacksonleung.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jacksonleung.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jacksonleung.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jacksonleung.com\/blog\/wp-json\/wp\/v2\/comments?post=276"}],"version-history":[{"count":2,"href":"http:\/\/www.jacksonleung.com\/blog\/wp-json\/wp\/v2\/posts\/276\/revisions"}],"predecessor-version":[{"id":298,"href":"http:\/\/www.jacksonleung.com\/blog\/wp-json\/wp\/v2\/posts\/276\/revisions\/298"}],"wp:attachment":[{"href":"http:\/\/www.jacksonleung.com\/blog\/wp-json\/wp\/v2\/media?parent=276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jacksonleung.com\/blog\/wp-json\/wp\/v2\/categories?post=276"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jacksonleung.com\/blog\/wp-json\/wp\/v2\/tags?post=276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}