Let's Code Like it's Nineteen Ninety Five!

Language butchery by Mr Rich on  15.3.10 @ 00:16

So I've taken two quarters of C++ now and I realize that I haven't made much use of C++. Oh sure -- I've used class and new/delete, but that's about the extent of it. Oh yeah -- I can declare a variable wherever I want (ooo!) But, one eventually realizes (although it was pointed out to me) that the difference between a struct and a class is semantical.
  • The default protection for a struct is public;
  • the default protection for a class is private;
  • both can have public and private members.
That said, I don't want to bash an instructor, nor an institution. Both know far more about writing code than I do. But my point is "this" (that's a C joke, BTW):
  • If you want to teach programming using C -- great! ...Use C.
  • If you want to teach programming using C++ -- great! ...Use C++.
  • But for fsck's sake: if you are going to teach C++ like it's C -- please.... at least teach us how to use malloc(), realloc(), and free()!
For the life of me, I cannot understand why we need to spend two quarters dealing with C-Strings. Yes... I get it: we need to terminate a string with '\0'. But even Bjarne says that the Standard Library is there so that we don't have to reinvent the wheel! Isn't C++ supposed to be a better C?

Function ponters: Here's my favorite quote about their use in classes:
"..The operator ::* is used to point to a member of a class. ..... The syntax for ponters to member is a little convoluted and not terribly useful. Ive only seen it once used by an *extremely clever* programmer [ed: not a compliment from this author]. ... and the first maintenance programmer who got the code immediately ripped it out"
- Steve Oualline, Practical C++ Programming, 2nd ed.
... Do we need to understand how to use them? Maybe. One other person put it in terms of "this is actually a good use for a macro..." But using them to point to static functions to a class? Where is the gain? Why not just declare a function w/o a function pointer? Isn't it better to be fscking explicit than to be clever?

Oh well... on to Finals.

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?