Skip to content

Stack Justification

Daniel Reeves edited this page May 10, 2020 · 4 revisions

As of writing, the only stack decision we've 100% decided on for the website is Python 3.7 and Flask. This leads to a natural question: why?

Why Python?

Our justification for using Python is that, due to how the CRWA tends to staff its team (academics and scientists), Python is the most viable language that a website can be built in while still being maintainable by the CRWA. The two most popular coding languages in academia are R and Python. You can't really build a website in R (you technically can, but really really shouldn't for a lot of reasons). So the next option is Python.

Even if the CRWA does not staff people based on their Python knowledge (we do not expect that they will do this), they are very likely have connections to various people who know Python. It is unlikely that the CRWA will have as many direct ties to people who have Javascript or PHP knowledge. Because long-term maintainability is such a high priority, Python is the sensible technical solution.

Not only is Python way more popular than PHP in academia, it's the most popular programming language in general. This means that Python is a natural fit for any organization's coding projects that do not have specialized needs for a particular coding language.

There are a lot of disadvantages to building a website in Python, which is why most websites are built in LAMP, MEAN, Ruby on Rails, and other software stacks. Most of the advantages of other frameworks are performance related: for server-side scripting, Python is a very slow language compared to PHP 7. Also, many modern stacks are designed to facilitate reducing the amount of server-side scripting required by processing stuff in users' browsers. Because this website is relatively simple and won't be directly utilized by many people, these advantages of modern web stacks-- designed to build websites that can handle thousands or millions of concurrent users-- don't matter nearly as much as ease of maintainability.

Why Flask?

Once we have decided on Python for web development, we need to make a determination on whether to use Django or Flask, the two leading frameworks for building websites in Python.

Django is designed for much more complicated websites than what we would be building. Django has its own idiom that takes a lot of time to learn and get used to. Django is very fleshed out and exposes a lot of the in-the-weeds logic behind maintaining a website that will surely excite venerable web developers, but that's not necessarily what we need.

On the other hand, Flask is a very simple and lightweight framework built mainly around the use of its "app.route()" decorator. Essentially, you write functions that output strings, and those strings are rendered as HTML. Whereas Django feels like learning a whole framework, Flask feels comfortable and intuitive to anyone familiar with Python without demanding additional homework or web development expertise.

Granted, Flask is not quite that simple-- there are functions such as render_template, and you can flesh out a lot of HTML files marked-up with a tool called Jinja. But overall, Flask code ends up much closer idiomatically to conventional Python than Django code. So between the maintainability concern and the fact that it's not a particularly complicated website to begin with, we want Flask.

What else?

The rest of the stack is currently up in the air. We may want sqlite, or we may want Postgres. We may want Redis to manage caching our data pulls, or maybe we'd use something else. What about Celery? How about the modeling portion? Or perhaps a Twitter bot down the line? These are open questions.

We will have to make decisions on the stack we use based on available expertise, simplicity, appropriateness for the scale, and maintainability.

Clone this wiki locally