A bit of philosophy on reuse versus building from scratch
This week, we are welcoming Michael Burke, from our consulting group.
Reuse: Or how I learned to love the Bat Man Lego set…
Like many an engineer of my generation I grew up with the basic Lego® 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’s creative possibilities. I scoffed, I scorned, I worried about the decline of western civilization if we fed these kids ships fully built!
My nephew had a whole raft of “complete” kits. From these kits he learned how to build houses and starships, bridges and mountains. What’s 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 saw what he had built — 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 Subbatfalc! It was awesome.
Figure 1 Not actual Subbatfalc
What's the link with Simulink?
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?
MATLAB and Simulink gives you a wonderful mixture of basic and advanced blocks. Further, with object-oriented programing in MATLAB and Simulink Libraries and Model blocks in Simulink, we give you the ability to create your own advanced blocks (heck, if you use TLC we give you the basic plastic to craft anything).
However as a consultant in the Controls Design Area 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 table look-up algorithms. They’ve 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.
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.
Figure 2: Note remember to thank Sally!
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’t the end of civilization — it’s 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!
Now it's your turn
How do you decide between using an existing complex block, versus building it from basic blocks? Let us know by leaving a comment here.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.