Re: Fortranspeak & Javaspeak
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Wed, 31 May 2006 01:27:24 -0700
David.Paterson@xxxxxxxx wrote:
I'm a Fortran77 programmer (computational fluid dynamics etc.) and am
trying to work with a Java programmer who is writing a front end.
Neither of us understand a word the other one says. I don't understand
him when he talks about class, instance, method, referencing, casting,
event, constructor, accessor, bytecode, overriding, registering etc.
He doesn't understand me when I talk about subroutine, common, real,
logical etc. He doesn't even know what a "program" is.
Is there a translation guide between Fortranspeak and Javaspeak?
I've figured out that "method" means "subroutine"; I program his
"class" using "named common"; his "referencing" is like an "equivalence
statement". Take it from there.
Well, class is both a data structure, such as named COMMON, and a set of
methods, as you say subroutines (or functions) to operate on the data.
Unlike COMMON, class data is dynamically allocated and each allocation is an instance. Casting is used two ways. One is to do type conversion, such as between int and float. The other allows converting Object references (what everyone else calls pointers) to a different reference type. (This is similar to C.) A constructor creates (allocates) an instance of a class and initializes it.
In addition to instance data (allocated for each instance of a class),
there is also class data using the keyword static. This is pretty much like named common, only one copy existing for each class. The primitive integer types are byte, char, short, int, and long, which are
8 bit signed, 16 bit unsigned, 16 bit signed, 32 bit signed, 64 bit signed integers, respectively. float, and double are 32 bit IEEE floating point, and 64 bit IEEE floating point, respectively, and boolean is logical.
To reduce errors, Java requires a cast on narrowing conversions, so that
an int can't be assigned to a byte or short without a cast. Widening conversions don't require a cast.
The usual Java compiler compiles to an intermediate, machine independent, code called bytecode. (Many machines have byte oriented instructions, so the description isn't very unique.) This is then either interpreted or compiled to machine code at runtime. (Many error messages only give the exact statement in interpreted (JIT off) mode.
I hope that helps. Ask more if not.
-- glen
.
- References:
- Fortranspeak & Javaspeak
- From: David . Paterson
- Fortranspeak & Javaspeak
- Prev by Date: Re: Bounds Check Overhead
- Next by Date: Re: How to trace the memory use
- Previous by thread: Fortranspeak & Javaspeak
- Next by thread: Re: Fortranspeak & Javaspeak
- Index(es):
Relevant Pages
|