|
|
|
|
|
by ddfreyne
5313 days ago
|
|
If I were implementing this, I would go for an implementation where my Criteria objects are immutable. To me, it seems that code like crit1 = Criteria.new.where(:name => 'Jeff')
crit2 = crit1.where(:age => 19)
would result in two different criteria, which is not the case. “crit2 is the original criteria where age is 19” makes sense, but I would not expect that to update crit1.I don’t mind mutability per se, but it needs to be clear what data is mutable and when it is mutated. |
|