Re: Mathematica Programmer vs. Programming in Mathematica

*To*: mathgroup at smc.vnet.net*Subject*: [mg63127] Re: Mathematica Programmer vs. Programming in Mathematica*From*: "Steven T. Hatton" <hattons at globalsymmetry.com>*Date*: Thu, 15 Dec 2005 03:06:35 -0500 (EST)*References*: <200512130841.DAA08238@smc.vnet.net> <dnopbs$2g9$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

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: http://www.mathematica-users.org/ Math for Comp Sci http://www.ifi.unizh.ch/math/bmwcs/master.html Math for the WWW: http://www.w3.org/Math/

**References**:**Mathematica Programmer vs. Programming in Mathematica***From:*"Steven T. Hatton" <hattons@globalsymmetry.com>