* prefix notation
@ 2007-03-12 11:53 Ali Bendriss
2007-03-12 12:27 ` Jean-Pierre Rosen
0 siblings, 1 reply; 6+ messages in thread
From: Ali Bendriss @ 2007-03-12 11:53 UTC (permalink / raw)
To: comp.lang.ada
Hello,
For the development of G2F, I'm interested in the prefix notation.
An example is available here :
http://svn.gna.org/viewcvs/g2f/trunk/g2f_io/trunk/g2f_im/im_test.adb?rev=15&view=markup
and the experimental packages are browsable here :
http://svn.gna.org/viewcvs/g2f/trunk/g2f_io/trunk/g2f_im/?rev=15#dirlist
The problem is that I only have two objects :
a single image and a list of single image (multiframe images).
To be able to use the prefix notation I understand that each operation on an
object must be in the same package of the object himself.
What about if I have a big number of operation and I would like the user to
write something like
procedure test is
Img : Image_Obj;
begin
Img.Read ("test.tiff"); Img.Rotate(90); Img.Draw(Circle);....;
Img.SetPixel ((100,72), Red));
Img.Write ("test.gif");
end test;
Is there some way to split the package to still have something readable
(notably the specification) ?
What other facility may I use for that purpose.
It's not in the Ada philosophy but I'm interested in the ease of use in the
user point of view, the garbage collection, and the fashion ;)
thanks for your feed back.
--
Ali
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: prefix notation
2007-03-12 11:53 prefix notation Ali Bendriss
@ 2007-03-12 12:27 ` Jean-Pierre Rosen
2007-03-12 19:02 ` Ali Bendriss
0 siblings, 1 reply; 6+ messages in thread
From: Jean-Pierre Rosen @ 2007-03-12 12:27 UTC (permalink / raw)
Ali Bendriss a �crit :
> To be able to use the prefix notation I understand that each operation on an
> object must be in the same package of the object himself.
Like in other OO languages, where you can apply the prefix notation only
to member functions.
> What about if I have a big number of operation and I would like the user to
> write something like
>
> procedure test is
> Img : Image_Obj;
> begin
> Img.Read ("test.tiff"); Img.Rotate(90); Img.Draw(Circle);....;
> Img.SetPixel ((100,72), Red));
> Img.Write ("test.gif");
> end test;
>
> Is there some way to split the package to still have something readable
> (notably the specification) ?
> What other facility may I use for that purpose.
>
I would suggest to make a clear distinction between "methods" and
"operations". A method is something where it makes sense for each object
to implement it in a different way: for example, a square will not
implement "draw" the same way as a circle will.
An operation is a subprogram that operates on an object, but where the
implementation is the same for every kind of object. "Move" is always
equivalent to Erase-Set_X_Y-Draw. This is not a method, since it should
not depend on which kind of objects it operates on.
I don't know exactly what you are trying to achieve, but is Read a
property of Img? To me, it looks like a property of a Tiff object. The
method depends on the format of the file, not on the object being read.
Similarly, isn't Draw a method of Circle rather than Img? etc.
There is no general rule, but often if you end up with too many methods,
it may well be that they don't belong to the right object.
(BTW: the whole Java library is full of these badly assigned methods!)
My 5cts...
--
---------------------------------------------------------
J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: prefix notation
2007-03-12 12:27 ` Jean-Pierre Rosen
@ 2007-03-12 19:02 ` Ali Bendriss
2007-03-12 20:20 ` Adam Beneschan
2007-03-12 20:50 ` Adam Beneschan
0 siblings, 2 replies; 6+ messages in thread
From: Ali Bendriss @ 2007-03-12 19:02 UTC (permalink / raw)
To: comp.lang.ada
On Monday 12 March 2007 12:27, Jean-Pierre Rosen wrote:
> Ali Bendriss a écrit :
[...]
Thanks for the precisions.
I will make the distinction more clear (at list in my mind).
> I don't know exactly what you are trying to achieve, but is Read a
> property of Img? To me, it looks like a property of a Tiff object. The
> method depends on the format of the file, not on the object being read.
> Similarly, isn't Draw a method of Circle rather than Img? etc.
>
For the moment I was thinking following what was already done by other
binding; for example :
- perl : http://www.imagemagick.org/script/perl-magick.php#example
- c++ : http://www.imagemagick.org/Magick++/Image.html
Maybe I'm wrong.
But those two interfaces look like easy to understand and to use.
> There is no general rule, but often if you end up with too many methods,
> it may well be that they don't belong to the right object.
>
> (BTW: the whole Java library is full of these badly assigned methods!)
>
> My 5cts...
--
Ali
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: prefix notation
2007-03-12 19:02 ` Ali Bendriss
@ 2007-03-12 20:20 ` Adam Beneschan
2007-03-12 22:00 ` Ali Bendriss
2007-03-12 20:50 ` Adam Beneschan
1 sibling, 1 reply; 6+ messages in thread
From: Adam Beneschan @ 2007-03-12 20:20 UTC (permalink / raw)
On Mar 12, 12:02 pm, Ali Bendriss <Bendr...@drc.ion.ucl.ac.uk> wrote:
> On Monday 12 March 2007 12:27, Jean-Pierre Rosen wrote:
>
> > Ali Bendriss a écrit :
>
> [...]
>
> Thanks for the precisions.
> I will make the distinction more clear (at list in my mind).
>
> > I don't know exactly what you are trying to achieve, but is Read a
> > property of Img? To me, it looks like a property of a Tiff object. The
> > method depends on the format of the file, not on the object being read.
> > Similarly, isn't Draw a method of Circle rather than Img? etc.
>
> For the moment I was thinking following what was already done by other
> binding; for example :
> - perl :http://www.imagemagick.org/script/perl-magick.php#example
> - c++ :http://www.imagemagick.org/Magick++/Image.html
>
> Maybe I'm wrong.
> But those two interfaces look like easy to understand and to use.
I looked at the first example you clicked on, and it had a list of
over 100 methods that can be applied to an image object. If, as you
say, that interface looks easy to understand, I guess I'm not sure
why you think an Ada package that declared approximately that many
methods would need to be split up to be readable. Why would a large
Ada package spec be any less easy to understand?
-- Adam
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: prefix notation
2007-03-12 20:20 ` Adam Beneschan
@ 2007-03-12 22:00 ` Ali Bendriss
0 siblings, 0 replies; 6+ messages in thread
From: Ali Bendriss @ 2007-03-12 22:00 UTC (permalink / raw)
To: comp.lang.ada
On Monday 12 March 2007 20:20, Adam Beneschan wrote:
> On Mar 12, 12:02 pm, Ali Bendriss <Bendr...@drc.ion.ucl.ac.uk> wrote:
> > On Monday 12 March 2007 12:27, Jean-Pierre Rosen wrote:
> > > Ali Bendriss a écrit :
> >
> > [...]
> >
> > Thanks for the precisions.
> > I will make the distinction more clear (at list in my mind).
> >
> > > I don't know exactly what you are trying to achieve, but is Read a
> > > property of Img? To me, it looks like a property of a Tiff object. The
> > > method depends on the format of the file, not on the object being read.
> > > Similarly, isn't Draw a method of Circle rather than Img? etc.
> >
> > For the moment I was thinking following what was already done by other
> > binding; for example :
> > - perl :http://www.imagemagick.org/script/perl-magick.php#example
> > - c++ :http://www.imagemagick.org/Magick++/Image.html
> >
> > Maybe I'm wrong.
> > But those two interfaces look like easy to understand and to use.
>
> I looked at the first example you clicked on, and it had a list of
> over 100 methods that can be applied to an image object. If, as you
> say, that interface looks easy to understand,
When I say easy to understand it's because the interface is mostly
manipulating few object (and only one for the first example).
The other thing is that in Ada I use the package specification as a main
source of documention. It's not true for the two others language I took in
example.
> I guess I'm not sure why you think an Ada package that declared
approximately that man methods would need to be split up to be readable.
> Why would a large Ada package spec be any less easy to understand?
>
In fact if I was not using the prefixed notation I was probably writing :
a parent package where I will declare the Image_Object
and some child package : one for drawing, one for the IO, an other to access
the cache for example.
I've no access yet to a whole program or library that use the prefixed
notation. So I must says that I've no background on that topics, It's just a
feeling.
Ali.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: prefix notation
2007-03-12 19:02 ` Ali Bendriss
2007-03-12 20:20 ` Adam Beneschan
@ 2007-03-12 20:50 ` Adam Beneschan
1 sibling, 0 replies; 6+ messages in thread
From: Adam Beneschan @ 2007-03-12 20:50 UTC (permalink / raw)
On Mar 12, 12:02 pm, Ali Bendriss <Bendr...@drc.ion.ucl.ac.uk> wrote:
> On Monday 12 March 2007 12:27, Jean-Pierre Rosen wrote:
>
> > Ali Bendriss a écrit :
>
> [...]
>
> Thanks for the precisions.
> I will make the distinction more clear (at list in my mind).
>
> > I don't know exactly what you are trying to achieve, but is Read a
> > property of Img? To me, it looks like a property of a Tiff object. The
> > method depends on the format of the file, not on the object being read.
> > Similarly, isn't Draw a method of Circle rather than Img? etc.
>
> For the moment I was thinking following what was already done by other
> binding; for example :
> - perl :http://www.imagemagick.org/script/perl-magick.php#example
> - c++ :http://www.imagemagick.org/Magick++/Image.html
>
> Maybe I'm wrong.
> But those two interfaces look like easy to understand and to use.
I looked at the first example you clicked on, and it had a list of
over 100 methods that can be applied to an image object. If, as you
say, that interface looks easy to understand, I guess I'm not sure
why you think an Ada package that declared approximately that many
methods would need to be split up to be readable. Why would a large
Ada package spec be any less easy to understand?
-- Adam
>
> > There is no general rule, but often if you end up with too many methods,
> > it may well be that they don't belong to the right object.
>
> > (BTW: the whole Java library is full of these badly assigned methods!)
>
> > My 5cts...
>
> --
> Ali
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-03-12 22:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-12 11:53 prefix notation Ali Bendriss
2007-03-12 12:27 ` Jean-Pierre Rosen
2007-03-12 19:02 ` Ali Bendriss
2007-03-12 20:20 ` Adam Beneschan
2007-03-12 22:00 ` Ali Bendriss
2007-03-12 20:50 ` Adam Beneschan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox