I really enjoy reading these articles comparing different implementations in different languages. I wish we had more of that on HN.<p>Concerning the article, call me grumpy if you want, I like better when there is no mass overloading even thought it's more verbose. From my maintenance experience working on various project, I always cry when after 3 hours of searching I find that "+" is overloaded and that's where the bug was hidden.<p>Also, for this particular implementation, we could simply use a builder.<p>SearchBuilder sb;<p>sb.equal(Search.Name, "..");
sb.equals(Search.AGE, ..);<p>Search s = new Search(sb);<p>Even thought it's more verbose, we clearly see that we configure the builder as we want, and then, we create the search object. A good side effect of that is that we get an immutable Search object. Also, we could use the "fluent" interface on the builder.<p>Another verbose approach might be using lots of Objects..<p>Search s;
s.add_contraint(SearchEqual(Search.Name, "bob"));<p>This way, it make it easier to add constraint without modifying the Search class.