{"id":131,"date":"2015-03-31T20:51:17","date_gmt":"2015-03-31T20:51:17","guid":{"rendered":"https:\/\/blogs.mathworks.com\/developer\/?p=131"},"modified":"2016-09-09T02:13:19","modified_gmt":"2016-09-09T02:13:19","slug":"dont-get-in-too-deep","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/developer\/2015\/03\/31\/dont-get-in-too-deep\/","title":{"rendered":"Don&#8217;t Get In Too Deep"},"content":{"rendered":"\r\n<div class=\"content\"><!--introduction--><p>The conventional wisdom these days seems to be that it is better to go deep, not wide. Whether this is in education, marketing, or general approaches to focused living, there seems to be an theme these days that if you favor breadth over depth the result will be shallow, without substance, and spread thin. The generalist it seems has seen better days in the court of public opinion. Is that true in life? I dunno, perhaps.<\/p><p>Well I'm here to denounce this approach when it comes to class design! Unfortunately, class hierarchies seem to find a way over time to get deeper and deeper. As these hierarchies grow deeper the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Coupling_(computer_programming)\">coupling<\/a> increases, and inheritance is a very strong form of coupling. The interface grows with each extension point, meaning that a class with 18 levels of superclasses likely has at least 18 methods which are called and used by even more clients. Often these clients only operate on a small part of the interface and yet an accidental coupling inevitably creeps in because it can. All clients have access to the entire interface rather than just the one thing they asked for.<\/p><p>Deep hierarchies also rely heavily on the categorization occurring correctly down through the subclasses and the generalization up through the superclasses. In theory this works great, because, well, we humans are naturally adept at categorizing things right? (<b>*cough cough<\/b>* <a href=\"https:\/\/blogs.mathworks.com\/developer\/files\/2015Platypus_by_Lewin.jpg\"><i>platypus<\/i><\/a> <b>*cough cough<\/b>*)<\/p><p>OK, so a platypus is a classic poster child for categorization gone wrong. Mammals are supposed to give live birth, right? Well, no of course, but this may be an easy mistake to make. You might say that a taxonomy which states that all mammals give live birth is an incorrect taxonomy, not a fundamental problem of taxonomies in general, and you'd be right. However, once a piece of software starts connecting and integrating with the rest of the software system changing your classification becomes difficult because you have clients that start to depend on this classification. Said another way, the 19 century taxonomy that did not correctly account for the platypus could be adjusted and corrected with the new information presented to it. However, it is not so easy to change software systems that are depended on by many downstream clients. Often times in software poor categorization decisions need to be lived with and worked around for a long time.<\/p><p>This happens All.The.Time.<\/p><!--\/introduction--><p><b>Deep Space<\/b><\/p><p>For example, take a look at a simple model of some celestial bodies. First let's start with the following classes which seem like a reasonable categorization:<\/p><pre class=\"language-matlab\"><span class=\"keyword\">classdef<\/span> CelestialBody\r\n    <span class=\"keyword\">properties<\/span>\r\n        Mass\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> GravitationallyRoundedBody &lt; CelestialBody\r\n    <span class=\"keyword\">properties<\/span>\r\n        Radius\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> Asteroid &lt; CelestialBody\r\n    <span class=\"keyword\">properties<\/span>\r\n        Shape\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> Moon &lt; GravitationallyRoundedBody\r\n    <span class=\"keyword\">properties<\/span>\r\n        HostPlanet\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> Star &lt; GravitationallyRoundedBody\r\n    <span class=\"keyword\">methods<\/span>\r\n        <span class=\"keyword\">function<\/span> radiate(star)\r\n        <span class=\"keyword\">end<\/span>\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> Planet &lt; GravitationallyRoundedBody\r\n    <span class=\"keyword\">properties<\/span>\r\n        Moons\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> TerrestrialPlanet &lt; Planet\r\n    <span class=\"keyword\">properties<\/span>\r\n        Crust\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> RingedPlanet &lt; Planet\r\n    <span class=\"keyword\">properties<\/span>\r\n        Rings\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> GasGiant &lt; RingedPlanet\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> IceGiant &lt; RingedPlanet\r\n<span class=\"keyword\">end<\/span>\r\n<\/pre><p>I went over to the file exchange and downloaded the <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/44742-umlgui\">UMLgui submission<\/a> so that we could visualize these classes a bit more easily (<b>Hint<\/b> you should too!). With this UI we can generate the following class diagram from this simple code:<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/2015DeepPlanetHierarchy.png\" alt=\"\"> <\/p><p>Everything here at first glance seems entirely rational. Go ahead and pick any spot in that hierarchy and ask yourself whether each class \"isa\" more specialized version of its superclass. Similarly, if you are a fan of <a href=\"http:\/\/en.wikipedia.org\/wiki\/Liskov_substitution_principle\">Liskov<\/a> there doesn't seem to be any obvious substitutability violations.<\/p><p><b>With This Ring...<\/b><\/p><p>However, we can easily poke some holes into this simple structure. For example, what about the rings? Well, this model worked quite well when you think about the planets in our own solar system, it is indeed the gas\/ice giants that have rings so it seems to work well...that is until NASA discovers that <a href=\"http:\/\/en.wikipedia.org\/wiki\/Rhea_(moon)\">Rhea<\/a> may have some rings!<\/p><p>Now we are placed in an unfortunate situation that is common with deep inheritance hierarchies. The problem here is that Rhea is a moon! We may have some code that operates on celestial bodies with rings and we'd like to support Rhea in such code. However, the class which defines what it means to have rings is actually a planet. Rhea can't (shouldn't!) derive from <b><tt>RingedPlanet<\/tt><\/b> because that would give Rhea moons! Furthermore, we can't move <b><tt>RingedPlanet<\/tt><\/b> higher in the hierarchy to allow Rhea to access this feature because then <b><tt>TerrestrialPlanet<\/tt><\/b> and <b><tt>Star<\/tt><\/b> would have rings, not to mention the fact that this would apply to all moons, not just rare moons like Rhea which (might?) contain them.<\/p><p>We can play this game with other features of the interface as well. What about crust? Most moons have a crust like the terrestrial planets, but how do we include the crust both above the <b><tt>Planet<\/tt><\/b> interface so that moons have access to this property as well as below the <b><tt>Planet<\/tt><\/b> interface so that the gas\/ice giants don't inherit it. How might we add an atmosphere to these models? The planets have one (oops! not Mercury) and the moons don't (wait, what about Titan?). Don't even think about looking outside of our own limited solar system, this structure will fall apart quickly. When we try to structure our classes in a pure hierarchy we inevitably fail as we see new requirements and try to apply our software structure to new features and ideas.<\/p><p>This example demonstrates the principle of favoring class hierarchies that are wide rather than deep. Shallow and wide hierarchies contain concrete classes that are coupled to a low number of superclasses. They can opt into precisely the interfaces they need without adding unnecessary baggage. These interfaces themselves can be small, scoped, and modular such that subclasses can pick and choose just the pieces of the interface that apply directly to them.<\/p><p>We can make this class structure much more flexible by flattening the hierarchy and bringing some of these key abilities into their own independent base classes. For example we can remove two levels of hierarchy and solve the problems discussed by simply pulling the gravitationally rounded properties and whether the body has rings their own independent interfaces. This looks like this:<\/p><pre class=\"language-matlab\"><span class=\"keyword\">classdef<\/span> CelestialBody\r\n    <span class=\"keyword\">properties<\/span>\r\n        Mass\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> Rounded\r\n    <span class=\"keyword\">properties<\/span>\r\n        Radius\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> Asteroid &lt; CelestialBody\r\n    <span class=\"keyword\">properties<\/span>\r\n        Shape\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> Moon &lt; CelestialBody &amp; Rounded\r\n    <span class=\"keyword\">properties<\/span>\r\n        HostPlanet\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> Star &lt; CelestialBody &amp; Rounded\r\n    <span class=\"keyword\">methods<\/span>\r\n        <span class=\"keyword\">function<\/span> radiate(star)\r\n        <span class=\"keyword\">end<\/span>\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> Planet &lt; CelestialBody &amp; Rounded\r\n    <span class=\"keyword\">properties<\/span>\r\n        Moons\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> TerrestrialPlanet &lt; Planet\r\n    <span class=\"keyword\">properties<\/span>\r\n        Crust\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> HasRings\r\n    <span class=\"keyword\">properties<\/span>\r\n        Rings\r\n    <span class=\"keyword\">end<\/span>\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> GasGiant &lt; Planet &amp; HasRings\r\n<span class=\"keyword\">end<\/span>\r\n\r\n<span class=\"keyword\">classdef<\/span> IceGiant &lt; Planet &amp; HasRings\r\n<span class=\"keyword\">end<\/span>\r\n<\/pre><p>This code produces the following hierarchy:<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/2015WidePlanetHierarchyLevel1.png\" alt=\"\"> <\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/2015WidePlanetHierarchyLevel2.png\" alt=\"\"> <\/p><p>With this structure, it becomes trivial to give a moon some rings!<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/2015RheaWithRings.jpg\" alt=\"\"> <\/p><p>Now there are some different strategies for flattening these hierarchies, but hopefully I've motivated the desire to keep them flat in the first place. We can work through some strategies in another post.<\/p><p>Do you have any deep hierarchy horror stories? How about feel good romances with nice shallow designs? Love to hear about em...<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_7d489a0d854a4ccab00e226b9d4cfc22() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='7d489a0d854a4ccab00e226b9d4cfc22 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 7d489a0d854a4ccab00e226b9d4cfc22';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2015 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_7d489a0d854a4ccab00e226b9d4cfc22()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2015a<br><\/p><\/div><!--\r\n7d489a0d854a4ccab00e226b9d4cfc22 ##### SOURCE BEGIN #####\r\n%% Don't Get In Too Deep\r\n%\r\n% The conventional wisdom these days seems to be that it is better to go\r\n% deep, not wide. Whether this is in education, marketing, or general\r\n% approaches to focused living, there seems to be an theme these days that\r\n% if you favor breadth over depth the result will be shallow, without\r\n% substance, and spread thin. The generalist it seems has seen better days\r\n% in the court of public opinion. Is that true in life? I dunno, perhaps.\r\n%\r\n% Well I'm here to denounce this approach when it comes to class design!\r\n% Unfortunately, class hierarchies seem to find a way over time to get\r\n% deeper and deeper. As these hierarchies grow deeper the\r\n% <http:\/\/en.wikipedia.org\/wiki\/Coupling_(computer_programming) coupling>\r\n% increases, and inheritance is a very strong form of coupling. The\r\n% interface grows with each extension point, meaning that a class with 18\r\n% levels of superclasses likely has at least 18 methods which are called\r\n% and used by even more clients. Often these clients only operate on a\r\n% small part of the interface and yet an accidental coupling inevitably\r\n% creeps in because it can. All clients have access to the entire interface\r\n% rather than just the one thing they asked for.\r\n%\r\n% Deep hierarchies also rely heavily on the categorization occurring\r\n% correctly down through the subclasses and the generalization up through\r\n% the superclasses. In theory this works great, because, well, we humans\r\n% are naturally adept at categorizing things right? (**cough cough**\r\n% <https:\/\/blogs.mathworks.com\/developer\/files\/2015Platypus_by_Lewin.jpg\r\n% _platypus_> **cough cough**)\r\n%\r\n% OK, so a platypus is a classic poster child for categorization gone\r\n% wrong. Mammals are supposed to give live birth, right? Well, no of\r\n% course, but this may be an easy mistake to make. You might say that a\r\n% taxonomy which states that all mammals give live birth is an incorrect\r\n% taxonomy, not a fundamental problem of taxonomies in general, and you'd\r\n% be right. However, once a piece of software starts connecting and\r\n% integrating with the rest of the software system changing your\r\n% classification becomes difficult because you have clients that start to\r\n% depend on this classification. Said another way, the 19 century taxonomy\r\n% that did not correctly account for the platypus could be adjusted and\r\n% corrected with the new information presented to it. However, it is not so\r\n% easy to change software systems that are depended on by many downstream\r\n% clients. Often times in software poor categorization decisions need to be\r\n% lived with and worked around for a long time.\r\n%\r\n% This happens All.The.Time.\r\n%\r\n%%\r\n% *Deep Space*\r\n%\r\n% For example, take a look at a simple model of some celestial bodies.\r\n% First let's start with the following classes which seem like a reasonable\r\n% categorization:\r\n%\r\n%   classdef CelestialBody\r\n%       properties\r\n%           Mass\r\n%       end\r\n%   end\r\n% \r\n%   classdef GravitationallyRoundedBody < CelestialBody\r\n%       properties\r\n%           Radius\r\n%       end\r\n%   end\r\n%\r\n%   classdef Asteroid < CelestialBody\r\n%       properties\r\n%           Shape\r\n%       end\r\n%   end\r\n%\r\n%   classdef Moon < GravitationallyRoundedBody\r\n%       properties\r\n%           HostPlanet\r\n%       end\r\n%   end\r\n%\r\n%   classdef Star < GravitationallyRoundedBody\r\n%       methods\r\n%           function radiate(star)\r\n%           end\r\n%       end\r\n%   end\r\n%\r\n%   classdef Planet < GravitationallyRoundedBody\r\n%       properties\r\n%           Moons\r\n%       end\r\n%   end\r\n%\r\n%   classdef TerrestrialPlanet < Planet\r\n%       properties\r\n%           Crust\r\n%       end\r\n%   end\r\n%\r\n%   classdef RingedPlanet < Planet\r\n%       properties\r\n%           Rings\r\n%       end\r\n%   end\r\n%\r\n%   classdef GasGiant < RingedPlanet\r\n%   end\r\n%\r\n%   classdef IceGiant < RingedPlanet\r\n%   end\r\n%\r\n%\r\n% I went over to the file exchange and downloaded the\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/44742-umlgui UMLgui\r\n% submission> so that we could visualize these classes a bit more easily\r\n% (*Hint* you should too!). With this UI we can generate the following class\r\n% diagram from this simple code:\r\n%\r\n% <<2015DeepPlanetHierarchy.png>>\r\n%\r\n% Everything here at first glance seems entirely rational. Go ahead and\r\n% pick any spot in that hierarchy and ask yourself whether each class \"isa\"\r\n% more specialized version of its superclass. Similarly, if you are a fan\r\n% of <http:\/\/en.wikipedia.org\/wiki\/Liskov_substitution_principle Liskov>\r\n% there doesn't seem to be any obvious substitutability violations.\r\n%\r\n%% \r\n% *With This Ring...* \r\n%\r\n% However, we can easily poke some holes into this simple structure. For\r\n% example, what about the rings? Well, this model worked quite well when\r\n% you think about the planets in our own solar system, it is indeed the\r\n% gas\/ice giants that have rings so it seems to work well...that is until\r\n% NASA discovers that <http:\/\/en.wikipedia.org\/wiki\/Rhea_(moon) Rhea> may\r\n% have some rings!\r\n%\r\n% Now we are placed in an unfortunate situation that is common with deep\r\n% inheritance hierarchies. The problem here is that Rhea is a moon! We may\r\n% have some code that operates on celestial bodies with rings and we'd like\r\n% to support Rhea in such code. However, the class which defines what it\r\n% means to have rings is actually a planet. Rhea can't (shouldn't!) derive\r\n% from *|RingedPlanet|* because that would give Rhea moons! Furthermore, we\r\n% can't move *|RingedPlanet|* higher in the hierarchy to allow Rhea to\r\n% access this feature because then *|TerrestrialPlanet|* and *|Star|* would\r\n% have rings, not to mention the fact that this would apply to all moons,\r\n% not just rare moons like Rhea which (might?) contain them.\r\n%\r\n% We can play this game with other features of the interface as well. What\r\n% about crust? Most moons have a crust like the terrestrial planets, but\r\n% how do we include the crust both above the *|Planet|* interface so that\r\n% moons have access to this property as well as below the *|Planet|*\r\n% interface so that the gas\/ice giants don't inherit it. How might we add\r\n% an atmosphere to these models? The planets have one (oops! not Mercury)\r\n% and the moons don't (wait, what about Titan?). Don't even think about\r\n% looking outside of our own limited solar system, this structure will fall\r\n% apart quickly. When we try to structure our classes in a pure hierarchy\r\n% we inevitably fail as we see new requirements and try to apply our\r\n% software structure to new features and ideas.\r\n%\r\n% This example demonstrates the principle of favoring class hierarchies\r\n% that are wide rather than deep. Shallow and wide hierarchies contain\r\n% concrete classes that are coupled to a low number of superclasses. They\r\n% can opt into precisely the interfaces they need without adding\r\n% unnecessary baggage. These interfaces themselves can be small, scoped,\r\n% and modular such that subclasses can pick and choose just the pieces of\r\n% the interface that apply directly to them.\r\n%\r\n% We can make this class structure much more flexible by flattening the\r\n% hierarchy and bringing some of these key abilities into their own\r\n% independent base classes. For example we can remove two levels of\r\n% hierarchy and solve the problems discussed by simply pulling the\r\n% gravitationally rounded properties and whether the body has rings their\r\n% own independent interfaces. This looks like this:\r\n%\r\n% \r\n%   classdef CelestialBody\r\n%       properties\r\n%           Mass\r\n%       end\r\n%   end\r\n% \r\n%   classdef Rounded\r\n%       properties\r\n%           Radius\r\n%       end\r\n%   end\r\n%\r\n%   classdef Asteroid < CelestialBody\r\n%       properties\r\n%           Shape\r\n%       end\r\n%   end\r\n%\r\n%   classdef Moon < CelestialBody & Rounded\r\n%       properties\r\n%           HostPlanet\r\n%       end\r\n%   end\r\n%\r\n%   classdef Star < CelestialBody & Rounded\r\n%       methods\r\n%           function radiate(star)\r\n%           end\r\n%       end\r\n%   end\r\n%\r\n%   classdef Planet < CelestialBody & Rounded\r\n%       properties\r\n%           Moons\r\n%       end\r\n%   end\r\n%\r\n%   classdef TerrestrialPlanet < Planet\r\n%       properties\r\n%           Crust\r\n%       end\r\n%   end\r\n%\r\n%   classdef HasRings\r\n%       properties\r\n%           Rings\r\n%       end\r\n%   end\r\n%\r\n%   classdef GasGiant < Planet & HasRings\r\n%   end\r\n%\r\n%   classdef IceGiant < Planet & HasRings\r\n%   end\r\n%\r\n% This code produces the following hierarchy:\r\n%\r\n% <<2015WidePlanetHierarchyLevel1.png>>\r\n%\r\n% <<2015WidePlanetHierarchyLevel2.png>>\r\n%\r\n% With this structure, it becomes trivial to give a moon some rings!\r\n%\r\n% <<2015RheaWithRings.jpg>>\r\n%\r\n% Now there are some different strategies for flattening these hierarchies,\r\n% but hopefully I've motivated the desire to keep them flat in the first\r\n% place. We can work through some strategies in another post.\r\n%\r\n% Do you have any deep hierarchy horror stories? How about feel good\r\n% romances with nice shallow designs? Love to hear about em...\r\n\r\n##### SOURCE END ##### 7d489a0d854a4ccab00e226b9d4cfc22\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/developer\/files\/2015WidePlanetHierarchyLevel1.png\" onError=\"this.style.display ='none';\" \/><\/div><!--introduction--><p>The conventional wisdom these days seems to be that it is better to go deep, not wide. Whether this is in education, marketing, or general approaches to focused living, there seems to be an theme these days that if you favor breadth over depth the result will be shallow, without substance, and spread thin. The generalist it seems has seen better days in the court of public opinion. Is that true in life? I dunno, perhaps.... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/developer\/2015\/03\/31\/dont-get-in-too-deep\/\">read more >><\/a><\/p>","protected":false},"author":90,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,5],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts\/131"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/users\/90"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/comments?post=131"}],"version-history":[{"count":11,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts\/131\/revisions"}],"predecessor-version":[{"id":147,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts\/131\/revisions\/147"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/media?parent=131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/categories?post=131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/tags?post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}