Ada95 Lovelace Tutorial Section 16.8 (2024)

It makes sense to close a discussion of Ada and Java by comparing the twolanguages.

Ada and Java have more similarities than differences. Both the Ada languageand the Java language were designed with safety in mind(both support strong typing, omit pointers, and perform many compile-timeand run-time checks).Both support an object-oriented approach based on a singleinheritance hierarchy.When generating class files,both Ada and Java support garbage collection, multitasking,and platform-independentgraphical user interfaces (GUIs).

There are differences, of course. Here are some technical advantages ofthe Ada language over the Java language(SigAdahas a similar list):

  1. Ada supports enumerated types.
  2. Ada supports operator overloading for infix operators (for example,you can define an infix + operation for complex numbers).
  3. Ada supports generics. There is no Java equivalent, thoughJava's "Interface" and its root Object class cansometimes be used to do similar things.
  4. Ada supports "in", "out", and "in out" to document the use of parameters,and these modifiers work on both tagged types and scalars.
  5. Ada is easier to read in some cases (compare "and" with "&&";compare "for I in 1..10" with "for (i=1; i <= 10; i++)";compare "a=b" with "a==b").
  6. Ada permits array boundaries to start with any scalar. The Java languagerequires array boundaries to start at 0, a common source of "one-off" errors.
  7. Ada supports numeric range checks more specific than the built-in types.This can be used to detect errors that Java doesn't.
  8. Ada supports method calls using named and unordered parameters,and supports default parameter values.
  9. Ada supports subprogram access types and nested subprograms.

Java has some technical advantages over Ada, too:

  1. Java supports "interface" types.There is no standard Ada equivalent, thoughAda generics and the nesting of objectscan sometimes be used to do similar things.Ada programs that generate Java code can use and define Java interfaces,using a special pragma to do so.
  2. Java permits specifications to be circular (A depends on B which dependson A), while Ada does not. There is some argument that this is a disadvantage,since circular references can indicate poorly structured systems, but interms of ease-of-use this is an advantage.
  3. Java class definitions tend to be shorter than Ada.Here are some of the reasons for this:
    1. Ada enforces a distinction between objects and access valuesto objects.This causes definitions to be longer (for example, in Ada you have to defineX_Obj and X_Ptr types everywhere, while all of that is not usedin the Java language).
    2. Ada requires an explicit list of all classes used ("with" statements) in aclass being defined.Java does not require a list of classes used; the closest Java has isits "import" statement, which is like the "use" clause in Ada.
    3. Java has an implicit "this" parameter for non-static methods; Ada requiresall parameters to be explicitly listed.
    4. Java interfaces have to be handled using a somewhat clumsy Ada syntax.
  4. Java supports hierarchies of exception definitions. Java also includesdefinitionsof exceptions that might be thrown (raised) by each method as part of themethod definition.

Naturally, more than technical issues make a decision. Here are some otherissues regarding the use of the Java language and Ada language for creatingJava applets and applications:

  1. There are a number of tooling issues.At the time of this writingthere are more Ada compilers than Java compilers, but by the time you readthis there should be many compilers for both languages.Most Ada compilersgenerate native (high-speed) code that can take advantage of the underlyinghardware, while Java compilers are just beginning to appear.However, currentlyonly one Ada compiler can generate class files and applets, so the quantityof compilers tilts towards Javaif you're solely interested in generating applets and/or class files.You'll also need to compare the tool capabilities themselves: which havebetter interactive development environments (IDEs)?Which have additional functionality (like user interface generators) thatyou'd like?Since just-in-time Java compilers that take class files can compile both Javaand Ada class files, the choice of language is irrelevantfor just-in-time compilers.
  2. There are large reusable component libraries for both languages, each withdifferent focuses.Compare the relevant reusable componentsin the different languages for your application.
  3. There is an ISO (international) standard for Ada, while a standard for Javais probably many years away (at the time of this writing).
  4. There is a large standard test suite for Ada compilers; none yet existsfor Java.
  5. There are sometimes vendor restrictions prohibiting use of theJava languagefor safety-critical systems; Ada is commonly used in such areas, and compilerscan be bought without such prohibitions.
  6. The use ofJavain real-time applications is somewhat currently a research area,while Ada is already used in such areas and has been for many years.
  7. Most Java materials and tools assume that users are usingthe Java language.Thus, if you're developing a Java application in Ada you'll need tolearn the translation conventions (as discussed in previous sections) andbe able to make such translations mentally.No such translations are needed if you're using the Java language.

Ada95 Lovelace Tutorial Section 16.8 (1)Quiz:

Which of the following statements is true?

  1. The Java language lets you write your own infix operators, whilethe Ada standard supports interface types and hierarchical exceptions.
  2. A web browser that includes a just-in-time compiler for class filescan't compile programs written in Ada.
  3. When generating Java class files, both Ada and Java supportgarbage collection and a standard graphical user interface.
  1. Statement 1.
  2. Statement 2.
  3. Statement 3.
You may also:
Go back to the previous sectionSkip to the next sectionGo up to lesson 16 outline

David A. Wheeler (dwheeler@dwheeler.com)

The master copy of this file is at"http://www.adahome.com/Tutorials/Lovelace/s16sf.htm".

Ada95 Lovelace Tutorial Section 16.8 (2024)
Top Articles
Forget gold &ndash; invest in water
How to Set Financial Goals for the New Year in 6 Easy Steps - Megan Makes Sense
Use Copilot in Microsoft Teams meetings
It’s Time to Answer Your Questions About Super Bowl LVII (Published 2023)
Design215 Word Pattern Finder
Koordinaten w43/b14 mit Umrechner in alle Koordinatensysteme
Grange Display Calculator
Georgia Vehicle Registration Fees Calculator
877-668-5260 | 18776685260 - Robocaller Warning!
Aiken County government, school officials promote penny tax in North Augusta
Craigslist - Pets for Sale or Adoption in Zeeland, MI
Pike County Buy Sale And Trade
Ucf Event Calendar
Evil Dead Rise Showtimes Near Regal Columbiana Grande
How to find cash from balance sheet?
Available Training - Acadis® Portal
Soccer Zone Discount Code
Tygodnik Polityka - Polityka.pl
U Break It Near Me
Seeking Arrangements Boston
Deshuesadero El Pulpo
How To Find Free Stuff On Craigslist San Diego | Tips, Popular Items, Safety Precautions | RoamBliss
From This Corner - Chief Glen Brock: A Shawnee Thinker
Unreasonable Zen Riddle Crossword
Craigslist Northern Minnesota
Kqelwaob
Christmas Days Away
Att U Verse Outage Map
Memberweb Bw
2015 Chevrolet Silverado 1500 for sale - Houston, TX - craigslist
Shih Tzu dogs for sale in Ireland
Nearest Ups Office To Me
140000 Kilometers To Miles
How to Print Tables in R with Examples Using table()
Gasoline Prices At Sam's Club
Directions To Cvs Pharmacy
3 Zodiac Signs Whose Wishes Come True After The Pisces Moon On September 16
Paul Shelesh
American Bully Puppies for Sale | Lancaster Puppies
Accident On 40 East Today
Leland Westerlund
Myra's Floral Princeton Wv
Dolce Luna Italian Restaurant & Pizzeria
Used Auto Parts in Houston 77013 | LKQ Pick Your Part
Treatise On Jewelcrafting
View From My Seat Madison Square Garden
Craigslist Cars And Trucks For Sale By Owner Indianapolis
De Donde Es El Area +63
Pulpo Yonke Houston Tx
Koniec veľkorysých plánov. Prestížna LEAF Academy mení adresu, masívny kampus nepostaví
Die 10 wichtigsten Sehenswürdigkeiten in NYC, die Sie kennen sollten
Latest Posts
Article information

Author: Greg Kuvalis

Last Updated:

Views: 6119

Rating: 4.4 / 5 (75 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Greg Kuvalis

Birthday: 1996-12-20

Address: 53157 Trantow Inlet, Townemouth, FL 92564-0267

Phone: +68218650356656

Job: IT Representative

Hobby: Knitting, Amateur radio, Skiing, Running, Mountain biking, Slacklining, Electronics

Introduction: My name is Greg Kuvalis, I am a witty, spotless, beautiful, charming, delightful, thankful, beautiful person who loves writing and wants to share my knowledge and understanding with you.