Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9515 > unrolled thread

Re: fyi, small note on using Mathematica for object

Started by"McHale, Paul" <Paul.McHale@excelitas.com>
First post2012-04-08 08:18 +0000
Last post2012-04-08 08:18 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: fyi, small note on using Mathematica for object "McHale, Paul" <Paul.McHale@excelitas.com> - 2012-04-08 08:18 +0000

#9515 — Re: fyi, small note on using Mathematica for object

From"McHale, Paul" <Paul.McHale@excelitas.com>
Date2012-04-08 08:18 +0000
SubjectRe: fyi, small note on using Mathematica for object
Message-ID<jlrhl4$epf$1@smc.vnet.net>
This is not a simple answer.  Here is my best attempt.

"Computer Science with Mathematica" (Roman Maeder),

14.1.4 Object-Oriented Programming in Mathematica
Object-oriented programming is not built into Mathematica.  It has been implemented in the package Classes.m.

It can be downloaded from:
http://library.wolfram.com/infocenter/Articles/3243/

I would argue Mathematica support some object oriented concepts such as polymorphism. 

mfunc[x_Integer] : x^2;
mfunc[x_Real] := x^3;
mfunc[2]
4
mfunc[2.0]
8

Encapsulation could be considered a natural fall out of the functional programing style.  Though what you are encapsulating is extremely limited to a method with local scope variables via Module[].

To my eye, inheritance doesn't make sense without classes.

As far as rigid class structure, it appears it is not here, per se.  Roman's book was written for Mathematica 4.  Maybe Mathematica 8 has new additions...

My conclusion is Mathematica is a modern functional programming language.  It is not a modern object oriented programming language.  Many people here resort to Java for their object oriented needs as Java integrates very well with Mathematica.

To be fair, IDE environments like VisualStudio C# set object oriented programming bar so high that all other object oriented environments will be laborious by comparison.  Just my opinion.

Having said all of this, there is a definite gap between Mathematica notebook scripting and Mathematica large program development.  Fortunately the scripting is powerful enough to get me through most tasks.

Paul

Paul McHale  |  Electrical Engineer, Energetics Systems  |  Excelitas Technologies Corp.

Phone:   +1 937.865.3004   |   Fax:  +1 937.865.5170   |   Mobile:   +1 937.371.2828
1100 Vanguard Blvd, Miamisburg, Ohio 45342-0312 USA
Paul.McHale@Excelitas.com
www.excelitas.com



Please consider the environment before printing this e-mail.
This email message and any attachments are confidential and proprietary to Excelitas Technologies Corp. If you are not the intended recipient of this message, please inform the sender by replying to this email or sending a message to the sender and destroy the message and any attachments.
Thank you

-----Original Message-----
From: Ralph Dratman [mailto:ralph.dratman@gmail.com]
Sent: Saturday, April 07, 2012 5:58 AM
Subject: Re: fyi, small note on using Mathematica for object

Bobby,

Please explain how you mean this. It is not a technique I have been able to find in the Virtual Book or other documentation.

What corresponds to a class, and how does one use a class to create one or more object instances? How does one run a method from an object?

A brief example would be most helpful.

Thank you.

Ralph


On Fri, Apr 6, 2012 at 5:58 AM, DrMajorBob <btreat1@austin.rr.com> wrote:
> Mathematica is already object-oriented WITHOUT all that. What a lot of
> overhead for nothing.
>
> Bobby
>
> On Thu, 05 Apr 2012 04:49:54 -0500, Nasser M. Abbasi <nma@12000.org> wrote:
>
>>
>> Just FYI,
>>
>> I wrote this small note on using Mathematica for object-based
>> programming. I found that it works really well for me.
>>
>> Nothing too advanced, just a simple way of using Module[] but in a
>> way to emulate object based programming that I did not know about
>> before.
>>
>> http://12000.org/my_notes/object_based_in_mathematica/v1.html
>>
>> --Nasser
>>
>
>
> --
> DrMajorBob@yahoo.com
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web