Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++ style question



Jerry Feldman wrote:
> This is more of a style issue. I have a standalone function that I want to 
> use in a number of different classes, let's call it foo.
> On one hand I could simply define and build the function in it's own C++ 
> file, or I could alternatively make it a class, either use the constructor 
> or simply define a static function. 

<rant>
One of the design elements rarely discussed these days is "what are you
optimizing for?"  Efficiency?  Effectiveness?  Speed?  Size?  Only
embedded programmers seem to care about this stuff anymore.

But there are other optimizations that are just as valid today, if not
more so.  Readability, maintainability, ability to handle bad input,
"principle of least surprise",....
</rant>

In this case, I would vote for simplicity.  With simplicity you usually
get readability and maintainability for cheap.  Creating a class doesn't
actually buy you anything but complexity in this situation, so don't do
it just because all the cool kids are.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org