Hacker News new | past | comments | ask | show | jobs | submit login

There is no consistency problem.

Every product has a price, every product listed on an order has a price, these aren't necessarily the same thing. What if the order includes something that the manager threw in for free to sweeten the deal? The price of that product on that order is zero, but the product's list price at any given point in time was not zero.




I didn't say there is a consistency problem, I quoted FTA.

My suggestion actually has nothing to do with the price of the object, it only has to do with the server state of the object (product) and whether or not that state was updated (price, quantity available, etc...), which is what the article was worrying about (the lost update problem).

i.e. if the underlying objects in a transaction changed between the time a client retrieved information about the object and the time where a user was interested in creating an order with the object, in a way which might invalidate the transaction, I'm highlighting a potential solution to notifying the client.

     What if the order includes something that the manager 
     threw in for free to sweeten the deal? The price of
     that product on that order is zero, but the product's
     list price at any given point in time was not zero.
Well, in that case, I hope there is a system the "manager" can create a discount object to and attach it to the order.

     PUT /orders/12345?discount=FREE_IPAD_YO
     PUT /orders/12345;discounts [{"discount_id":"FREE_IPAD_YO"}]
     whatever flavor you want, etc...
Note: I don't work in the ecommerce domain, but I do develop systems which are often transactional in nature.


As the developer of a REST centric ecommerce platform[1], I agree. The price of an order item is specific to that order and does not necessarily match the product's base price. It may be calculated using special account pricing rules, tiered by quantity, or discounted by a coupon. In such a system I have found many occurrences where data has to be de-normalized for this reason. Although the the new state is derived, it may otherwise differ from the source. Not just a function of value and time.

1) http://getfwd.com




Consider applying for YC's W25 batch! Applications are open till Nov 12.

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

Search: