From: <zee...@ne...> - 2008-09-02 06:29:33
|
Hi Dave, The code base I am working in ( 1.5 million lines) is a mixture of C and C++, and pre ISO C++ at that. I have become pretty good at intermixing C and C++ in an OOP manner. I originally learned OOP in the mid '80s, with Smalltalk. This was on an IBM mainframe after hours at work, but at home, all I had was Pascal and C ( on OS/2 :) ) So I learned to do OOP by using structs and pointers to functions and a lot of programming rigor. Hell, these days, even my personal ksh scripts are usually at least OOD. Though this stuff is not for novices and even most experienced programmers have trouble wrapping their minds around it. And don't worry, I never get that esoteric in team coding :) Most C with C++ projects I have seen, are written by those who think that OOP requires an OOP language. The result is procedural OOP or POOP for short. On top of that, C++ just plain encourages POOP. The problem is that for some things, the standard C libraries are superior to the C++ replacements. And in many ways the STL is a flawed design ( product of a politically influenced committee, as was the flawed C Standard Library. Thats life.). The trick is to wrap the C stuff up in an OOP manner. Hacks should not be necessary. All it really involves is developing a programmatic idiom for the C and a lot of programming rigor to stick with that idiom. Its kinda like driving without street signs and markings. Speaking of rigor, the problem with C++ is that it too requires a lot of rigor to not end up with a pile of POOP. If a method has more then five lines, its probably a piece of POOP. My first rule of architecture is: If one needs to jump through hoops to implement something, the Architecture is flawed. The second is: If a hack is needed, the Architecture is flawed. My first principle is: Flawed architecture is usually the result of either functionality in the wrong spot or *intermixed programming paradigms*. As you are a new man on the team, you might not have much say in architectural decisions. But if and when you do, push for isolating the C from the C++ and push for mucking out the C++. Or better yet push for abandoning C++ all together ( have you looked at Objective C?) thx bob P.S. Sorry for getting so wordy. You probably know most of this stuff already. But I've been under my truck all day and I think my mind has gone into thermal shutdown! BTW, I'm putting a Weber 390 on a water heated intake so as long as I stay mellow, my mileage should be reasonable. A well tuned straight 6 can be quit efficient ( I hope :l ) ____________________________________________________________ Boost your productivity with new office software. Click now! http://thirdpartyoffers.netzero.net/TGL2231/fc/Ioyw6ijlZW9Zz5h2Pqwp2BTm1kbUWh4PXZDeEgZzcTRjGmlDu60EBm/ |