I’m pretty psyched about this. First, some background. As you may know, I’ve been working on an MVC framework on and off for the last four years. Mostly off. It’s called Gusto, apart from when it’s called Struct or Juego. It’s never been anywhere close to ready, and in the last four years I’ve kind of grown up as a programmer and gotten a bit disillusioned with the whole MVC thing. Also frameworks. So fuck MVC. Also frameworks. And that’s a blog post for another time.
In the spirit of modularity, Sodor is the C in MVC. It’s a standalone module to create Controllers (well, Routers, really), without any ideas about Models and Views and where they should go. It’s up to you to marshal the data and display it, but Sodor gives you a damn fine way of talking about how they fit together:
Firstly: any resemblance
Post may have to actual code is purely coincidental. They don’t exist. Yet. Secondly: Function parameters like
id become URL parameters, so the route ends up being
@put might look like decorators, but they’re actually class methods. Livescript’s has the class itself as the context within its body.
Pretty nice. Now, these classes don’t actually do anything on their own. Creating a class shouldn’t mutate a list of routes, or start a server, or do anything else spooky. Nah. Once you have your controller, you need to give it to Livewire:
Serve it up with fantasy-http and you’re golden.
There’s more to come for Sodor, some pretty interesting stuff in store for Livewire (streams rewrite, browser routing), as well as the promised blog post on MVC.
Shit, I can’t believe Gusto’s actually going to happen this time.