MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: OOP in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38035] Re: OOP in Mathematica
  • From: Richard Fateman <fateman at cs.berkeley.edu>
  • Date: Tue, 26 Nov 2002 00:50:24 -0500 (EST)
  • Organization: University of California, Berkeley
  • References: <A06E01A4-F12D-11D6-ADE7-00039311C1CC@tuins.ac.jp> <aqb22v$mkh$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com


Hermann Schmitt wrote:
> Hello,
> I think, when Mathematica was created, OO was not yet existent in
> programming languages.

You could easily learn about the history of OO.  Simula (1967), Smalltalk,
the variety of very sophisticated lisp OO systems: flavors, LOOPS, CLOS,
all predate Mathematica.

Wolfram claims Mathematica unifies various programming paradigms,
and if you don't look too closely, it does have many resemblances.
However, much of it is really implemented on top of pattern matching
and a kind of fixed-point evaluation. Thus details like scope, vital in
functional programming, were wrong initially (Block), and repaired so 
they are
better (Module) but still not quite right.

You also misunderstand the nature of language implementation and
design.  Mathematica or Java or Lisp..  are designed for various reasons.
Any of them can be implemented by an interpreter or via compilation.
Or both.   If you mean Mathematica is interactive, sure.  But that
does not mean it must be interpreted. In fact there is a compiler used
by numerical evaluation in plotting and a few other spots.


I think that it would be useful for you to learn about programming languages
instead of believing that all you need to know about programming languages
is that subset that appears in Mathematica or Java. There are many many 
textbooks
on the subject of programming languages.  I suggest you find "The Art of the
Meta Object Protocol" by Bobrow and Kiczales, if you wish to understand the
varieties of OO possible.

RJF


  I am astonished about the OO-like features, which are
> built into Mathematica despite of this. Into older languages OO must be
> built after they were created, and this is also done.
> In my opinion it is not the main criterion, that a program runs fast in that
> programming language. If this was the case you should program in assembler
> language. The fact, that Mathematica is an interpreted language shows, that
> other considerations were prominent, when the language was designed.
> Compiled languages are faster.
> The main criterion is in my opion is, that the program can be created easily
> and yet more important, that it can be easily understood and modified
> afterwards.
> I think, Mathematica is well suited, to integrate an OO-System.
> Hermann Schmitt.
> ----- Original Message -----
> From: "Andrzej Kozlowski" <andrzej at tuins.ac.jp>
To: mathgroup at smc.vnet.net
> Subject: [mg38035] Re:  OOP in Mathematica
> 
> 
> 
>>Well, it simply means that I do not agree with some of the things you
>>seem to think, that's all. Basically it amounts to the fact that
>>Mathematica was not meant to be used as an OO-langauge by Wolfram and
>>was deliberately not constructed in this way, unlike those languages
>>that are designed from ground up to be OO. So when you write in
>>OO-style you are simply  dressing-up Mathematica language in a foreign
>>paradigm and usually end up with less efficient code. Unlike what you
>>seem to think, I think there is a big difference between built-in
>>abilities and those added by users, and it shows itself in performance.
>>In fact being aware of this difference is the most important factor in
>>efficient Mathematica programming. This distinguishes Mathematica from
>>most other languages.
>>I don't really want to enter into any arguments which after all are
>>only a matter of opinion,  but I would propose the following
>>"objective" test of "good" OO package in Mathematica. The test is that
>>a proficient user cannot write easily a more efficient and equivalent
>>code without the package. So far I have not seen any "OOP" in
>>Mathematica that does anything in a way that I cannot do equally or
>>(usually) more efficiently myself without it. Unless an OOP package can
>>satisfy this requirement it will be used only by users who learned
>>their programming on other languages and have not adapted their style
>>to Mathematica.
>>By the way, I have a good reason to believe that Wolfram will introduce
>>some OOP into Mathematica, that will actually enhance rather than
>>reduce performance. I will then think of it as real OOP rather than
>>pseudo-OOP.
>>
>>Regards
>>
>>Andrzej Kozlowski
>>
>>
>>
>>On Wednesday, November 6, 2002, at 04:54 AM, Hermann Schmitt wrote:
>>
>>
>>>Hello,
>>>what do you mean with "pseudo"-OOP?
>>>Hermann Schmitt
>>>----- Original Message -----
>>>From: "Andrzej Kozlowski" <andrzej at tuins.ac.jp>
To: mathgroup at smc.vnet.net
>>>To: <mathgroup at smc.vnet.net>
>>>Sent: Tuesday, November 05, 2002 11:00 AM
>>>Subject: [mg38035]  OOP in Mathematica
>>>
>>>
>>>
>>>>Various have people have sent interesting examples of OO programming
>>>>in
>>>>Mathematica, as a proof that "it can be done". However, let me clarify
>>>>one possible confusion:  I for one have never doubted that "it can be
>>>>done". (In fact I have occasionally tried it myself). The more
>>>>doubtful
>>>>issue is "is it worth doing?", or "is it really the best way to
>>>>program
>>>>in Mathematica?".  I can imagine that OOP may be  useful for dealing
>>>>with large structures and there may be (as I have been told) some
>>>>performance advantages in introducing some OOP into Mathemaitca. But
>>>>none the examples I have seen here seems to me to gain much from
>>>>pseudo-OOP, which is in fact also the trouble with Maeder's package. I
>>>>have seen a couple fairly large project written using it (one is the
>>>>Object-Oriented Graph Theory in Chapter III of Grey's "Mastering
>>>>Mathematica"), but all of them can be programmed with no more effort
>>>>using the natural Mathematica "functional-pattern based" style.
>>>>
>>>>Andrzej Kozlowski
>>>>
>>>>
>>>
>>>
>>>
>>Andrzej Kozlowski
>>Yokohama, Japan
>>http://www.mimuw.edu.pl/~akoz/
>>http://platon.c.u-tokyo.ac.jp/andrzej/
>>
> 
> 
> 



  • Prev by Date: Re: Re: Number of cyclic subgroups of order 15 in Z_90 (+) Z_36
  • Next by Date: Re: Simplifying expression involving Log and I
  • Previous by thread: Re: OOP in Mathematica
  • Next by thread: Re: Different EPS exported file from frontend and kernel