Joe Greer wrote:
>> This says to increase maintainability, we should minimise operator
>> overloading. I'm new at this and confused, I thought operator
>> overloading (used correctly) aided maintainability and readability?!??
>
> Well, it's a double-edged sword. If you are modeling a mathematical class
> where the normal operators are well-known and understood (i.e. complex
> arithmetic) then the overloaded operators make a whole lot of sense and in
> general are a good thing. However, if you are adding somewhat arbitrary
> meaning to the operators like having + sort do a search on a list or
> something, then it adds to the confusion level because the '+' symbol
> itself offers no clues to the operation being performed and worse it hints
> that some sort of additive action is taking place.
Right - that falls under the guidelines...
- overload operators to do the same thing as their native versions
- don't overload them to accomplish sophomoric pranks
- and overload them together in kits.
Except for <<
(-;
--
Phlip
http://www.oreilly.com/catalog/9780596510657/
"Test Driven Ajax (on Rails)"
assert_xpath, assert_javascript, & assert_ajax