{"id":13,"date":"2023-01-27T04:08:12","date_gmt":"2023-01-27T04:08:12","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/alexana2blog\/?p=13"},"modified":"2023-01-27T04:08:12","modified_gmt":"2023-01-27T04:08:12","slug":"clean-code","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/alexana2blog\/2023\/01\/27\/clean-code\/","title":{"rendered":"Clean Code"},"content":{"rendered":"\n<p>Reading this article from freecodecamp.org, I really enjoyed this quote at the start of the article &#8220;Any fool can write code that a computer can understand. Good programmers write code that humans can understand.&#8221; \u2013 Martin Fowler<\/p>\n\n\n\n<p>This is the type of quote I like to take to heart, as I think readable code is very important not only for others but for your future self. Besides this quote, the article had a few great suggestions that I will start incorporating into my coding practice. I especially liked this advice about writing functions &#8220;Functions should be small, really small. They should rarely be 20 lines long.&#8221; As this is one that doesn&#8217;t seem as obvious to me as other suggestions like choosing good names and using constants instead of hard coded numbers. This is a suggestion that i definitely haven&#8217;t always implemented into my code, and it is great advice to limit your functions like this. It basically says that a function should only perform one task, and if it is much longer than 20 lines chances it performs more than one.<em> <\/em>I like this suggestion because I think it will help simplify my code.<\/p>\n\n\n\n<p>When looking at this article https:\/\/www.techtarget.com\/searchsoftwarequality\/tip\/Understanding-code-smells-and-how-refactoring-can-help. It made some great suggestions on things to avoid and how to alter them. I particularly liked this advice about &#8220;pushing down&#8221; your code &#8220;<strong>Push down<\/strong>: Method code that lives within a superclass but is only used by a few of the subclasses is pushed down to those respective subclasses.&#8221; I like this because I feel like I have an issue with this problem, where I have a tendency to do the opposite. I feel that this will help de-clutter my code and make it more immediately understandable.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Reading this article from freecodecamp.org, I really enjoyed this quote at the start of the article &#8220;Any fool can write code that a computer can understand. Good programmers write code that humans can understand.&#8221; \u2013 Martin Fowler This is the type of quote I like to take to heart, as I think readable code is [&hellip;]<\/p>\n","protected":false},"author":12978,"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\/alexana2blog\/wp-json\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/alexana2blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/alexana2blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/alexana2blog\/wp-json\/wp\/v2\/users\/12978"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/alexana2blog\/wp-json\/wp\/v2\/comments?post=13"}],"version-history":[{"count":2,"href":"https:\/\/blogs.oregonstate.edu\/alexana2blog\/wp-json\/wp\/v2\/posts\/13\/revisions"}],"predecessor-version":[{"id":15,"href":"https:\/\/blogs.oregonstate.edu\/alexana2blog\/wp-json\/wp\/v2\/posts\/13\/revisions\/15"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/alexana2blog\/wp-json\/wp\/v2\/media?parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/alexana2blog\/wp-json\/wp\/v2\/categories?post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/alexana2blog\/wp-json\/wp\/v2\/tags?post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}