Re: Clean code vs. efficiency
"Christophe r Benson-Manica" <ataru@nospam.c yberspace.org> wrote in message
news:c7quih$1om $1@chessie.cirr .com...[color=blue]
> Yesterday I changed some code to use std::vectors and std::strings
> instead of character arrays. My boss asked me today why I did it, and
> I said that the code looks cleaner this way. He countered by saying
> that he was regarded the dyanamic allocation that C++ STL classes
> perform as being very inefficient. He also said that he wasn't
> particularly interested in clean code (!). My question to the group:
> In what situations, if any, would you use fast but hackish C-style
> code in favor of the convenient STL classes?[/color]
Frankly, it sounds like your manager doesn't *really* know what he's talking
about. There is far, far more money wasted on fixing and customizing and
maintaining hard-to-read code than there is lost on inefficient code. Now
it just could be that your compiler does a crappy job with these things and
it is slow. But on the other hand, it still might not matter! (Does it
really matter to the user if something takes .03 seconds or .01 seconds?)
"Christophe r Benson-Manica" <ataru@nospam.c yberspace.org> wrote in message
news:c7quih$1om $1@chessie.cirr .com...[color=blue]
> Yesterday I changed some code to use std::vectors and std::strings
> instead of character arrays. My boss asked me today why I did it, and
> I said that the code looks cleaner this way. He countered by saying
> that he was regarded the dyanamic allocation that C++ STL classes
> perform as being very inefficient. He also said that he wasn't
> particularly interested in clean code (!). My question to the group:
> In what situations, if any, would you use fast but hackish C-style
> code in favor of the convenient STL classes?[/color]
Frankly, it sounds like your manager doesn't *really* know what he's talking
about. There is far, far more money wasted on fixing and customizing and
maintaining hard-to-read code than there is lost on inefficient code. Now
it just could be that your compiler does a crappy job with these things and
it is slow. But on the other hand, it still might not matter! (Does it
really matter to the user if something takes .03 seconds or .01 seconds?)
Comment