{"id":19,"date":"2024-01-20T06:30:25","date_gmt":"2024-01-20T06:30:25","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/arzumana\/?p=19"},"modified":"2024-01-20T06:30:25","modified_gmt":"2024-01-20T06:30:25","slug":"4-stinky-code","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/arzumana\/2024\/01\/20\/4-stinky-code\/","title":{"rendered":"#4 &#8211; Stinky Code"},"content":{"rendered":"\n<p>Quick update on the project &#8211; all is going well, and we&#8217;ve finally sunk our teeth into concrete tasks over the past week. However, this blog isn&#8217;t about that&#8230;<\/p>\n\n\n\n<p>It was nice to get a refresher on code smells this week, as it&#8217;s one of those things that&#8217;s hard to pinpoint. <a href=\"https:\/\/medium.com\/the-liberators\/on-technical-debt-and-code-smells-ae8de66f0f8b\">This<\/a> article from Medium did a good recap of 5 of the most common smells. One in particular, &#8220;Blob Class&#8221;, actually came up over the past few days in my capstone project. One of my team members was reluctant to add extra methods to our &#8220;World&#8221; controller, since by that point it contained a mix of code for simulation control and UI. I encouraged them to make the additions at first, thinking little of it at first. The impression did stick, so later on I decided to refactor the code, moving UI controls to a separate class. If my teammate did not voice their concern about the code, I likely would have carried on adding to it, and the class would&#8217;ve become long and stinky. This goes to show the benefits of peer review &#8211; something the article advocates, and something I aim to do more often in the future.<\/p>\n\n\n\n<p>On a similar note, <a href=\"https:\/\/reflectoring.io\/clean-code\/\">this<\/a> article from Reflectoring.io talks about viewing code itself as a form of communication &#8211; with other developers. While it&#8217;s not something the computer or the end user would see, it&#8217;s extremely important to write legible code when working in a team. Having primarily coded alone, it&#8217;s something I definitely need to get used to, by dropping some bad habits when it comes to naming conventions. When working alone, using &#8220;x&#8221; or &#8220;num&#8221; or even &#8220;obj&#8221; isn&#8217;t too bad, but it&#8217;s atrocious when someone else stumbles across those names and have to figure out what they are supposed to represent. Lazy names is something I have to drop &#8211; sooner rather than later.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Quick update on the project &#8211; all is going well, and we&#8217;ve finally sunk our teeth into concrete tasks over the past week. However, this blog isn&#8217;t about that&#8230; It was nice to get a refresher on code smells this week, as it&#8217;s one of those things that&#8217;s hard to pinpoint. This article from Medium [&hellip;]<\/p>\n","protected":false},"author":13896,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/users\/13896"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":1,"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":20,"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/posts\/19\/revisions\/20"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}