The Meaning of CCC
When I started thinking about a post featuring CCC, I decided to search online for it - so many different meanings! Here's a small sample:
- Civilian Conservation Corps
- Consumer credit counseling
- Continuous chest compressions
- Coricidin Cough and Cold
- Cash conversion cycle
But those are less useful in the context of MATLAB.
Contents
What is CCC?
When I do demos for people, they might notice that I have my quick access toolbar below the toolstrip. And I have several favorites in it. When I open the favorite labeled "X", you see this.
And now you know that "ccc" to me just might mean the commands
clear clc close all
I'm betting most of you know what close means. And probably even close all. clc stands for clear command window. And clear is also familiar in one of its many variants, no doubt. I do want to talk about the options for clear, specifically all.
I used to use clear all a lot. I have completely changed my habits though, to take the best advantage of performance enhancements made to MATLAB over more than the past 5 years. There is no reason for me generally to remove more than my workspace when I want to clean up my session so I can move onto another task. For me, only if I am doing some critical timing measurements, including first time function usage time, do I need to clear my functions, and other possible choices.
But There's More
When I'm giving talks and point out this favorite, I joke that it's not chocolate chip cookies, clearly another ccc! But this does bring me to another topic near and dear to me. Which is writing good and high-performing code. And what this has to do with baking cookies.
In 1993, we held our first MATLAB User Conference in Cambridge, Massachusetts. I gave a talk there titled something like "17 Programming Patterns in MATLAB". The first part was about vectorization. (MATLAB still had arrays with only 2 dimensions then, and vectorization really should have been something like arrayizing, or matricizing... but those were unappealing and didn't exactly sound like words.)
If you are homebound, as we are these days, you may decide, especially if you have kids around, that it's time to make some cookies. What you do NOT do is this:
- Mix a small amount of flour with
- A tiny amount of baking soda
- A partial pat of butter
- A small amount of brown sugar
- Part of an egg, pre-whipped
- 5-10 chocolate chips
- Optionally, a few small pieces of chopped nuts
Take this mixture, place it on a greased or lined baking sheet, place it in a 350°F oven, and bake for 10 minutes.
And then do the whole set of steps again, and again, and again.
No! We take a couple of cups of flour, the right proportion of the rest of the ingredients, and we mix them all together in one batch. And then we place spoonsful of dough on the cookie sheet, often in a MATRIX!
Sometimes we do place the dough in other patterns, or no patterns, of course.
And that's my analogy for why we bother to vectorize. We call functions a single time on an array of data rather than calling the function separately for each value, when possible. Kind of like measuring the flour, etc. once, in a larger volume.
That's the end of my CCC stories today. I love using appropriate analogies to help people understand potentially complex concepts. Do you have any favorites or analogies to share with us here?
- Category:
- History,
- Performance,
- Tool,
- Vectorization