LISTSERV mailing list manager LISTSERV 16.0

Help for TEAM-ADA Archives


TEAM-ADA Archives

TEAM-ADA Archives


TEAM-ADA@LISTSERV.ACM.ORG


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

TEAM-ADA Home

TEAM-ADA Home

TEAM-ADA  September 1998

TEAM-ADA September 1998

Subject:

Re: Ada/Java

From:

"W. Wesley Groleau x4923" <[log in to unmask]>

Reply-To:

W. Wesley Groleau x4923

Date:

Wed, 16 Sep 1998 18:02:07 -0500

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (199 lines)

Interesting exchange between an Ada-phile and a former Ada-phile who's
"converted" to Java.  Not intended as flame-bait......

----------------------------------------------

> * Java is a small language (not necessarily an advantage, but certainly a difference)
> * Java is "pure" OO. This is probably the biggest technical advantage of Java
> over Ada. A hybrid language like Ada95 or C++ tends to be the worst of two worlds.

Some folks would say Ada-95 offers the best of both worlds and C++ the worst.  :-)
(Some say Smalltalk is better than Java because _Java_ is a hybrid!)

> * The built-in support for dynamic class loading and the automatic garbage
> collection are inovative, creative, powerful, and useful technical advantages
> of Java over Ada as well.

Many Ada fans (and myself) agree, except that dynamic loading is (1) a feature of
the JVM, not the language, and (2) has been available in Unix for years, but never taken advantage of.

Real-timers are divided on garbage collection.  In Ada, all garbage
collection is automatic for what Java calls "primitive types".  And for a
heap-based type, one can define the garbage collection in the package that
declares the (controlled) type, making it automatic for all clients.

> * The economy of expression afforded by expression statements and the lack of
> "end" statements in Java is easy to misuse but _can_ be used to advantage
> also. Ada is a bit stilted.

I find no advantage in writability over readability.  However, with familiarity,
the readability problem probably fades considerably.

> * The biggest non-technical advantage of Java is that it is available! This is
> because Sun has downplayed the inovative features of the language and sold it
> as an improved C. I think Java is much better than that but Sun was clever
> enough not to stress it. Ada got that wrong from a marketing point of view.
> Ada bills itself as the language for doing software right, but, guess what,
> nobody wants to do software right!

I almost agree.  Few people want to "do software right"  As one of those few,
I still like Ada better than Java (and I wish I had occasion to learn Eiffel).

> > To me, the list of disadvantages begins with:
> >
> > 1. Specifications compilable before implementation.
> >
> >    a. A well-written Ada specification is (except for fancy typography)
> >       what you get from javadoc IF you put the required special-format
> >       comments in.
>
> I agree this is a serious deficiency of Java.
>
> > 2. Enumerated types
> >
> >    a. Using them as array indices
>
> I agree this is also a serious deficiency of Java.

Although I can understand it.  Java is based on C where
the enumerated types are just integers in disguise.

> > 3. Arrays that don't have to start at zero.
>
> This is tied to Java being small. We can't have everything and have small too.
>
> > 4. Objects don't have to be primitive to be on the stack - more efficient
> >    garbage collection.
>
> I don't understand this one.

I should have worded it differently.  In Java, "primitive types" are
numbers and booleans--things that are small.  These and only these go on
the stack and have immediate automatic garbage collection.  By immediate,
I mean after a routine returns, all its stack data is reclaimed on the
very next call instruction.  Heap-based objects, which are all objects in
Smalltalk and all but "primitives" in Java are garbage-collected when the
collector is triggered.

In Ada, you are "forced" to _decide_ when to use the heap.  But since you
only use the heap when you need it, most of the time you are not "forced"
to remember "this object is not primitive, so I have to use 'new'"  When
you decide to use the heap, Ada does not force you to have
garbage-collection.  But it does provide you with a mechanism (controlled
types) to guarantee the garabage collection is reliable.

I find it rather non-intuitive and awkward that in most cases, assignment
and comparison operators relate to the references, not to the actual
object or value.  The rarely needed operation is the easiest to read and
write, while the common one is more awkward and often doesn't even exist
until defined by the programmer.  Apparently the author of my Java book
thinks so, too.  It's also a readability problem that you have to think
about whether the types are "primitive" to know which of two meanings to
read for an operator.  This is contrary to Java's argument against
operator overloading!

> > 5. Not possible to "forget" to put "break" in a case statement.
>
> I agree that this is an amazingly stupid C characteristic not fixed in Java.
>
> > 6. Types and subtypes whose ranges relate to the abstraction, not to the
> >    implementation.  (Can do it in Java, but only with a lot of OOP
> >    baggage.)
>
> After BSY-2, I wonder if programmers are smart enough to handle subtypes.
>
> As for int being 32 bits, that's tied to small and simple again. I thought it
> was a daring, bold, and positive move for Java to just _decide_ that ints were
> such-and-such a size, period.

This was definitely a good idea for C programmers who insist on writing
size-dependent code even though they know it's not portable.  On the other
hand, if you write in terms of requirements or abstractions (as Ada
allows), your code is portable to any compiler that supports the ranges or
other details that you've specified--and other compilers won't compile
it!

> > 7. Operator overloading
>
> Lots of pro's and con's here. I miss it but I think maybe I really am better
> off without it.

Since Java does not allow putting range constraints on primitive types, anyone who wants it has two choices:
  a. Explicitly write your range checks everywhere you do anything with the type.
  b. Write a class that always does it's own range checking, and give up
     infix notation for your expressions.  A * B + C * D  becomes
     Sum_Of(Product_Of(A,B),Product_Of(C,D))  Plus you have to write all
     the operators your clients might need--even though the comparisons
     need no range checking.  This is one spot where the philosophies are
     reversed:  Java takes away a valuable capability because programmers
     abused it.  Ada allows it even though there's no way to force the
     programmer to give the operator the "intuitive" meaning.

> > 8. Access-to-subprogram that is fully type safe and nesting safe.
>
> I'm not trying to spin you up and I'm not trying to be cynical--my whole
> world-view has honestly changed. People don't _want_ a foolproof language and
> I'm not going to waste another second of my life being upset that they don't.

I command your pragmatism.  I am _trying_ to learn not to waste time that
way.  :-)  On this point however, the inventors of Java AND of Ada 83
rejected access-to-subprogram because it wasn't safe.  But in Ada 95, so
many people demanded it that we figured out a way to MAKE IT SAFE.  Java's
inventors either didn't know this could be done, or they thought it would
make the language "large."

> As Lincoln said: "God must have loved the common man; He created so many of
> them." I'm serious here. The biggest problem with Ada is that it tries to do
> things right and most people don't want to be forced to do things right.
> Please don't reply by saying Ada doesn't "force" you... I just mean the
> software profession truly is not ready to embrace the concepts of
> responsibility, correctness, etc. It's too bad, but Java is "better" because
> it is more in tune with the way programmers _are_ today. Let's give it credit
> for being at least a tiny step forward from current technology: C and C++! I'm
> saying Ada is _too good_ for the industry.

I honestly am happy Java is reducing the amount of C and C++ hacking.  But
I don't quite agree that "Ada is too good".  Many companies were finally
starting to take Ada a little more seriously as the shortcomings of C and
C++ became more apparent (and more costly), and as the empirical evidence
of Ada's cost-effectiveness.  Others have adopted Eiffel for the same
reasons.  The appearance of Java with its in-between position weakens that
trend.  Still, it *IS* an improvement for thousands of programmers.

> > 9. Tasking mechanism is higher level (more abstract) and simpler than
> >     Java's Runnable methods.
>
> Yes, but Ada tasks are also _too_ high level for a lot of applications.

True.  For this reason, most Ada vendors offered semaphores all along.
And the new "protected" types are suitable for (and simpler and safer
than) most of the things semaphores were used for.

> > 10. Protected types can do more than Java's synchronized methods, and
> >     there is no way to bypass a protected type's synchronization
> >     mechanisms.
>
> Back to small and "forcing" people again.

Well, I wasn't really thinking of "forcing" people.  I haven't studied
synchronized methods yet, but I've been told that synchronization is
guaranteed only if all clients call _only_ the synchronized methods.
Here, it's not Ada that does the "forcing." it's the programmer that
"forces" synchronization on his clients by making the type protected.  In
Java, it is much more difficult for the designer of a class to prevent his
clients from unsafe use.

> > 11. The OOP inheritance mechanism is independent of the encapsulation
> >     mechanism.  (Lack of this is why C++ had to have the dangerous
> >     "friends" feature.  Does Java have something like that?)
>
> Actually I think Java and Ada are tied on this one. Java packages are
> independent of inheritance.

I don't know what the connection is.  I was referring to the fact that two
Java classes cannot share private data like two or more Ada types in one
Ada package.  In Java, the methods and instance variables are encapsulated
within the class, which corresponds to ONE Ada type as well as ONE Ada
package.  This is not major, though, since mutually dependent types are
not that often needed and Java does have some workarounds.

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

December 2017
November 2017
October 2017
September 2017
June 2017
May 2017
April 2017
January 2017
December 2016
November 2016
October 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
December 2010
November 2010
October 2010
September 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
June 2007
May 2007
March 2007
February 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
March 2004
February 2004
January 2004
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
January 2001
December 2000
November 2000
October 2000
September 2000
August 2000
July 2000
June 2000
May 2000
April 2000
March 2000
February 2000
January 2000
December 1999
November 1999
October 1999
September 1999
August 1999
July 1999
June 1999
May 1999
April 1999
March 1999
February 1999
January 1999
December 1998
November 1998
October 1998
September 1998
August 1998
July 1998
June 1998
May 1998
April 1998
March 1998
February 1998
January 1998
December 1997
November 1997
October 1997
September 1997
August 1997
July 1997
June 1997
May 1997
April 1997
March 1997
February 1997
January 1997
December 1996
November 1996
October 1996

ATOM RSS1 RSS2



LISTSERV.ACM.ORG

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager