MathGroup Archive 2006

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

Search the Archive

Re: Object-Oriented Paradigm in Mathematica?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65997] Re: [mg65983] Object-Oriented Paradigm in Mathematica?
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Wed, 26 Apr 2006 04:37:58 -0400 (EDT)
  • References: <200604250919.FAA07103@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Apr 25, 2006, at 2:19 AM, Shyam Guthikonda wrote:

> I come from the world of C++ :) I am trying to perform various
> simulations using Mathematica, and I find myself coming up with all my
> algorithms in terms of objects.

You would probably find Mathematica more useful if you thought in  
terms of its own natural paradigm of expressions and functions.  The  
idea of using some form of object oriented paradigm in Mathematica  
comes up frequently on this list, as you can probably tell from your  
search through the archives.  In general, using C++ methodology in  
Mathematica is like using COBOL methodology in C++: it's possible but  
unlikely to be productive.

There is a relatively simple way to use object oriented type  
techniques to organize programs in Mathematica: by treating the head  
of expressions as a type.  That can get you inheritance (but not  
trivially), polymorphism (a little easier) and a limited notion of  
encapsulation.  But because Mathematica works by exposing the  
structure of expressions, encapsulation is a poor fit.  Template  
style programming however is easy and recommended.

> Does Mathematica support some type of Object-Oriented Paradigm?

As far as I can tell this is a subject still open to debate, and  
frequently prompts long email threads that devolve into flame wars.

I think the politic answer is, not really.  A slightly more accurate  
answer would be; a C++ or Java like object model is a poor fit for  
Mathematica.

Don't despair however.  My suggestion would be for you to look at how  
some algorithms you are interested in are implemented in Mathematica  
if possible.  Or ask on this list, as long as the problem is not too  
complex several people here would be happy to show you how they would  
implement various algorithms in Mathematica.  The learning curve for  
thinking about problems the Mathematica way is not too steep once  
you've seen a few examples.

Regards,

Ssezi


  • Prev by Date: Re: Object-Oriented Paradigm in Mathematica?
  • Next by Date: Re: display of input and output in textbook form
  • Previous by thread: Re: Object-Oriented Paradigm in Mathematica?
  • Next by thread: Re: Object-Oriented Paradigm in Mathematica?