{"id":4290,"date":"2014-11-18T09:17:27","date_gmt":"2014-11-18T14:17:27","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/?p=4290"},"modified":"2014-11-18T09:17:53","modified_gmt":"2014-11-18T14:17:53","slug":"a-bit-of-philosophy-on-reuse-versus-building-from-scratch","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2014\/11\/18\/a-bit-of-philosophy-on-reuse-versus-building-from-scratch\/","title":{"rendered":"A bit of philosophy on reuse versus building from scratch"},"content":{"rendered":"<p><em>This week, we are welcoming <a href=\"https:\/\/www.mathworks.com\/services\/consulting\/meet-our-team\/index.html#michael_burke\">Michael Burke<\/a>, from our <a href=\"https:\/\/www.mathworks.com\/services\/consulting\/\">consulting group<\/a>.<\/em><\/p>\r\n\r\n<p><strong>Reuse: Or how I learned to love the Bat Man Lego set\u2026<\/strong><\/p>\r\n\r\n<p>Like many an engineer of my generation I grew up with the basic <a href=\"http:\/\/www.lego.com\/en-us\/\">Lego<\/a>\u00ae starter set: the 1x1, 2x2, 2x3, 1x8 and the massive 2x8.  We considered the wheel a high tech bit of plastic.  Years later when I first saw a custom set with its detailed instructions, I was outraged by what I assumed was the corporate-sponsored crushing of my nephew\u2019s creative possibilities.  I scoffed, I scorned, I worried about the decline of western civilization if we fed these kids ships fully built!<\/p>\r\n\r\n<p>My nephew had a whole raft of \u201ccomplete\u201d kits.  From these kits he learned how to build houses and starships, bridges and mountains.  What\u2019s more he learned how to build in a way that was rugged and would survive the hard-play action of space ships crashing into erupting volcanos.  One day I stopped and <strong><em>saw<\/em><\/strong> what he had built \u2014 a hybrid submarine from bits of the Bat Man street cruiser and the Millennium Falcon brought together with good old basic Legos.  He christened it the <em>Subbatfalc<\/em>!  It was awesome.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/lego-batman-star-wars-x-wing.jpeg\" alt=\"Subbatfalc\" \/><br><em>Figure 1 Not actual Subbatfalc<\/em><\/p>\r\n\r\n<p><strong>What's the link with Simulink?<\/strong><\/p>\r\n\r\n<p>So what does this have to do with MATLAB and Simulink?  Well, everything.  As engineers creating something new, we need to figure out where we start.  Do we use the primitive blocks and create everything from first principals or do we find existing components and build from there?<\/p>\r\n\r\n<p>MATLAB and Simulink gives you a wonderful mixture of basic and advanced blocks. Further, with object-oriented programing in MATLAB and <a href=\"https:\/\/www.mathworks.com\/help\/rptgenext\/ug\/simulinklibraryinformation.html\">Simulink Libraries<\/a> and <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/model.html\">Model blocks<\/a> in Simulink, we give you the ability to create your own advanced blocks (heck, if you use <a href=\"\">TLC<\/a> we give you the basic plastic to craft anything).<\/p>\r\n\r\n<p>However as a consultant in the <a href=\"https:\/\/www.mathworks.com\/solutions\/control-systems.html\">Controls Design Area<\/a> I have lost track of the number of times I have worked with a client who has built up a set of custom functions such as transfer functions, integrators, or <a href=\"https:\/\/www.mathworks.com\/help\/rptgenext\/ug\/lookuptable.html\">table look-up<\/a> algorithms.   They\u2019ve recreated basic blocks.  Now, truth be told, in many cases these custom blocks had a slight performance edge over the built-in blocks.   But customers also have to maintain and validate these blocks, taking time away from building something more important.<\/p>\r\n\r\n<p>So how do you determine when to build from scratch and when to use built-in functionality? I would suggest the following 6 State chart.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/reuse_chart.png\" alt=\"Reuse Chart\" \/><br><em>Figure 2: Note remember to thank Sally!<\/em><\/p>\r\n\r\n<p>My nephew took less than an hour to build the Subbatfalc.  Having worked with the kits, he had the skills to build it from basic blocks but it would have taken him ten times longer.  He made the rational choice to reuse; and so am I.  So, here I am recanting my harangue against kits.  It isn\u2019t the end of civilization \u2014 it\u2019s the start of more interesting time.  Now, pardon me, I am going to go help him build the Mount Doom\/Death Star mash-up (Doom Star??) so we can see what happens when the Subbatfalc attacks!<\/p>\r\n\r\n<p><strong>Now it's your turn<\/strong><\/p>\r\n\r\n<p>How do you decide between using an existing complex block, versus building it from basic blocks? Let us know by leaving a <a href=\"https:\/\/blogs.mathworks.com\/seth\/?p=4290&#comment\">comment here<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/reuse_chart.png\" onError=\"this.style.display ='none';\" \/><\/div><p>This week, we are welcoming Michael Burke, from our consulting group.\r\n\r\nReuse: Or how I learned to love the Bat Man Lego set\u2026\r\n\r\nLike many an engineer of my generation I grew up with the basic Lego\u00ae... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2014\/11\/18\/a-bit-of-philosophy-on-reuse-versus-building-from-scratch\/\">read more >><\/a><\/p>","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[121,65,33],"tags":[411],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4290"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/comments?post=4290"}],"version-history":[{"count":13,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4290\/revisions"}],"predecessor-version":[{"id":4303,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4290\/revisions\/4303"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=4290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=4290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=4290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}