So I'm a solo developer and I have problem with my small product(saas 2 client)
So this app is handling my client main business transaction like selling their services. I saved the transaction detail into a record, who is the client, how much the cost, what services is it.
Then my client also want the app to have accounting feature
Problem is I find it hard to design the system
My current approach is on every transaction record it have a child record (the accounting journal postings)
And I copying value and detail from the parent object to child object, that is needed for accounting task.
every time the parent object is saved(rails callback)
is it bad practices? Should I just refer the value instead copying it?
But if I refer the value instead copying it I think I will meet with query complexity problem
If the value can be changed or deleted, it's a whole different story. Denormalization of a data point is isomorphic to caching it (you store it nearby to avoid getting it from far away). And caching is a notoriously difficult problem in computer science. It is very easy to screw it up and make your data internally inconsistent. It is arguably a worse problem to have than slow or complex queries, especially because you might not even know that you have it.