Does Ada come with built-in GUI, and does it have the same unique approach to inheritance as does Oberon?
-
1FYI to readers: Erich originally posed this question in a comment on question http://stackoverflow.com/questions/7182968/where-can-i-learn-oberon-and-what-ide-can-i-use , and kindly reposted it here at my urging. If you are primarily interested in Oberon, you should check out that question as well. – T.E.D. Aug 29 '11 at 18:04
3 Answers
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.

- 8,664
- 1
- 24
- 29
-
1See also this [Q&A](http://stackoverflow.com/questions/6755110/how-to-use-gtk-with-ada). – trashgod Aug 27 '11 at 15:50
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.

- 4,095
- 1
- 17
- 31
-
3The most common Ada style is to use lower case for keywords and mixed case for identifiers. For example: `procedure Op( Object : in out Base );` – Keith Thompson Aug 29 '11 at 02:43
-
1...however, Ada is case-insesitive, so nothing *enforces* this. (Hence Keith's use of the word "style") – T.E.D. Aug 29 '11 at 13:22
-
I love case-insensitivity; there is no good reason why a programming language should choke because I hold shift down too long (or not long enough)... in fact, if _style_ is all that important there's no reason why the compiler itself cannot be co-opted to put the source into that style. – Shark8 Aug 29 '11 at 19:44
-
...which the Gnat compiler *can be*. But of course that is another question. http://stackoverflow.com/questions/6430204/how-to-write-gnatcheck-rules – T.E.D. Aug 29 '11 at 22:31
-
Isn't that for throwing errors on "bad styles," rather than just taking the code and reformatting it to the "right" style? – Shark8 Aug 29 '11 at 23:28
-
You can do both.. use gnatpp for reformatting the source, or adjust the style settings for your project and add compiler switches to enforce your own style. Before I publish code on sites like rosettacode, I usually run it through gnatpp and compare it with the original. Some changes are unnecessary, but others are worth it. – Rommudoh Aug 30 '11 at 06:34
-
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.

- 44,016
- 10
- 73
- 134
-
In Oberon one can use both static and dynamic dispatch. In fact, strictly speaking, Oberon doesn't actually provide any dispatch mechanism, but you can easily program one yourself. Wirth gives examples for both static and dynamic dispatch in "Programming in Oberon". He states that static dispatch is useful for methods known to be universal and added to the base type while dynamic dispatch is for everything else. The primary motive appears to be avoidance of the fragile base class problem that is so common in many OOP languages. – trijezdci Oct 28 '15 at 15:59