2 hours ago · 8 min read1555 words · Tech · hide · 0 comments

I want to tell you a story about a problem I spent an embarrassingly long time debugging.The project I'm working on now is by far the most technically ambitious thing I've ever built myself. I have contributed to more technically ambitious problems, but I've never been the primary developer, or had to make as many foundational design decisions.One of the most complicated parts of the project has been managing ordered lists. It allows multiple clients to connect to a particular list and make ordering changes. It uses Sortable.js to manage changes to the order on the client, and then a Phoenix LiveView to persist those changes to other clients, and store them off in a database. I'm now on my third design for the "store in the database" part, and it took me over a year to get here.The Naive ApproachI started out implementing this with what seemed like a simple, straightforward implementation: Each item in the list gets a "position" field, and that position is an integer. The "move"…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.