Go-lidus
I'm finishing this week's Skill Issue up having just returned from getting my shoulder checked out. I was worried I'd seriously injured my left rotator cuff. Rotator cuff injuries can be be bad news. It can take surgery to repair them and can involve months of recovery.
The good news is that I don't need to put the rest of the hockey/surf season on hold. I just aggravated it playing hockey and then slept in an unusual position a couple nights in a row, further upsetting it. Returning to sleeping on my back and a few daily exercises will have me back on the ice later next week.
I'm learning Go. Whenever I learn a new language, I think to myself, "what would it look like if I rewrote Solidus in $LANGUAGE?" It's always an interesting thought exercise, but I always arrive at the same conclusion.
Before thinking about what Solidus in Go would look like, let's examine what you get from Solidus out of the box:
- Solidus comes with styled, ready to launch storefront. Most stores will customize this heavily, restyling nearly all of it, but it works out of the box.
- Solidus comes with an extensible admin UI. Most stores will add new pages and interfaces to the admin, allowing them to manage custom models and facilitating common workflows.
- Solidus comes with a JSON API1. This facilitates integration with third party services and allows for building more dynamic frontend experience. Some stores even leverage the API to use Solidus as a headless eCommerce solution.
More important that any single Solidus feature, the platform is extensible in a way that no other platform is. Both Rails and Ruby allow you to do things that aren't possible in other environments.
First, Ruby allows you to dynamically redefine functionality on any class. If some method on an upstream class in Solidus (or any gem) doesn't work the way you want, simply install Flickwerk in your project and write a Zeitwerk-compatible monkey-patch. Problem solved.
While monkey-patching is usually only used a last resort, it's undeniably useful. Without it, every store that needed to customize core behaviour would either need to (a) fork Solidus and make their customization to the fork, or (b) add a customization hook to Solidus, get it merged, and upgrade to the latest bleeding-edge version. Too much work.
But let's set aside the whole monkey-patching thing. Let's just look at the extension point situation. You can drop Solidus into an application with its own User model and plug that in. There'll be a little bit of work, to get everything wired up, but it works fine. I've done it plenty of times.
If I wanted to reproduce Solidus in Go, it wouldn't have any of the dynamic extensibility of Solidus. The extension system would involve a shit-ton of non-trivial, intertwined interfaces. It would be much harder to understand and modify.
The database layer would be... honestly I don't really know how you'd accomplish anything that even vaguely resembles what's in Solidus. Shipping the core schema would be trivial, but augmenting it with new columns and tables and allowing Solidus to access them, that's another story.
I'm thinking specifically about the moving parts of the pricing system. Host applications would need to be able to customize the logic of how prices are selected (in the context of an order update or a web request) and augment the database table that holds prices with new columns that hold the new parameters for the system. All this would need to be done in a way that allowed Solidus to access the data as well.
Anyway, I'm rambling. If we rewrote Solidus in Go, it'd be prohibitively hard to allow for the level of customization that Solidus currently has. It'd be a lot faster, though.
Probably best to leave it in Ruby.
I love prog rock. I'm particularly fond of bands like Yes, ELP, and Genesis. The Lamb Lies Down on Broadway and Selling England by the Pound are classics. Don't get me started on Close to the Edge.
Somehow, it took Hällas releasing four full length albums for me to realize they exist. Their new album, Panorama, features hints of all the bands above wrapped in heavy, psychedelic proto-metal package.
I'll admit that I'm only half way through the album as I write this, but I guarantee this will be on heavy rotation around here for the next little while. Then there's the back catalog to explore.
-
Not a JSON:API API. Just regular JSON. ↩