Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This profile example is missing the better approach: avoid the dependency of creating the user before creating the profile.

Create the profile with a generated uuid. Once that succeeds, then create the user with the same uuid.

If you build a system that allows orphaned profiles (by just ignoring them) then you avoid the need to deal with potentially missing profiles.

This is essentially implementing MVCC. Write all your data with a new version and then as a final step write to a ledger declaring the new version to be valid. In this case, creating the user is writing to that ledger.



Well, we're playing make believe with the requirements. In fairyland the user and the profile need to exist together. Only the fairies know why!

If you can relax the requirements, you can relax the constraints.


That's the point. Requirements are rarely as strict as we presume they are.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: