{"id":3623,"date":"2020-04-01T08:32:39","date_gmt":"2020-04-01T13:32:39","guid":{"rendered":"https:\/\/blogs.mathworks.com\/loren\/?p=3623"},"modified":"2020-04-01T11:13:42","modified_gmt":"2020-04-01T16:13:42","slug":"the-meaning-of-ccc","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/loren\/2020\/04\/01\/the-meaning-of-ccc\/","title":{"rendered":"The Meaning of CCC"},"content":{"rendered":"<div class=\"content\"><!--introduction--><p>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:<\/p><div><ul><li>Civilian Conservation Corps<\/li><li>Consumer credit counseling<\/li><li>Continuous chest compressions<\/li><li>Coricidin Cough and Cold<\/li><li>Cash conversion cycle<\/li><\/ul><\/div><p>But those are less useful in the context of MATLAB.<\/p><!--\/introduction--><h3>Contents<\/h3><div><ul><li><a href=\"#f358e269-fa62-4fdb-8d46-55195962f83a\">What is CCC?<\/a><\/li><li><a href=\"#e78ededb-7a03-4801-84ae-cf063fcd3f8f\">But There's More<\/a><\/li><\/ul><\/div><h4>What is CCC?<a name=\"f358e269-fa62-4fdb-8d46-55195962f83a\"><\/a><\/h4><p>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.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2020\/ccc.png\" alt=\"\"> <\/p><p>And now you know that \"ccc\" to me just might mean the commands<\/p><pre>     clear\r\n     clc\r\n     close all<\/pre><p>I'm betting most of you know what <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/close.html\"><tt>close<\/tt><\/a> means. And probably even <tt>close all<\/tt>. <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/clc.html\"><tt>clc<\/tt><\/a> stands for clear command window.  And <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/clear.html\"><tt>clear<\/tt><\/a> is also familiar in one of its many variants, no doubt.  I do want to talk about the options for <tt>clear<\/tt>, specifically <tt>all<\/tt>.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2020\/clearOPTS.png\" alt=\"\"> <\/p><p>I used to use <tt>clear all<\/tt> a lot.  I have completely changed my habits though, to take the best advantage of <a href=\"https:\/\/blogs.mathworks.com\/loren\/2016\/02\/12\/run-code-faster-with-the-new-matlab-execution-engine\/\">performance enhancements<\/a> 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.<\/p><h4>But There's More<a name=\"e78ededb-7a03-4801-84ae-cf063fcd3f8f\"><\/a><\/h4><p>When I'm giving talks and point out this favorite, I joke that it's not <i>chocolate chip cookies<\/i>, 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.<\/p><p>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.)<\/p><p>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:<\/p><div><ul><li>Mix a small amount of flour with<\/li><li>A tiny amount of baking soda<\/li><li>A partial pat of butter<\/li><li>A small amount of brown sugar<\/li><li>Part of an egg, pre-whipped<\/li><li>5-10 chocolate chips<\/li><li>Optionally, a few small pieces of chopped nuts<\/li><\/ul><\/div><p>Take this mixture, place it on a greased or lined baking sheet, place it in a 350&deg;F oven, and bake for 10 minutes.<\/p><p>And then do the whole set of steps again, and again, and again.<\/p><p>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!<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2020\/ccc4.jpg\" alt=\"\"> <\/p><p>Sometimes we do place the dough in other patterns, or no patterns, of course.<\/p><p>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.<\/p><p>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 <a href=\"https:\/\/blogs.mathworks.com\/loren?p=3623#respond\">here<\/a>?<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_92314444eb7b4fcfb1c704dec8063fbb() {\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='92314444eb7b4fcfb1c704dec8063fbb ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 92314444eb7b4fcfb1c704dec8063fbb';\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 2020 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_92314444eb7b4fcfb1c704dec8063fbb()\"><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; R2020a<br><\/p><\/div><!--\r\n92314444eb7b4fcfb1c704dec8063fbb ##### SOURCE BEGIN #####\r\n%% The Meaning of CCC\r\n% When I started thinking about a post featuring CCC, I decided to search\r\n% online for it - so many different meanings! Here's a small sample:\r\n% \r\n% * Civilian Conservation Corps\r\n% * Consumer credit counseling\r\n% * Continuous chest compressions\r\n% * Coricidin Cough and Cold\r\n% * Cash conversion cycle\r\n% \r\n% But those are less useful in the context of MATLAB.\r\n%% What is CCC?\r\n% When I do demos for people, they might notice that I have my quick\r\n% access toolbar below the toolstrip.  And I have several favorites in it.\r\n% When I open the favorite labeled \"X\", you see this.\r\n%\r\n% <<ccc.png>>\r\n%\r\n% And now you know that \"ccc\" to me just might mean the commands\r\n%\r\n%       clear\r\n%       clc\r\n%       close all\r\n%\r\n% I'm betting most of you know what\r\n% <https:\/\/www.mathworks.com\/help\/matlab\/ref\/close.html |close|> means. And\r\n% probably even |close all|.\r\n% <https:\/\/www.mathworks.com\/help\/matlab\/ref\/clc.html |clc|> stands for\r\n% clear command window.  And\r\n% <https:\/\/www.mathworks.com\/help\/matlab\/ref\/clear.html |clear|> is also\r\n% familiar in one of its many variants, no doubt.  I do want to talk about\r\n% the options for |clear|, specifically |all|.\r\n%\r\n% <<clearOPTS.png>>\r\n%\r\n% I used to use |clear all| a lot.  I have completely changed my habits\r\n% though, to take the best advantage of\r\n% <https:\/\/blogs.mathworks.com\/loren\/2016\/02\/12\/run-code-faster-with-the-new-matlab-execution-engine\/\r\n% performance enhancements> made to MATLAB over more than the past 5 years.\r\n% There is no reason for me generally to remove more than my workspace when\r\n% I want to clean up my session so I can move onto another task. For me,\r\n% only if I am doing some critical timing measurements, including first\r\n% time function usage time, do I need to clear my functions, and other\r\n% possible choices.\r\n%% But There's More\r\n% When I'm giving talks and point out this favorite, I joke that it's not\r\n% _chocolate chip cookies_, clearly another ccc!  But this does bring me to\r\n% another topic near and dear to me.  Which is writing good and\r\n% high-performing code.  And what this has to do with baking cookies.\r\n%\r\n% In 1993, we held our first MATLAB User Conference in Cambridge,\r\n% Massachusetts.  I gave a talk there titled something like \"17 Programming\r\n% Patterns in MATLAB\".  The first part was about vectorization.  (MATLAB\r\n% still had arrays with only 2 dimensions then, and vectorization really\r\n% should have been something like arrayizing, or matricizing... but those were\r\n% unappealing and didn't exactly sound like words.)\r\n%\r\n% If you are homebound, as we are these days, you may decide, especially if\r\n% you have kids around, that it's time to make some cookies.  What you do\r\n% NOT do is this:\r\n%\r\n% * Mix a small amount of flour with\r\n% * A tiny amount of baking soda\r\n% * A partial pat of butter\r\n% * A small amount of brown sugar\r\n% * Part of an egg, pre-whipped\r\n% * 5-10 chocolate chips\r\n% * Optionally, a few small pieces of chopped nuts\r\n%\r\n% Take this mixture, place it on a greased or lined baking sheet, place it\r\n% in a 350\u00b0F oven, and bake for 10 minutes.\r\n%\r\n% And then do the whole set of steps again, and again, and again.\r\n%\r\n% No! We take a couple of cups of flour, the right proportion of the rest\r\n% of the ingredients, and we mix them all together in one batch. And then\r\n% we place spoonsful of dough on the cookie sheet, often in a MATRIX!\r\n%\r\n% <<ccc4.jpg>>\r\n%\r\n% Sometimes we do place the dough in other patterns, or no patterns, of\r\n% course.\r\n%\r\n% And that's my analogy for why we bother to vectorize.  We call functions\r\n% a single time on an array of data rather than calling the function\r\n% separately for each value, when possible.  Kind of like measuring the\r\n% flour, etc. once, in a larger volume.\r\n%\r\n%%\r\n% That's the end of my CCC stories today.  I love using appropriate\r\n% analogies to help people understand potentially complex concepts.  Do you\r\n% have any favorites to share with us\r\n% <https:\/\/blogs.mathworks.com\/loren?p=3623#respond here>? \r\n##### SOURCE END ##### 92314444eb7b4fcfb1c704dec8063fbb\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/2020\/clearOPTS.png\" onError=\"this.style.display ='none';\" \/><\/div><!--introduction--><p>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:... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/loren\/2020\/04\/01\/the-meaning-of-ccc\/\">read more >><\/a><\/p>","protected":false},"author":39,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[56,58,13,12],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/3623"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/comments?post=3623"}],"version-history":[{"count":3,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/3623\/revisions"}],"predecessor-version":[{"id":3631,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/3623\/revisions\/3631"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/media?parent=3623"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/categories?post=3623"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/tags?post=3623"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}