2 ms·
> Applications of Zero One Many. If the requirements go from saying “we need to be able to store an address for each user”, to “we need to be able to store two
by karmakaze 5y ago
> Applications of Zero One Many. If the requirements go from saying “we need to be able to store an address for each user”, to “we need to be able to store two addresses for each user”, 9 times out of 10 you should go straight to “we can store many addresses for each user”, with a soft limit of two for the user interface only, because there is a very high chance you will need more than two. You will almost certainly win significantly by making that assumption, and even if you lose it won’t be by much.
I agree in general, but for the address example in particular I can't remember how many times I have to provide a shipping address and a billing address, or residential address and mailing address, etc. I also can't remember any time interacting with a system that asks for 3 or more addresses.
- carlos_rpn 5y agoOn some online stores in Brazil you can have more than one shipping address, for example to send a purchase straight to parents, siblings, etc... and can select any of them on checkout.
- blacktriangle 5y agoThese situations are so common I've started building join tables for such data rather than simple foreign keys by default if there's even a wiff of the possiblity that there might be multiples. The downsides are so small and the upside is huge.