MathGroup Archive 2005

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

Search the Archive

Re: Mathematica Programmer vs. Programming in Mathematica

  • To: mathgroup at
  • Subject: [mg63127] Re: Mathematica Programmer vs. Programming in Mathematica
  • From: "Steven T. Hatton" <hattons at>
  • Date: Thu, 15 Dec 2005 03:06:35 -0500 (EST)
  • References: <> <dnopbs$2g9$>
  • Sender: owner-wri-mathgroup at

Andrzej Kozlowski wrote:

> I have read all three of these. I also have the issue 3.1 of the
> Mathematica Journal.
> This gives me an opportunity to make a correction. I have mentioned
> that  Maeder's classes package is used in Gray's book "Mastering
> Mathematica", but now I checked it and found that he does not
> actually explain the package but shows various examples of its use.
> Here are a couple of quotes from Mastering Mathematica:
> "The key concepts in OOP are object, class, message, inheritance,
> new, self, and super. These are all implemented in Maeder's package
> Classes.m from [Maeder 3]. We won't attempt to explain how this
> package works. Suffice it to say that it is an ingenious combination
> of all of the facilities that are available in Mathematica, based on
> the ideas discussed above. The package is included in the diskette
> supplied with this book and will repay careful study.

He also says: "Although Mathematica does not provide any built-in support
for object-oriented methods, a recent package by Roman Maeder in [Maeder 3]
called Classes.m, implements a full-blown object-oriented extension to it.
This package does not make it possible to do any calculations that couldn't
be done before; it just makes it possible to completely rearrange the way
in which they are carried out. It is to be hoped that there will soon be a
hard-wired version in the underlying Mathematica C code."

> Both volumes of "The Mathematica Programmer" are very different from
> "Programing in Mathematica". The latter book is actually devoted
> entirely to writing Mathematica packages and isn't a particularly
> good guide to other aspects of Mathematica programming (it was the
> first book on Mathematica programming I ever read and I don't think I
> learnt very much from it).

I have read from several different books on Mathematica over the years. 
None of them provide a very good introduction.  I believe part of the
problem is that the authors tend to avoid explaining what makes Mathematica
"functions" different from functions in languages such as C.  Instead, they
seem to focus on the similarities.  A few diagrams such as are found in
_Interpretation of Computer Programs_ by Abelson and Sussman, and an
accompanying general description of the process of evaluation would have
been of great value to me.

With my newfound insight into Mathematica, I am able to read Maeder's
_Programming in Mathematica_ with considerable understanding.  I have read
all but the final few sections in Chapter 6 of Michael Trott's _The
Mathematica GuideBook for Programming_ (which I hope to complete soon). 
After struggling through that mind-bender, everything about Mathematica
seems easier.  I really should read the book again, after thoroughly
reading _The Mathematica Book_.

I have gained a lot from _Programming in Mathematica_.  I don't agree that
it is devoted entirely to writing Mathematica Packages.  To me that is
similar to saying something like '_The C++ Programming Language, Special
Edition_" is entirely about creating namespaces'.  Packages are merely a
(good) means of organizing code in Mathematica. Most of what Maeder
presents could easily be done in the Global` context.

> The
> explanation is pretty compressed: less than one page long.

I'm hoping there is sufficient development in the preceding chapters to
explain his implementation.  I have a used copy on order.

> The package is used again in Maeder's book "Computer Science with
> Mathematica" in the chapter on object oriented programming but again
> Maeder writes that the exact way how is works is irrelevant and
> refers the interested reader to the Mathematica Programmer.

He actually says it is "unimportant for our applications of object oriented
programming."  _Computer Science with Mathematica_ was one of the books I
read without much depth of understanding due to my lack of a solid grasp of
how Mathematica works differently from traditional procedural and
functional languages.  

I don't know how to design the presentation, but I believe Mathematica
should be taught first as a rule-based language, and the way functions are
implemented using rules should be explained before introducing Plus[1,1].
All examples in the introductory material should be presented in internal
form, and only after a fairly thorough presentation of how Mathematica
works at that level should the student be informed that he or she can
simply type 1+1 in order to say Plus[1,1].

The Mathematica Wiki:
Math for Comp Sci
Math for the WWW:

  • Prev by Date: Re: Re: Re: Solve Limitations
  • Next by Date: Re: Mathematica Programmer vs. Programming in Mathematica
  • Previous by thread: Re: Mathematica Programmer vs. Programming in Mathematica
  • Next by thread: Re: Mathematica Programmer vs. Programming in Mathematica