Question

Does Ada come with built-in GUI, and does it have the same unique approach to inheritance as does Oberon?

Was it helpful?

Solution

No, Ada does not come with a built-in GUI; but then the closest language that I can think of is PostScript. (Technically, the Java-language does not; though its included library does.) That being said there is a GTK binding (which I haven't used at all) and an OpenGL binding (that I've only played with; and to be honest the OpenGL binding is far thinner a binding than I'd like).

Oberon's inheritance model (as I understand) is single-extension inheritance which is the same as Ada; though Ada does incorporate an Interface system similar to Java. I haven't actually used Oberon, so I can't really provide you with a side-by-side examples for the two, but can show you an example of Ada's.

Base:

Type Base is Abstract Tagged Record
   Null;
End Record; -- Base

-- Base Operations
Procedure Op( Object : In Out Base );
Procedure Dispatching_Op( Object : In Out Base'Class );

Extension:

Type Extended is New Base With Record
  Null;
End Record; -- Extended

Overriding Procedure Op( Object : In Out Extended );

With bodies of, say:

  Procedure Op( Object : In Out Base ) is
  begin
     Put( "Hello" );
  end Op;

  Procedure Dispatching_Op( Object : In Out Base'Class ) is
  begin
     Op( Object );
     Put_Line( " World." );
  end Dispatching_Op;

  Procedure Op( Object : In Out Extended ) is
  begin
     Put( "Goodbye" );
  End Op;

Which given an object of type P {P : K.Base'Class:= K.Extended'(Others => <>);} could be called like so:

P.Dispatching_Op;

And would produce the following results in this instance:

Goodbye World.

OTHER TIPS

Few programming languages provide a built-in GUI, if by that you mean GUI primitives being an intrinsic part of the programming language itself. Ada can utilize GUI toolkits like other languages. Among those ready to use with Ada are GtkAda and QtAda. And RAPID is an interface designer specifically designed for creating Ada application user interfaces.

I can't speak to Oberon's approach to inheritance, but the Ada WikiBook has a good writeup on Ada's approach to object orientation.

Not a lot of programming languages come with a GUI. Oberon does, but only because it actually comes with an entire operating system (including that OS's GUI). Java has a couple, but for the exact same reason (the JVM is essentially Java's Operating System). Delphi has one because Delphi is essentially the name for Pascal when coupled with a specific GUI.

A typical programming language is meant to transcend a particular platform, and thus most users will want to use the standard GUI on whichever platform (Windows, Linux, etc) they happen to be working on. Ada is one of these.

That doesn't mean there aren't integrated environments meant to be used with Ada. Gnavi is a project attempting to do something like Delphi, but with Ada and standard Windows GUI's. GTKAda is a different project that helps Ada programs create GUIs using the GTK+ widget toolkit. GTK+ is one of the standard GUI toolkits used on Linux (and is portable to Windows).

As for inheritance, the last time I played with Oberon it looked like it used simple extension inheritance based on record types. This is the approach Ada takes as well. However, Ada's dispatch method is sort of halfway between what Oberon does and what C++ does. Mechanically it is similar to Oberon. The only thing that is a little odd is that routines are bound to the class (record) by virtue of using that class as a parameter and being defined in the same package as the class, instead of explicitly with some kind of keyword. Otherwise, it will look quite similar.

But I believe in Oberon all overriding methods are dynamic dispatch, whereas Ada only uses dynamic dispatch when it is required due to classwide pointers or references being used, like C++ does. If that doesn't cover your OO question, you may have to get more specific about what it is in Oberon's OO system you are wondering about.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top