Comment on Bertrand Meyer's Multiple Inheritance example at the .net seminar 
Author Message
 Comment on Bertrand Meyer's Multiple Inheritance example at the .net seminar

Bertrand gives an example of multiple inheritance in which integer, double
and real each inherit from both comparable and numeric; string inherits from
comparable; matrix inherits from numeric.

I don't see why matrices can't be comparable: after all, addition of
matrices results in a matrix of added elements, so comparison would result
in a matrix of boolean values.

Then numeric can inherit from comparable, no MI is needed.

--
Colin Sutton
Development Manager, Access Control Systems
Siemens Building Technologies Pty. Ltd.
14-18 Suakin Street, Pymble NSW 2073 Australia
Phone +61 2 98551310 Fax +61 2 98551301



Tue, 25 Mar 2003 03:00:00 GMT  
 Comment on Bertrand Meyer's Multiple Inheritance example at the .net seminar
Colin,
        Firstly, when matrices inherit from NUMERIC, the class designer
has to define what is meant by matrix division and matrix
exponentiation.
Neither of these is really defined in mathematics, and of course you can
just make the preconditions (divisible and exponentiable) return False
in all cases anyway.  In the matrix class I wrote for work, which only
contains the basics (no inversion), I did not inherit from NUMERIC.  We
just don't need that capability.

        Secondly, what is meant by matrix comparison?  How would you
define one matrix being less than another?  Is each element less than
its corresponding element?  Would you compare determinants on square
matrices?  You'd have to come up with some method that clients can
easily
understand.  I should note that these issues surface with vectors as
well,
which are very related to matrices.  My vector class is neither NUMERIC
nor COMPARABLE.

        Finally, I do not think that NUMERIC should inherit from
COMPARABLE, using the above as examples.  Also, I have a class that
describes trigonometric angles (in an odd but very useful way) that
inherits from NUMERIC, but is only partially comparable
(PART_COMPARABLE).
I would run into a problem here if NUMERIC inherited from COMPARABLE.

        Steve Wurster

Quote:

> Bertrand gives an example of multiple inheritance in which integer, double
> and real each inherit from both comparable and numeric; string inherits from
> comparable; matrix inherits from numeric.

> I don't see why matrices can't be comparable: after all, addition of
> matrices results in a matrix of added elements, so comparison would result
> in a matrix of boolean values.

> Then numeric can inherit from comparable, no MI is needed.

> --
> Colin Sutton
> Development Manager, Access Control Systems
> Siemens Building Technologies Pty. Ltd.
> 14-18 Suakin Street, Pymble NSW 2073 Australia
> Phone +61 2 98551310 Fax +61 2 98551301

--
Steven M. Wurster

http://members.home.net/wurster

The computer is incredibly fast, accurate, and stupid.
Man is unbelievably slow, inaccurate, and brilliant.
The marriage of the two is a force beyond calculation.
      -- Leo Cherne



Tue, 25 Mar 2003 03:00:00 GMT  
 Comment on Bertrand Meyer's Multiple Inheritance example at the .net seminar

Quote:

> Bertrand gives an example of multiple inheritance in which integer, double
> and real each inherit from both comparable and numeric; string inherits from
> comparable; matrix inherits from numeric.

> I don't see why matrices can't be comparable: after all, addition of
> matrices results in a matrix of added elements, so comparison would result
> in a matrix of boolean values.

> Then numeric can inherit from comparable, no MI is needed.

two problems with this line of reasoning

1) Comparable specifically states that
        '<' ( other : like Current ) : BOOLEAN
and for a good reason .. it's the constraint that allows
objects to take part in situations where their ordering
needs to be known.  So producing a matrix of booleans
as the answer might be a meaningful answer, but is not
the intended meaning of "<".  

2)  Even if you did invent a meaningful "<" for Matrix,
putting Comparable above Numeric instead of alongside
it precludes the future development of any other class
that is Numeric without being Comparable.  

I believe both Complex and Vector have widely accepted
arithmetic operations defined on them but no unique ordering.
In fact, a set of objects simply has to have four operators
with appropriate properties in order to implement NUMERIC.
The actual operators themselve might be completely foreign
to a non-mathematician expecting numbers and arithmetic.



Tue, 25 Mar 2003 03:00:00 GMT  
 Comment on Bertrand Meyer's Multiple Inheritance example at the .net seminar

It is indeed often possible to rank matrix quantities, but they often only have
a partial ordering, and sometimes not even that.  It rather depends upon the
interpretation of the components of the matrix.  Even as simple a "matrix" as a
complex number doesn't have any really reasonable ordering.  One could order
them by position on the x axis, by absolute value, by distance from the origin,
etc.  Notice that each of the examples given is a partial rather than a full
ordering.  One would need to combine that ordering with some other ordering to
give a full ordering.  And I think that this can probably only be done
arbitrarily.  E.g. if one uses the r,theta representation, then one can
arbitrarily break it in half and say, ok, the top 16 bits are for r, the bottom
16 bits are for theta, both numbers MUST be positive.  But others will say, the
angle doesn't need to be determined that precisely, but give more emphasis to
the distance.  Both parties will achieve a nearly ordered set of points, but the
orderings won't be the same.  And there's no obvious way to choose between
them.  (Surely 8 bits is enough for the angle!)

This must be done on a case by case basis, where the needs of the application
determine the ordering principle used.

Quote:

> Bertrand gives an example of multiple inheritance in which integer, double
> and real each inherit from both comparable and numeric; string inherits from
> comparable; matrix inherits from numeric.

> I don't see why matrices can't be comparable: after all, addition of
> matrices results in a matrix of added elements, so comparison would result
> in a matrix of boolean values.

> Then numeric can inherit from comparable, no MI is needed.

> --
> Colin Sutton
> Development Manager, Access Control Systems
> Siemens Building Technologies Pty. Ltd.
> 14-18 Suakin Street, Pymble NSW 2073 Australia
> Phone +61 2 98551310 Fax +61 2 98551301

-- (c) Charles Hixson
--  Addition of adverti{*filter*}ts or hyperlinks to products specifically prohibited

  charleshixsn.vcf
< 1K Download


Tue, 25 Mar 2003 03:00:00 GMT  
 Comment on Bertrand Meyer's Multiple Inheritance example at the .net seminar

Quote:
> Bertrand gives an example of multiple inheritance in which integer, double
> and real each inherit from both comparable and numeric; string inherits
from
> comparable; matrix inherits from numeric.

> I don't see why matrices can't be comparable: after all, addition of
> matrices results in a matrix of added elements, so comparison would result
> in a matrix of boolean values.

> Then numeric can inherit from comparable, no MI is needed.

The order relations are based on a boolean function, that is, a function
that returns True of False (it cannot return matrices of booleans).
It is true you can compare matrices with a total order (see Cantor), but
there are infinitely many ways and none of they are standard. You could
have:

MATRIX inherit NUMERIC
MY_ORDERED_MATRIX inherit MATRIX, COMPARABLE

and then define your total order within MY_ORDERED_MATRIX. But MATRIX
doesn't have a standard total order.

Saludos from Spain!
Ignacio Calvo



Tue, 25 Mar 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Announce [Bertrand Meyer, John Daniels, .NET, Free Advanced OOD Seminar]

2. Announce [Bertrand Meyer, John Daniels, .NET, Free Advanced OOD Seminar]

3. Bertrand Meyer's seminar on OOP

4. OO Seminars by Bertrand Meyer in Europe

5. OO seminars in Paris by Bertrand Meyer, in French

6. Object-Oriented Technology Seminars by Bertrand Meyer

7. Fake scientist Bertrand Meyer (puke) exposed at http://WWW.NETSCUM.NET/meyerb0.html

8. Fake scientist Bertrand Meyer (puke) exposed at http://WWW.NETSCUM.NET/meyerb0.html

9. Fake scientist Bertrand Meyer (puke) exposed at http://WWW.NETSCUM.NET/meyerb0.html

10. Fake scientist Bertrand Meyer (puke) exposed at http://WWW.NETSCUM.NET/meyerb0.html

11. Fake scientist Bertrand Meyer (puke) exposed at http://WWW.NETSCUM.NET/meyerb0.html

 

 
Powered by phpBB® Forum Software