3 ms·
This. Doing actions against an id is a shortcut. Deserialise the object from the db so you can make changes and verify integrity before serialization. Also all
by iovrthoughtthis 8y ago
This. Doing actions against an id is a shortcut. Deserialise the object from the db so you can make changes and verify integrity before serialization.
Also allows you to leverage the type of object your playing with.
No need for CartId types if your passing around Cart types. Which you probably already have.
- catern 8y agoI'd go further than saying "doing actions against an id is a shortcut". I say it's an antipattern. Ids should only ever exist at the edge of your system: When you're taking serialized data in and turning it into objects, or you're taking objects and turning them into serialized data out. That serialization should be handled completely separately from your application logic; you shouldn't see (non-opaque) ids in your application logic.