MathGroup Archive 2001

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

Search the Archive

Re: OOP in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29032] Re: OOP in Mathematica
  • From: "Drago Ganic" <drago.ganic at in2.hr>
  • Date: Fri, 25 May 2001 01:48:08 -0400 (EDT)
  • Organization: HThinet
  • References: <9e02ol$30e@smc.vnet.net> <9e2bm5$63u@smc.vnet.net> <CjLN6.9482$dl4.29613@ralph.vnet.net> <9eigq5$51t@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi ,

There are  two things I am missing in Mathematica and I would like to hear other opinions:

First: Naming "functions" and "objects"
==============================

When using the ? HELP I would like sometimes to know what an object can "do" [the functions] and sometimes on what objects a certain function can operate [the objects]. So I would like a function browser and an object browser.

Here is an example: Using 

        ?Notebook* 

gives all the "functions" I can use with a Noteook object. Among them I can find a NotebookCreate function.

Now I am interested what other objects can be "created". Using 

        ?*Create 

I find another "function" LinkCreate. But using 

        ?Create*

I find CreateDirectory ?!?. Mathematica is inconsistent in naming its symbols. This can make it hard to learn and/or remember.

Here is my question: Why do I have a function NotebookCreate and not a function Create which operates on Notebooks, Directory and so on.... Why is overloading not used in these cases?

Browsing through the Section 2.10 of the Mathematica book I find the need for the generic "functions":
    Print ,Open, Put, Get, Move, Find, Locate, Write, Apply, Delete, Read, Evaluate, Create, Animate, Save, Close, Execute, ...

overloaded to work with the "objects":

    Cell, Style, Notebook, Selection, FroneEndToken, FrontEnd


Second: No Data Type
==================

Having a Date "type" is extremly important in business aplications in which I am personally involved [maybe I'm the only one here :-))].

Not having one, gives the user the opurtunity to add a "number" to a "day in month" resulting in a nonsense:

In[28]:=Date[]
Out[28]= {2001, 5, 24, 20, 17, 33}

In[30]:= Date[] + {0, 0, 10, 0, 0, 0}
Out[30]= {2001, 5, 34, 20, 18, 10}

I now that I can use

In[33]:=ToDate@FromDate[Date[] + {0, 0, 10, 0, 0, 0}]
Out[33]={2001, 6, 3, 20, 19, 31}

but I am quite unhappy with this solution. Why Date[] returns a LIST and not something like

    Date[2001,5,24,20,17,33]

or

    DateTime[2001,5,24,20,17,33]

on which Plus could be overloaded ...

Of course I know that I can change Mathematica to fit my needs but I would like to now why WRI made such design decisions.

Sorry for the long post. Hope sombody will answer :-)

Greetings from Croatia,
Drago Ganic

"Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de> wrote in message news:9eigq5$51t at smc.vnet.net...
> Hi,
> 
> > With all respect, I think you might have said "in my opinion." 
> 
> I have no other opinion than mine.
> 
> > OOP is
> > revolutionizing software development, by (among other things) separating
> > implementation from interface, thus allowing modules to interact more easily
> > and with fewer problems.
> 
> That's OOP -- wow! I thought it is good programming style, working
> in every higher programming language.
> 
> > Mathematica's "Module[]" facility is a simple
> > embodiment of this idea, 
> 
> What is with my beloved Block[] - is it also OOP  ?
> Next you will say that patterns are also OOP, and the 
> good old pure functions ? Is this object oriented ?
> Fine ! Now I know that LISP and Prolog are native
> object oriented languages !
> 
> > by enclosing code blocks and isolating them from
> > their applications, making it possible to change the methods without
> > changing the outer appearance and uses.
> 
> You change *functions* not methods! and this is functional programming.
> Since Mathematica does not know what a data type is, the data 
> types can't have methods.
> But you can have functions that evaluate special arguments.
> 
> Regards
>   Jens
> 



  • Prev by Date: Importing EPS
  • Next by Date: Faster rotate bitmap
  • Previous by thread: Re: OOP in Mathematica
  • Next by thread: Re: OOP in Mathematica