{"id":21,"date":"2023-02-10T02:34:31","date_gmt":"2023-02-10T02:34:31","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/mvplants\/?p=21"},"modified":"2023-02-10T02:34:31","modified_gmt":"2023-02-10T02:34:31","slug":"next-to-nothing","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/mvplants\/2023\/02\/10\/next-to-nothing\/","title":{"rendered":"Next to Nothing"},"content":{"rendered":"\n<p>The technologies I was most surprised to find in our stack used together after learning what our project was, was Next JS and Flask. I knew that React was certainly going to be used here, it is a web application after all, but it was a strange choice to me to pair the two. We didn&#8217;t need to play the SEO game most of the web did; we are building a tool for a specific audience, not a social media platform. Speed isn&#8217;t exactly a requirement here either. This blog post will discuss why I think our project predecessors picked the two, and what I would have done differently.<\/p>\n\n\n\n<p>I&#8217;ve worked with Next JS quite a lot. Every day in fact I work with Next. And I&#8217;d worked with flask a handful of times before for work and school. But together to build a web application? I certainly hadn&#8217;t thought of that. I have some hypotheses about why these two technologies were picked. For flask, I think the thinking was that opening this API up for other organizations to use was going to be a larger part of the MVP. I think the idea was to use the API created with flask as a central point for everything going on here, it was where we could interface with the data and where we could easily provide it for others. As for Next, I think npm packages were picked out that everyone wanted to build things off of. I don&#8217;t hate Next, but that&#8217;s about the only reason I could see to use it in this situation.<\/p>\n\n\n\n<p>Working with the two has been interesting for sure. My biggest gripe is that it feels like we&#8217;re just using the VC part of the MVC pattern when the M(odel) part of it would be particularly useful. We do a lot of interesting things with related pieces of data in our program. It would be nice to use a framework that leverages the relationships between these models in a really abstract way in the code. What I mean by that is it would be nice to do something like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Collection.create!()<\/code><\/pre>\n\n\n\n<p>Instead of this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DatabaseConnection.execute_insert(\"\"\"INSERT INTO rev2.seed_collection (a ton of columns) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s)\"\"\", (grab_val(request, \"speciescode\"), grab_val(request, \"collected_date\"), grab_val(request, \"collection_provenance\"), grab_val(request, \"id_method\"), grab_val(request, \"id_person\"), grab_val(request, \"id_confidence\"), grab_val(request, \"cleaning_effectiveness\"), grab_val(request, \"cleaned_weight\"), grab_val(request, \"collection_history_ref\")))<\/code><\/pre>\n\n\n\n<p>While these two examples are in different languages (the first it ruby using rails), the point still stands. I would have picked a framework like Django or Rails that we could define models and use the models relationships in the controller instead of writing into the database using raw SQL queries.<\/p>\n\n\n\n<p>I can kind of see why they chose to do things this way&#8230; but not really. If I could go back in time and talk to last years students, I would have suggested using Django if they were dead set on building this in python.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The technologies I was most surprised to find in our stack used together after learning what our project was, was Next JS and Flask. I knew that React was certainly going to be used here, it is a web application after all, but it was a strange choice to me to pair the two. We [&hellip;]<\/p>\n","protected":false},"author":12991,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-21","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/mvplants\/wp-json\/wp\/v2\/posts\/21","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/mvplants\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/mvplants\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/mvplants\/wp-json\/wp\/v2\/users\/12991"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/mvplants\/wp-json\/wp\/v2\/comments?post=21"}],"version-history":[{"count":1,"href":"https:\/\/blogs.oregonstate.edu\/mvplants\/wp-json\/wp\/v2\/posts\/21\/revisions"}],"predecessor-version":[{"id":22,"href":"https:\/\/blogs.oregonstate.edu\/mvplants\/wp-json\/wp\/v2\/posts\/21\/revisions\/22"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/mvplants\/wp-json\/wp\/v2\/media?parent=21"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/mvplants\/wp-json\/wp\/v2\/categories?post=21"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/mvplants\/wp-json\/wp\/v2\/tags?post=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}