MathGroup Archive 2005

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

Search the Archive

Re: Types in Mathematica


bsyehuda at gmail.com wrote:

> I fully agree with Andrzej,
> From my past experience, I used to program with
> 
> general programming
> Pascal (1983)
> Basic (1984)
> Fortran (1986)
> C (1988 )
> C++ (1997)
> 
> and in addition two types of Assembly languages: X86 (1987-2000) and
> PowerPC (2000-2003).
> 
> I also used other technical computing software extensively since 1986
> I started using Mathematica in 1993.
> 
> When Java gained popularity, I decided to end this madness of chasing
> after programming fashions and finally decided to see in which environment
> I get the best cost (programming time) to performance ratio and use a
> single environment that will suite my needs as a professor at the
> university: Symbolics, reach set of functions for technical computing,
> advanced graphics, advanced programming and smooth mixing of code and
> typesetting. Mathematica is the BIG winner from my perspective.
> Since then I stopped using any other software and I really do not miss any
> of them.
> even tasks that I used to do with Excel find their way to be Mathematica
> notebooks since it takes me less time to type some commands then clicking
> and dragging in Excel (or alike).

All of these observation are reasonable, and I don't believe they contradict
my point.  My point is that using different programming languages exposes a
person to different ways of solving problems.  I have worked in many
different areas over the past several years.  I find ideas from one design
domain often transfer in unexpected ways to other domains.  People can say
what they will about the value of learning other languages, but I know for
a fact that my ability to use Mathematica was greatly improved by learning
C++ and Emacs with a bit of Lisp.  JavaScript probably deserves mention as
well.  

> Of course the decision may be different for a person with other goals or
> needs.
> During the time I never found OOP helpful for having high Mathematica
> programming skills.

I did find Dr. Mäder's Classes` package usefull in developing certain kinds
of graphics.  I created a rudimentary scene graph using this OOP
foundation.  At the time, I really didn't know that what I was doing was
creating a scenegraph.  There is also another place where OOP seems useful. 
That is in contemplating the primitive components of Mathematica.

One might view a Symbol in Mathematica as an object which is an instance of
a class. 

Just off the cuff, and obviously incomplete, one might try to model a symbol
in terms of OOP like this:

namespace mma {
  class Atom {
  public:
    enum TAG {
      SYMBOL,
      STRING,
      INTEGER,
      RATIONAL,
      COMPLEX
    };
    TAG tag() const;   
  };
}

namespace mma {
  class Symbol : public Atom {
  public:
    enum ATTRIBUTE {
      Constant        =      1,
      Flat            =      2,
      HoldAll         =      4,
      HoldAllComplete =      8,
      HoldFirst       =     16,
      HoldRest        =     32,
      Listable        =     64,
      Locked          =    128,
      NHoldAll        =    256,
      NHoldFirst      =    512,
      NHoldRest       =   1024,
      NumericFunction =   2048,
      OneIdentity     =   4096,
      Orderless       =   8192,
      Protected       =  16384,
      ReadProtected   =  32768,
      SequenceHold    =  65536,
      Stub            = 131072,
      Temporary       = 262144
    };
    
    std::list<TransformationRule> UpValues() const;
    std::list<TransformationRule> DownValues() const;
    std::list<TransformationRule> OwnValues() const;
    std::list<TransformationRule> Options() const;
    Atom head() const;
    std::string name() const;
    BitField attributes() const;
    
  };
}
 
> Any programming task needs a specific programming 
> type: procedural, functional, pattern matching, etc. Experienced
> programmer usually find himself using all this variants in a single
> Mathematica notebook of package, since after all, performance is of great
> importance, and as we have seen, different approaches perform differently.
> However, if one does not control all the programming styles in
> Mathematica, he still can do a lot, much more than with a limited
> knowledge in C++ for example. isn't it?
 
I believe we are unlikely to find many, if any Mathematica programmers who
have not "contaminated" their minds with other programming languages.  My
point regarding knowledge of other programming languages is that the
experience of thinking in various different modes helps us to approach
problems, and use features of any language more effectively than having
experience with only one language.  My professor who taught the Programming
Languages course I took asserted that a programmer with 20 years experience
with a given language is, in many ways a programmer with one year's
experience with that language who has been programming for 20 years.  

My brother, who has been a programmer for over two decades, and has also
managed programmers, claims that a person doesn't really know a language
until he or she has worked in it for at least 2 years.  I tend to agree
with my brother regarding the time it takes to, more or less, "master" a
language.  So I would adjust my professor's statement accordingly.  Thus, I
will say, roughly speaking, a person with 10 years of Mathematica
experience, who has never programmed in another language is unlikely to be
able to use Mathematica as effectively as a person with 2 solid years of
Mathematica experience, and 8 years experience in other languages.

-- 
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/


  • Prev by Date: Re: Re: Lost connection to license server
  • Next by Date: webMathematica problems if using Xvnc
  • Previous by thread: Re: Re: Re: Types in Mathematica
  • Next by thread: Re: Re: Types in Mathematica