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 ([email protected])

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
Why Can’t We Just Print More Money? | Free the Facts
Effects of Clockwise and Counterclockwise Job Shift Work Rotation on Sleep and Work-Life Balance on Hospital Nurses
Analysis: Blue Jackets prospects get the job done in Buffalo | Columbus Blue Jackets
The Sacred Ashes Grim Dawn
Financial organizations College Road
Free Inter Tv Live
Notorious CT After-Hours Club Raided, Nets 3 Arrests, More To Come, Police Say
Strength Of The Unseen Gw2
Aldi Vs Costco: All Your Questions Answered
Find A Red Cross Blood Drive
Union Corners Obgyn
Fab Last Minute Cruises
10-Day Weather Forecast for Nockamixon Township, PA - The Weather Channel | weather.com
‘Justified: City Primeval’ Closes Out With Epic Twist: “It Was a Dangerous Idea”
State Road 38 Garage Sale Indiana 2023
Yxssied
Louis Chauffroy
Craiglist Quad Cities
Unraid Delete Share
Bay Country Crab Supply
H0271 013 04 - Local Ppo
Estes4Me Login
Azpeople Autozone
Dimbleby Funeral Home
5Gomovies
Jordans Auto Sale - Springfield, MA
Fivable Ap Chem
Savannah State University
Chicagoland Bodyrub
Allied Universal Jobs Hiring
Wausau Marketplace
Capt Juls Blog
Adam Bartley Net Worth
Oakley Rae Net Worth – Real Name, Wiki, Husband, Age, Height
Craigslist Kalispell Montana Personals
Susan Miller Libra 2023 Predictions
Q Nails - Howell, MI 48843 - Services and Reviews
4084716729
Game 76 Fnf
Learning The ABCs Of AI Can Bolster Your Career
Dr. Rolando Lozano Md Elizabeth Nj
Branson Shooting Range
Opscans 1073
Infinite Weight Ark
Da Costaschool Elspeet viert 25-jarig jubileum!
Campers Inn Rv Of Hu
Salmon Fest 2023 Lineup
Apartment living? How to cold plunge in small spaces
ROG Falchion Ace HFX | Gaming keyboards|ROG - Republic of Gamers|ROG USA
Streetsboro Discussion Board
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.