http://qs321.pair.com?node_id=319128

Hi Monks,

oop dogs me. Several times during my longstanding activities with computers i made efforts to understand and spiritualize the mechanisms of object-oriented programming.

In the end all these attempts remained fruitless. I mention the reason for this defeat was the missing practical use.

That changed with perl. The esoterics began to vanish when i saw the way perl puts oop into action. The use of blessed hashreferences showed me the "simple" way perl realizes objects. Though i'm mostly still a "sequential" programmer, i think i've understand oop fairly and i'm able to use it. Meanwhile i wrote a few applications which successful use the advantages that come with oop. On the way to realization some great "aha-experiences" happened to me. Especially the polymorpistic behavior of objects impressed me and made programming in some cases much more easier and clearer.

But it seems that my efforts went into a false direction. Everywhere i can read that neither perl nor C++ is suitable for real oop. Even with Java one isn't sure if that is. "The one and only genuine oop-language is smalltalk".

How shall i interpret these statements. Are these postings kind of "religious wars" or is smalltalk really the philosopher's stone regarding oop? In other words:

is it worth making the effort to learn smalltalk and does it bring benefits to the practical daily work or is it more of academical interest ?

I would like to know what you think about.

regards and a happy new year, tos

Replies are listed 'Best First'.
Re: is it worthwhile to learn smalltalk ?
by BrowserUk (Patriarch) on Jan 06, 2004 at 15:12 UTC

    Personally, I would say learning smalltalk was very valuable, though it is quite hard. When I did so, I was programming C at work and smalltalk at home in the evenings, and that made it doubly bad IMO. Switching between purely procedural and purely OO I found to be very difficult. Then I landed a job doing smalltalk full-time for a short time, and it got much easier.

    That said, if your daily lot requires scripting more than complex (gui) applications, you might consider looking at Ruby. It gives you much of what you have with perl, but from an (almost?) pure OO perspective.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Hooray!

Re: is it worthwhile to learn smalltalk ?
by adrianh (Chancellor) on Jan 06, 2004 at 15:16 UTC
    But it seems that my efforts went into a false direction. Everywhere i can read that neither perl nor C++ is suitable for real oop. Even with Java one isn't sure if that is. "The one and only genuine oop-language is smalltalk".

    Smalltalk / Java / Perl / C++ all have different approaches to OO. I wouldn't say that Smalltalk is the One True Way - but it certainly concentrates on an OO approach that, to some extent, doesn't match the C++/Java view of OO.

    is it worth making the effort to learn smalltalk

    Yes.

    and does it bring benefits to the practical daily work

    Yes.

    Then again, my view on the question "Should I learn language X?" is nearly always "yes". Learning more languages is a good thing. It helps you separate out language-specific features from more general concepts and helps you find the right tool for the right job.

    Smalltalk is a fun language, and an influential one. Worth learning in my opinion. It's also very easy to get into since we have the free Squeak Smalltalk-80 implementation to play with.

    I'd also recommend Kent Beck's Smalltalk Best Practice Patterns as reading material. Not a tutorial, but tons of fascinating nuggets.

Re: is it worthwhile to learn smalltalk ?
by hardburn (Abbot) on Jan 06, 2004 at 16:30 UTC

    IMHO, not only should you learn as many languages as possible, but you should aim to learn languages that are as far away from your normal language as you can. These days, most developers work with languages that are directly derivied from C (C++, Java, and Perl are all examples). They may be only vagely reminicient of C, but C's influance is undoubtable on all of them.

    It would therefore do most developers well to try to find a language that is almost but not quite completely unlike C. For instance, a few weeks ago, I began dabbling in OCaml, inspired by MJD's strong typing talk (where he shows how ML's strong type system actually caught an infinte loop bug (!))

    I've never used a strongly typed language before, and before I read MJD's speech notes, I had assumed that such a language would be even more annoying than C's type system. Now I know that it's C's brain damaged types that are the problem, not strong typing in general.

    Perl will give you great flexibility in writing your code. If anything, this only makes learning other languages more important, as opposed to sitting in Perl's sandbox. Even if you never code in those languages, you'll probably end up coding similar ideas in your Perl code and other languages that you use often.

    Someone (demerphq?) said in the CB a while back that they've been programming LISP for so long that they really ought to learn the language. Functional programming, as in LISP or ML, is possible in Perl, but Perl isn't necessiarily the One True Way to do it (in fact, it quite likely isn't, since its version of functional programming is just one aspect of Perl, whereas its a fundamental part of OCaml).

    So go ahead and learn Smalltalk. For that matter, learn INTERCAL (a language so annoying that it uses DO NOTE THAT for one-line comments). The important thing is to be immersed in as many different styles as possible.

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    : () { :|:& };:

    Note: All code is untested, unless otherwise stated

Re: is it worthwhile to learn smalltalk ?
by hding (Chaplain) on Jan 06, 2004 at 15:35 UTC

    IMHO it's well worth the time. Smalltalk obviously has a very pure approach to OOP (though I'd shy away from saying that it is the only genuine OOP-language, or even the only reasonable approach to OOP), and I think that learning Smalltalk helped me really get a handle on OOP.

    It's not necessarily impractical, either. I know that if in the future I had occasion to develop certain types of Windows-specific applications (mostly notably, but not restricted to, the types that VB is aimed at) I would use Dolphin Smalltalk in a heartbeat (and I have used it for a few such in the past). More cross-platform enviroments like Squeak and VisualWorks are also fine Smalltalks.

    The book I recommend for an introduction to Smalltalk is Chamond Liu's Smalltalk, Objects, and Design.

Re: is it worthwhile to learn smalltalk ?
by coreolyn (Parson) on Jan 06, 2004 at 15:39 UTC

    For myself I dabbled with Squeak a couple of years ago out of curiosity. Since then I've noted that all the good devleopers I work with (ok they're mostly Java developers) had smalltalk expirience. The brief dabble in the smalltalk arena definately provided me with a better base from which to discuss OO concepts no matter what language I'm having to deal with

Re: is it worthwhile to learn smalltalk ?
by Aristotle (Chancellor) on Jan 07, 2004 at 17:19 UTC
    I once read a metaphor that has really stuck with me: each of the different paradigms of programming are like different kinds of cooking. So if all you know is imperative programming, it's like all you can do with any food is roast it, and if all you know is functional programming, it's like all you can do with food is boil it. Sure you could easily get by that way, but that would be a boring cuisine, wouldn't it? You couldn't even reasonably cook every kind of food. The more of the various programming paradigms in their purest form you've understood, the more apt at solving all kinds of problems you will become.

    Makeshifts last the longest.

Re: is it worthwhile to learn smalltalk ?
by astroboy (Chaplain) on Jan 08, 2004 at 10:33 UTC
    I too, used to have a bit of trouble wrapping my head around OOP. Tried Java at home, but without any real projects, it was just playing, and nothing sunk in.

    So what I did was this: I purchased Damian Conway's book on OO Perl, and took in as much as I could. Then, for my next couple of Perl projects, I used OO rather than procedural logic, even though OO wasn't really required. It just forced me to get used to the idiom, and when I got stuck, I'd return to D's book. Now, when I use Java or even C#, I'm easily splip into OO mode.

    (BTW: now that I've got what I needed out of OO Perl, I don't use it that much. I like it, but my work generally requires me to knock up quick scripts, and OO Perl isn't really required. However, I'm grateful to the CPAN contributors who offer OO interfaces -- they make my life easier)
Re: is it worthwhile to learn smalltalk ?
by fx (Pilgrim) on Jan 08, 2004 at 21:43 UTC

    I, too, would like to say that learning Smalltalk is a good exercise. I took it on after I learnt C and then I discovered Objective-C. Now that was fun :)

    I've never found work with Smalltalk (or Obj-C for that matter) and I don't know whether there is much call for it. I work for one of those big "blue chip" companies that are always advertising on Jobserve, etc. They like big well know things from big manufacturers so there is a lot of call for Java, C++ and .NET. Perl, for my company at least, is extravagant - I don't think I'll ever see them approaching me for Smalltalk :)

    However, getting back on-topic (loosely though it is :), I'd say go for it - it really helps with OO thinking.

      HI, NOw in this current generation working on small talk is good for a java programmer to begin the career in opps as there is no much much opportunities in an organization for java