M
Mark Thornton
Lew said:Tom said:Still, encapsulation means this might not be as bad as you might
think. If i [sic] have a private Double[] in my class, and i [sic]
never pass objects from it to methods of other classes (and possibly
if the class is final), the escape analysis is pretty trivial. It's
only when i [sic] start doing things like having globally visible
arrays or passing values out to other bits of code it goes wrong.
Mark said:Quite likely in a lot of non trivial mathematics
The mathematician should have the intelligence to employ a skilled
programmer to write the software, if the mathematician wants good
software. Mathematicians have about as much business writing software as
investment analysts or warehouse managers.
IME those without a good understanding of the mathematics involved tend
to be hopeless at writing software to implement such algorithms. There
is a reasonable prospect of educating mathematicians, engineers,
physicists to write better software, on the other hand the prospects of
educating software engineers to write competent mathematical software
appears to be near zero (unless they already have a good grounding in
mathematics). Mathematics seems a bit like natural languages in that
very few people successfully come to it late in life (where in the
context of mathematics 'late' probably means after 15 years of age).
One reason why arrays might be visible, in Java, is that is the only way
you can get to use the natural operator []. Personally I don't usually
do it, but sometimes life is just too short to bother with a pile of
trivial accessors especially when the name is something vacuous like
'element'. This is especially true of throwaway code --- just written to
test an approach. Another reason for wanting the actual array is to pass
it to library methods like Graphics.drawPolyline, or the transform
methods on AffineTransform. Those with perfect foresight will of course
have provided methods for this on the object, but it is more common just
to provide a method to obtain the underlying array (as for example with
the wrapped forms of java.nio.*Buffer).
Perhaps you need more experience of mathematical software before you canI won't try to poke holes in the recent claimed proof of Fermat's Last
Theorem, and the mathematician won't try to write well-engineered software.
offer meaningful advice on how it might best be created.
Mark Thornton