Re:Ruby 4.0.0 Preview2 Released
by dmux on Wednesday November 19, 2025 @02:38PM
(#45984053)
I inherited a project where this was taken to the extreme. We have a class that's used to calculate final pricing taking into account discounts, coupons, shipping fees (or free shipping). Each one of those values was implemented as methods but then we have a call like: method_a - method_b + method_c, but it turns out, method_a may be adding shipping_cost for it to then be subtracted out in method_b. We ended up refactoring this and removing all the needless methods and just have a simple inline calculation. Definitely not "clean".
[ Parent
| on HN ]
There are no comments on this comment yet.