To Framework, or Not To Framework? It depends!

I just responded to a post over on Alagad.com about using "homegrown" frameworks vs. using "regular" frameworks, and my comment quickly became a catalyst for a blog post of my own on that same topic.

Frameworks are a pretty common holy war these days. The phrases "always use frameworks!", and "which framework is best?" are both seen pretty regularly on blogs, message boards, or overheard at various user group meetings.

As a contractor, I don't always get to determine the requirements, or time lines, or technology stack that I have to be responsible for. And as such, I sometimes need to make difficult decisions.

[More]

Overloaded functions in C++

My teammate and I just spent a couple hours debugging an overloaded function:

We had a method foo( int num ) that was called passed a (char*):

foo( (char*)"test" );

...yet the integer version of the method was still being called, and quite happily at that! Huh!? It turned out to be the same issue noted here:

Here's the mess you're in: if Base declares a member function f(double x), and Derived declares a member function f(char c) (same name but different parameter types and/or constness), then the Base f(double x) is "hidden" rather than "overloaded" or "overridden" (even if the Base f(double x) is virtual).

Alas, my compiler doesn't like the noted "using" syntax, so I have to go about solving things the "long way" (either re-defining all the methods in my derived class, or renaming the derived methods so overloading no longer happens).

I can't believe I've never run into this "feature" of C++ before! And I can't believe this is how they chose to implement things! :)

It seems to me that if the method has a unique signature that's not redefined in the derived class, the compiler should happily look in the base class for that implementation. If I have foo(char) in my base class, but happen to have a redefined foo(int) in the derived class...why should it care? Assuming the data is always cast to the correct type, I fail to see why C++ requires we go through all this extra work.

If anyone can offer more insight, I'm very curious as to why C++ is wired this way.

--n

Delving (back) into C++

One of my main projects did a pretty big 180 last week. After demoing some functionality for a potential customer, the customer informed us that they'd prefer a command line tool over a web app (for use within various scripts and batch files they're running).

So for the next few months, I'll be switching gears and diving back into C++ work. It's been a while since I've worked on anything substantial in C++. This will definitely be a challenge for me over the next few months, getting (back) up to speed on the Boost library, and various other goodies.

Fortunately I have a few ColdFusion projects still in the works to help balance things out, and keep me sane. :)

 
BlogCFC was created by Raymond Camden. This blog is running version 5.9.003. Contact Blog Owner