{"id":20,"date":"2022-05-20T03:19:12","date_gmt":"2022-05-20T03:19:12","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/awendingpath\/?p=20"},"modified":"2022-05-20T03:19:12","modified_gmt":"2022-05-20T03:19:12","slug":"to-refactor-or-not-to-refactor","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/awendingpath\/2022\/05\/20\/to-refactor-or-not-to-refactor\/","title":{"rendered":"To Refactor or Not to Refactor&#8230;"},"content":{"rendered":"\n<p>That is the question. And the answer is yes. Do it.<\/p>\n\n\n\n<p>As we\u2019re nearing the end of the term, and our Capstone projects are coming into something close to their final forms, I\u2019m putting my focus and attention on refactoring. While I came into our project with knowledge of Flutter and Dart, it certainly was not advanced, and was constrained to the specific techniques taught in the Mobile Development class here at OSU. The unique requirements of our project, using Firestore in a much greater capacity, and developing on a team have resulted in a great deal of new learning.<\/p>\n\n\n\n<p>One side effect of learning something new is that it\u2019s not usually perfect the first time. And by not usually I mean almost never. So the code I have needs work. It\u2019s accomplishing what it\u2019s supposed to, but in terms of being DRY, of functions being short and doing one thing, and encapsulating code to avoid unnecessary dependencies, there is work to do. Part of the learning curve has been understanding Firestore, and the best way to write queries, and read and write data. Part of the refactoring work to be done will be to make sure I\u2019m doing these database queries and writes consistently and efficiently. Then, having made sure that component is done well, I will take a look at the structure of my dart files, try to keep my model classes purely dart, and put other functions and classes in the most appropriate places.&nbsp;<\/p>\n\n\n\n<p>Aside from Firestore interactions, I\u2019m hoping to make sure performance is most efficient by extracting widgets to their own classes, so that the build methods do not become over-encumbered with functions needlessly being rebuilt. Lastly, making sure conventions, line length, and comments are consistent across our program will be a priority.<\/p>\n\n\n\n<p>While there is plenty to be done, I do find myself happy with how far I\u2019ve come since the early days of my time here in the Online CS program. The quality between now and my first forays into programming is dramatic, and I can differentiate between quality code and poorly written code. And when I need to refactor I recognize the process for what offers \u2013 simply another opportunity to learn and improve.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>That is the question. And the answer is yes. Do it. As we\u2019re nearing the end of the term, and our Capstone projects are coming into something close to their final forms, I\u2019m putting my focus and attention on refactoring. While I came into our project with knowledge of Flutter and Dart, it certainly was &hellip; <a href=\"https:\/\/blogs.oregonstate.edu\/awendingpath\/2022\/05\/20\/to-refactor-or-not-to-refactor\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;To Refactor or Not to Refactor&#8230;&#8221;<\/span><\/a><\/p>\n","protected":false},"author":12210,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-20","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/awendingpath\/wp-json\/wp\/v2\/posts\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/awendingpath\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/awendingpath\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/awendingpath\/wp-json\/wp\/v2\/users\/12210"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/awendingpath\/wp-json\/wp\/v2\/comments?post=20"}],"version-history":[{"count":1,"href":"https:\/\/blogs.oregonstate.edu\/awendingpath\/wp-json\/wp\/v2\/posts\/20\/revisions"}],"predecessor-version":[{"id":21,"href":"https:\/\/blogs.oregonstate.edu\/awendingpath\/wp-json\/wp\/v2\/posts\/20\/revisions\/21"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/awendingpath\/wp-json\/wp\/v2\/media?parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/awendingpath\/wp-json\/wp\/v2\/categories?post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/awendingpath\/wp-json\/wp\/v2\/tags?post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}