{"id":13,"date":"2024-01-18T21:03:34","date_gmt":"2024-01-18T21:03:34","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/kevinscapstone\/?p=13"},"modified":"2024-01-18T21:03:34","modified_gmt":"2024-01-18T21:03:34","slug":"cleaner-code","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/kevinscapstone\/2024\/01\/18\/cleaner-code\/","title":{"rendered":"Cleaner Code"},"content":{"rendered":"\n<p>Winter break has ended, and now the term has started up once more. The first post I&#8217;ll be making for the term is about writing clean code, which boils down to code that&#8217;s easy to read and understand. However, there&#8217;s more to it than just making sure your code is commented. A lot of times when I implement a function or other part of the program, I end up just moving on to the next part because it works. I don&#8217;t actually think about whether or not it&#8217;s as <em>efficient<\/em> as I can make it, which often means more for loops and if statements than there needs to be. An example in an article I saw included the following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"904\" height=\"255\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/7286\/files\/2024\/01\/image.png\" alt=\"\" class=\"wp-image-14\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/7286\/files\/2024\/01\/image.png 904w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/7286\/files\/2024\/01\/image-300x85.png 300w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/7286\/files\/2024\/01\/image-768x217.png 768w\" sizes=\"auto, (max-width: 904px) 100vw, 904px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"883\" height=\"143\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/7286\/files\/2024\/01\/image-1.png\" alt=\"\" class=\"wp-image-15\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/7286\/files\/2024\/01\/image-1.png 883w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/7286\/files\/2024\/01\/image-1-300x49.png 300w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/7286\/files\/2024\/01\/image-1-768x124.png 768w\" sizes=\"auto, (max-width: 883px) 100vw, 883px\" \/><\/figure>\n\n\n\n<p>These two functions both do the same thing, yet one is cleaner than the other. This is the kind of code you should strive for, and its what I plan on trying to integrate in my coding practices.<\/p>\n\n\n\n<p>References:<br>https:\/\/www.freecodecamp.org\/news\/how-to-write-clean-code\/<br>https:\/\/www.sciencedirect.com\/science\/article\/abs\/pii\/S0164121220300881<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Winter break has ended, and now the term has started up once more. The first post I&#8217;ll be making for the term is about writing clean code, which boils down to code that&#8217;s easy to read and understand. However, there&#8217;s more to it than just making sure your code is commented. A lot of times [&hellip;]<\/p>\n","protected":false},"author":13844,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/kevinscapstone\/wp-json\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/kevinscapstone\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/kevinscapstone\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/kevinscapstone\/wp-json\/wp\/v2\/users\/13844"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/kevinscapstone\/wp-json\/wp\/v2\/comments?post=13"}],"version-history":[{"count":1,"href":"https:\/\/blogs.oregonstate.edu\/kevinscapstone\/wp-json\/wp\/v2\/posts\/13\/revisions"}],"predecessor-version":[{"id":16,"href":"https:\/\/blogs.oregonstate.edu\/kevinscapstone\/wp-json\/wp\/v2\/posts\/13\/revisions\/16"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/kevinscapstone\/wp-json\/wp\/v2\/media?parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/kevinscapstone\/wp-json\/wp\/v2\/categories?post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/kevinscapstone\/wp-json\/wp\/v2\/tags?post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}