[Dev] Reading circle

Tom Bryan dev@trilug.org
Sat, 9 Mar 2002 20:47:39 +0500


On Sunday 10 March 2002 04:16 am, Tanner Lovelace wrote:
> On Sat, 2002-03-09 at 01:52, Tom Bryan wrote:
> > P.S. And I still haven't complained that to get any sort of generic
> > container in C++, you'll also need to understand templates.  Not a bad
> > thing, but just one more hurdle to cross before you can effectively write
> > OO in C++.
>
> And it's a good thing you didn't complain about it, because generics
> are not OO.

No, but it's difficult to write a Java application without eventually using a 
Collection, and it's difficult to write a C++ application without eventually 
using a vector, map, or some other templatized class.  With Java, I'm still 
in the OO world when I do that.  With C++, I also need to learn templates 
well enough to use them.

> That C++ is hard to learn is a common misconception.  

I'm not sure that I said that C++ is hard to learn.  I just think that it can 
be harder to learn OO using C++ as a language.  That is, if one already knows 
C, then it can be difficult to escape old C habits when using C++.  If one 
doesn't know C, then C++ is probably a more difficult language to learn than 
Java or Python, for example.  

> C++ is pretty much unlike any language out there.  It's not a pure
> object oriented langauge.  

Right.  I appreciate what C++ is, but if one's focus is "I want to learn 
about OO programming," then all of these paradigms supported by C++ can make 
focusing on OO difficult.  Not that OO design is some sort of Holy Grail of 
programming, but it is significant and important in many areas these days.  
If someone came to me and said, "I know Fortran, C, and assembler, and I'd 
like to teach myself OO.  What do you suggest?"  I would honestly recommend 
learning Java or Python.  The language itself (grammar, etc.) is pretty small 
and easy to learn.  The libraries both have an OO focus, and programming 
using OO techniques is easy and well-supported by both languages.  

> The point is, however, that C++ is a fairly misunderstood language.
> It supports more than just OO and to use it effectively you really
> should learn it on its own merits, not as a superset of C, or as
> an OO language, but as C++.  C++ is a powerful language, much more
> so than any other language out there right now.  

If I grant you that, then I would probably still recommend that someone take 
a detour into a language like Java where it's easy and natural to focus on 
OO.  Once the developer has an OO mindset, then the OO part of C++ will be 
much easier to learn.  

> Unfortunately, most people don't understand it well enough to make 
> good use of it.  In my opinion, that's not necessarily a problem with the
> language but rather a problem with education.

That was part of my point: "most people don't understand it well enough to 
make good use of it."  Given that, it seems like a poor choice to use as an 
implementation language while teaching yourself OO.  It is also difficult to 
make a business case to use C++ if most people who know the language won't be 
able to make good use of it.  Then again, one could probably make the same 
argument about most languages. :)

trying-hard-not-to-start-a-language-war-ly y'rs, 
---Tom