Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "osmium" Newsgroups: comp.programming Subject: Re: Object oriented programming? Date: Thu, 30 May 2013 10:49:25 -0500 Lines: 38 Message-ID: References: X-Trace: individual.net t0MH80FgOKjYRAKSEB0Rxg1iO/8fJCUMeZx3kzhiQ5vIFZfDrC Cancel-Lock: sha1:82rK0iYgeazbRPqZxC4cV2op64o= X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Xref: csiph.com comp.programming:3394 root wrote: > What types of programs lend themselves to OOP and what don't? Data base oriented programs surely lend themselves. You can have a reusable stack, linked list, tree, etc. Reusable being the key. In this case someone has already written these fundamental thingies and incorporated them in the System Template Library, STL. And STL is a fundamental part of C++. I think the best way to get started is to write your own string class. There is one in the STL, but writing your own is a big learning aid. A string class is a type on steroids, whereas a C int is wimpy by comparison. It will probably take a week or so to write, I actually did this and got it seriously wrong on my first pass. . A vector class is a nice illustration, too, and easier. Theorizing just (often) leads to snow jobs as you have already observed. As far as what *don't* lend themselves, that is a much harder question. IMO OOP is overused. If you give someone a toolmaker's microscope they will use it. Even if they are a plumber. Be warned that C++ has a lot of stuff that isn't OOP, I think the method was "As long as we've got the hood off, let's really tune this baby up." I'm thinking of function overloading, operator overloading, templates plus more I am too lazy to come up with. If you use '+' for string concatenation, you are using operator overloading. You could live without it. And since concatenation is not commutative, purity is not harmed. It is easy to get carried away. If I had more energy I would write a program to support a fictitious library. I think OOP lends itself nicely to this, and it is open ended enough that I think one person could die before he finished it. And since the spec is his, he can follow where his interest are. OOP is nice, but it is FAR from a silver bullet.