The Benefit of Low-Abstraction Frameworks for Scaffolding Learning May 16, 2018
During the period, we teach Flask, a Python framework for building web applications. Out of the box, Flask includes features such as:
- handlers for "requests" to the server (such as when a browser requests a web page)
- generating HTML (or other types of responses) using a server-side templating language
- support for cookies and sessions (common features for applications)
- support for writing tests of an application
Flask is a popular library for this kind of development, but it's not the dominant or most featured library in this space. Django is used widely in industry, and has far more features out of the box (including things like deeply built-in support for connecting to databases, an "Object Relational Mapper" for querying and updating those databases, a system for handling user registration/login/authentication, and more).
Given that Django is also very popular and even more featureful, why do we teach Flask at Rithm School?
"Abstraction" is a term that gets used a lot by software developers. A good working definition is "to hide the complexity of an operation, so that the user of a system need only understand the interface and how to use it." For example, a well-designed car will have obvious things like gas pedals and brakes for us to interact with; the internal workings of the drivetrain or engine should be hidden away from us, so that the average driver need not worry about them.
Software libraries can be thought of on a scale of lower abstraction to higher abstraction. A higher-abstraction library may offer higher-level features, like user login/registration/authentication, so that a developer using the library need only learn about a handful of methods like
checkLogin(), etc. A lower-abstraction library might focus more on providing lower-level tools, like the ability to return a form to a browser, and to store information in the server memory. Out of those components, you can build your own registration/login/authentication system.
High-abstraction frameworks can be delightful (for many years, I was one of the authors and contributors to Plone, a very high level Python web framework), but they're often the wrong end for learning developers. They can hide the fundamental ideas of web applications (requests and responses, how sessions are often built out of cookies, how form data is sent and read, etc). Most web developers will benefit from understanding these concepts.
High-abstraction frameworks often prove very challenging for learning debugging: when you have a bug in your web application built with a higher-abstraction framework, you'll end up chasing your bug into the code of the framework itself - a daunting proposition in a product with tens or hundreds of thousands of lines of code! It takes time to learn how to feel whether you've a bug in your code or are misusing a sophisticated API. Starting with a higher-abstraction framework can make this more difficult.
At Rithm, we start with Flask so that students will be "close to the ground" - they'll get an solid understanding of the fundamental components of modern web applications. When things break, they'll have a strong ability to debug their applications. When they want to understand where performance problems exist, most of the important code will be theirs, and thinking about finding and fixing these problems will be beneficial for their understanding.
Of course, higher-abstraction frameworks have a lot to teach learners, too. They're often systems built by developers with deep expertise in the domain space of the problem: Django, for example, was built by developers with years of experience building web applications at a lower level, and therefore captures common problems with well-thought-out solutions. Understanding the choices it made and the patterns it uses will be beneficial to new developers looking to understand how to design application.
We think that this kind of learning is best down after one has a good sense of the underlying components. It's typically most helpful to learn something when you have active questions or curiosities (you'll retain more!) Approaching a product like Django after learning Flask will make you even more receptive to learning what Django has to teach: you'll get to compare how you built your user system with theirs, and will understand more of the subtle design and security challenges of this problem, and how experienced developers would handle them.
A good pattern, therefore, is: start learning first with a lower-abstraction library, to get a feel for the problem space and the components that make up a good solution. As you get a good sense of this, investigate and learn about higher-abstraction libraries, which may offer you faster development by leveraging those higher-level features.
Written by Joel