Algorithms make it more complicated in way that you have to remember them and utilize them. It's far easier to just call a member function and let it do the algorithm for you. I like abstracting away things.
And unfortunately, I have never sorted an array or vector (or at least never via sort algorithms), at least for what I can remember.
It's not more complicated, but it defiles the way of having the object perform the action.Would you say that given the two following options the second is poor programming?
Exactly how is the second way more complicated?Code:string s; s.to_lower(); //hypothetical member function to_lower(s); //boost/algorithms/string.hpp
The first example is like using a car to drive it into place while the second way is like tossing your car keys to someone else and saying "Hey you! Drive that car into the garage!".
(While you may or may not trust that someone is out of context here.)
I prefer to do it myself. The string itself should make itself lower. It knows best itself how to do it anyway.
I don't like utility functions that do it an indirect way.
I like typical .NET/VB style frameworks. Everything is organized neatly into classes who has member functions to do things. It makes it easier to use (you know what functions exists directly and can use them w/o consulting the manual to find an appropriate utility function), less headache to find functions and use them, as well.