Hacker News new | ask | show | jobs
by edgyquant 1400 days ago
I’m a bit crazy but taking an old monolith and slowly pruning and refining it into a codebase that would make a mathematician blush is soothing to me.

Like a bonsai tree. There’s a point where you’ve written enough helpers (complete with tests) and abstracted away logic from the views when you suddenly are able to rapidly refactor all of the crap that’s left and when you’re done the resulting codebase can be easily distributed or scaled.

So I’d start by just breaking the data away from logic and then break that data away from the database with the idea being to use a redis server as your apps data model which you can call some function to sync to the database from time to time.

Then build an event logger that encompasses everything (every interaction at least) that happens on the front end (this is trivial with JavaScript on events.)

then spin up two nodes of it and write some function that merges two of these event trees (sorting by timestamp + pick a bias for when two events happen at the same time.)

It won’t scale to 1000 users, and you’ll find kinks to work out along the way. But this is a good start