On Monday 09 February 2009 10:02:37 am tedd wrote: > Hi gang: > > At the college where I teach, they are considering teaching OOP, but > they don't want to settle on a specific language. > > My thoughts are it's difficult to teach OOP without a language -- > while the general concepts of OOP are interesting, people need to see > how concepts are applied to understand how they work -- thus I think > a specific language is required > > I lean toward C++ because I wrote in it for a few years AND C++ > appears to be the most common, widespread, and popular OOP language. > > However, while I don't know PHP OOP, I am open to considering it > because of the proliferation of web based applications. My personal > opinion is that's where all programming is headed anyway, but that's > just my opinion. > > With that said, what's the differences and advantages/disadvantages > between C++ and PHP OOP? > > Cheers, > > tedd I definitely agree that teaching OOP without a language to write it in is a very stupid idea. However, part of the problem is that there is in practice no one version of OOP. Java is probably the best example of academically pure "classic OOP" (that is, class-based). That can be good for teaching, but it can also suck for developing because you have to do things in an academically formal way. Javascript, on the other hand, is a prototype-based language. Technically that's also OOP, or can be, but the code is entirely different conceptually when functions, methods, objects, and classes are all the same thing. :-) PHP's OOP is very closely modeled on Java's, but with some interesting additions. PHP 5.3 adds a few more and 5.4/6.0 is likely to add traits, which are another animal entirely. PHP is also a hybrid language and, by nature of being a shared-nothing scripting language OOP is often the wrong choice because of the setup and initialization costs. C++ has "a little of each", albeit in a frequently convoluted way. It also has about 30 more types of access control than any other language I know, for better or worse. LISP is its own creature, closer to Javascript than to anything else I just mentioned. (Or arguably Javascript is closer to LISP.) Personally, I recommend teaching programming first in C++. Force them to do the hard stuff so they appreciate what the runtime is doing for them in higher level languages. It also means you can teach procedural and OOP in the same syntax. Then once they've gotten a few bruises in C++, expose them to Java, Javascript, PHP, etc. to let them see what higher level work actually gets done in these days. -- Larry Garfield larry@xxxxxxxxxxxxxxxx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php