{"id":11,"date":"2024-01-19T02:38:58","date_gmt":"2024-01-19T02:38:58","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/securepass\/?p=11"},"modified":"2024-01-19T02:38:58","modified_gmt":"2024-01-19T02:38:58","slug":"cs-462-blog-1","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/securepass\/2024\/01\/19\/cs-462-blog-1\/","title":{"rendered":"CS 462 &#8211; Blog #1"},"content":{"rendered":"\n<p>One thing from the article &#8220;How to Write Clean Code \u2013 Tips and Best Practices (Full Handbook)&#8221; by <a href=\"https:\/\/www.freecodecamp.org\/news\/author\/gercocca\/\">Germ\u00e1n Cocca<\/a>, that I want to start doing more often is efficiency. Understanding and getting better at algorithmic complexity to run a program with the most efficient resource usage in terms of time and space. For example, the following two codes:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\/\/ Inefficient Example\nfunction sumArrayInefficient(array) {\n  let sum = 0;\n  for (let i = 0; i &amp;lt; array.length; i++) {\n    sum += array&#x5B;i];\n  }\n  return sum;\n}\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\/\/ Efficient example\nfunction sumArrayEfficient(array) {\n  return array.reduce((a, b) =&amp;gt; a + b, 0);\n}\n<\/pre><\/div>\n\n\n<p>The second one is more efficient because it only needs one iteration over the array and performs a summing operation on each element as it goes.<\/p>\n\n\n\n<p>One thing I want to avoid doing is &#8220;Shotgun Surgery,&#8221; a code smell I learned from &#8220;Everything you need to know about Code Smells&#8221; by codegrip, which is when one change requires altering many different classes. I want to avoid this code smell because it leads to a high risk of errors and makes the system hard to maintain.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One thing from the article &#8220;How to Write Clean Code \u2013 Tips and Best Practices (Full Handbook)&#8221; by Germ\u00e1n Cocca, that I want to start doing more often is efficiency. Understanding and getting better at algorithmic complexity to run a program with the most efficient resource usage in terms of time and space. For example, [&hellip;]<\/p>\n","protected":false},"author":13933,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/securepass\/wp-json\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/securepass\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/securepass\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/securepass\/wp-json\/wp\/v2\/users\/13933"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/securepass\/wp-json\/wp\/v2\/comments?post=11"}],"version-history":[{"count":1,"href":"https:\/\/blogs.oregonstate.edu\/securepass\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"predecessor-version":[{"id":12,"href":"https:\/\/blogs.oregonstate.edu\/securepass\/wp-json\/wp\/v2\/posts\/11\/revisions\/12"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/securepass\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/securepass\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/securepass\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}