So thinking back on my own experiences with web frameworks and also checking out some new ones, I’ve come across some thoughts that I wanted to put down in a post.
There’s a tendency to make two very different style frameworks these days:
The small frameworks include the micro frameworks which exist on a level just above responding to requests “by hand” to more complete frameworks that seem to offer a few nuts and bolts for you, but not everything you might need if you need to create something user based. Small frameworks might include just request routing and processing, or it might include templates, sessions, and maybe some testing.
The large frameworks aim at giving people the ability to write any application, even some complex ones. Often large frameworks are dubed full stack. These of course handle sessions, users, database interactions, routing, templating and likely include other pieces that will help you create an application.
The flip side to some of these front-end style systems is a (seeming) lack of data-facing application framework. I guess the closest thing I can think of are object relational mapping layers. But these tend to just be about representing data in a programming layer, not really exposing all aspects of a CRUD. It seems there is a gap between this and a front-end app. Front-end apps usually need something to talk to if data is involved and I don’t always see this readily available on their own. Where is there a framework that interacts with an ORM (or something), but provides a basic RESTful API, on it’s own with only a little bit of tinkering? Some of this is likely because data often relies on some sort of logic before it hits the front end. And by this point, we’re almost all the way back to our full stack frameworks.
Part of tonight’s exploration was based on the desire to take a piece (or two) from a more complex app idea I play with from time to time and distill that into a system app. So to lay out what the app entails on the technical side:
- Data in a database
- Basic functionality like login, logout, profile management, etc.
- Custom functionality mostly centering around some forms for inputing data
- Data output
The micro frameworks are often too simple to take this on. Perhaps they’re not too simple, just not well suited because you would go from simple, small, lightweight to I’ve written a bunch of code to do stuff other frameworks might offer me. Large frameworks offer all the pieces for what I want, but can often be a bit unwieldy when it comes to configuring some of the basic things. This is because they don’t want to assume what you are building. You could be building a session-less, user-less, pretty much static web app for all they know. Or you might have your own authentication layer you want to include. But with some configuration here or there, maybe some scaffolding and you will be pretty darn close to what I’m after.
This leads me to one of two conclusions:
- Pick your large framework and just do it. It’s more forward thinking, you get what you need and often can find examples or contributed code.
- Pick one of the more robust small frameworks and deal with the extra overhead. Most of it is likely not too complex.
But that said, I’m not sure if it’s via scaffolding, via configuration, or if this reaches too far into the land of providing too much magic, but I would love a framework that let me say something like:
- A have a database with some data in it
- I want sessions and users
- Users should be able to sign up at: /register
- Users should be able to login at: /login
- Users should be able to logout at: /logout
- They can view their profile at: /profile
- And I simply want to add/edit/delete data from the database
This ideally would be mostly “configuration” (for lack of a better term) and would be pretty simple. Maybe this means it then scaffolds out code (not my favorite thing) or maybe it can import the pieces I need and live with the configuration influencing that. Maybe this exists. Perhaps it’s even something I am familiar with and am just glazing over. This is my rambling thought exercise for the evening. What do you think?