ArticleslgStudy

science

Oberon (programming language)

Oberon (programming language) is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Oberon (programming language) rather than just read about it. In short: Oberon is a general-purpose programming language first published in 1987 by Niklaus Wirth and the latest member of the Wirthian family of ALGOL-like languages (Euler, ALGOL W, Pascal, Modula, and Modula-2). Oberon was the result of a concentrated effort to increase the power of Modula-2, the direct successor of Pascal, and simultaneously to reduce its complexity.

Oberon (programming language) — main illustration
Oberon (programming language) — illustration

Key takeaways

  • Oberon (programming language) belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Oberon (programming language) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Oberon (programming language) from memory before moving on to harder problems.

Reference excerpt

Oberon is a general-purpose programming language first published in 1987 by Niklaus Wirth and the latest member of the Wirthian family of ALGOL-like languages (Euler, ALGOL W, Pascal, Modula, and Modula-2). Oberon was the result of a concentrated effort to increase the power of Modula-2, the direct successor of Pascal, and simultaneously to reduce its complexity. Its principal new feature is the concept of data type extension of record types. It permits constructing new data types on the basis of existing ones and to relate them, deviating from the dogma of strict static typing of data. Type extension is Wirth's way of inheritance reflecting the viewpoint of the parent site. Oberon was developed as part of the implementation of an operating system, also named Oberon at ETH Zurich in Switzerland. The name was inspired both by the Voyager space probe's pictures of the moon of the planet Uranus, named Oberon, and because Oberon is famous as the king of the elves. Oberon was maintained by Wirth and the latest Project Oberon compiler update is dated 6 March 2020.

Design Oberon is designed with a motto attributed to Albert Einstein in mind: "Make things as simple as possible, but not simpler." The principal guideline was to concentrate on features that are basic and essential and to omit ephemeral issues. Another factor was recognition of the growth of complexity in languages such as C++ and Ada. In contrast to these, Oberon emphasizes the use of the library concept to extend the language. Enumeration and subrange types, which were present in Modula-2, were omitted, and set types are limited to sets of integers. All imported items must be qualified by the name of the module where they are declared. Low-level facilities are highlighted by only allowing them to be used in a module which includes the identifier SYSTEM in its import list. Strict type checking, even across modules, and index checking at runtime, null pointer checking, and the safe type extension concept largely allow programming to rely on the language rules alone. The intent of this strategy was to produce a language that is easier to learn, simpler to implement, and very efficient. Oberon compilers have been viewed as compact and fast, while providing code quality comparable to commercial compilers.

Characteristics Features characterizing the Oberon language include:

Case-sensitive syntax with uppercase keywords Type extension with type test Modules and separate compiling String operations Isolating unsafe code Support for system programming

Object orientation Oberon supports extension of record types for the construction of abstractions and heterogeneous structures. In contrast to the later dialects, Oberon-2 and Active Oberon, the original Oberon lacks a dispatch mechanism as a language feature but has it as a programming technique or design pattern. This gives great flexibility in OOP. In the Oberon operating system, two programming techniques are used together for the dispatch call: Method suite and Message handler.

Method suite In this technique, a table of procedure variables is defined and a global variable of this type is declared in the extended module and assigned back in the generic module:

MODULE Figures; (* Abstract module *)

TYPE Figure* = POINTER TO FigureDesc; Interface* = POINTER TO InterfaceDesc;

InterfaceDesc* = RECORD draw* : PROCEDURE (f : Figure); clear* : PROCEDURE (f : Figure); mark* : PROCEDURE (f : Figure); move* : PROCEDURE (f : Figure; dx, dy : INTEGER); END;

FigureDesc* = RECORD if : Interface; END;

PROCEDURE Init* (f : Figure; if : Interface); BEGIN f.if := if END Init;

PROCEDURE Draw* (f : Figure); BEGIN f.if.draw(f) END Draw;

(* Other procedures here *)

END Figures.

We extend the generic type Figure to a specific shape:

MODULE Rectangles;

IMPORT Figures;

TYPE Rectangle* = POINTER TO RectangleDesc;

RectangleDesc* = RECORD (Figures.FigureDesc) x, y, w, h : INTEGER; END;

VAR if : Figures.Interface;

PROCEDURE New* (VAR r : Rectangle); BEGIN NEW(r); Figures.Init(r, if) END New;

PROCEDURE Draw* (f : Figure); VAR r : Rectangle; BEGIN r := f(Rectangle); (* f AS Rectangle *) (* ... *) END Draw;

(* Other procedures here *)

BEGIN (* Module initialisation *) NEW(if); if.draw := Draw; if.clear := Clear; if.mark := Mark; if.move := Move END Rectangles.

Dynamic dispatch is only done via procedures in Figures module that is the generic module.

Message handler This technique consists of replacing the set of methods with a single procedure, which discriminates among the various methods:

MODULE Figures; (* Abstract module *)

TYPE Figure* = POINTER TO FigureDesc;

Message* = RECORD END; DrawMsg* = RECORD (Message) END; ClearMsg* = RECORD (Message) END; MarkMsg* = RECORD (Message) END; MoveMsg* = RECORD (Message) dx*, dy* : INTEGER END;

Handler* = PROCEDURE (f : Figure; VAR msg : Message);

FigureDesc* = RECORD (* Abstract *) handle : Handler; END;

PROCEDURE Handle* (f : Figure; VAR msg : Message); BEGIN f.handle(f, msg) END Handle;

PROCEDURE Init* (f : Figure; handle : Handler); BEGIN f.handle := handle END Init;

END Figures.

We extend the generic type Figure to a specific shape:

MODULE Rectangles;

IMPORT Figures;

TYPE Rectangle* = POINTER TO RectangleDesc;

RectangleDesc* = RECORD (Figures.FigureDesc) x, y, w, h : INTEGER; END;

PROCEDURE Draw* (r : Rectangle); BEGIN (* ... *) END Draw;

(* Other procedures here *)

PROCEDURE Handle* (f: Figure; VAR msg: Figures.Message); VAR r : Rectangle; BEGIN r := f(Rectangle); IF msg IS Figures.DrawMsg THEN Draw(r) ELSIF msg IS Figures.MarkMsg THEN Mark(r) ELSIF msg IS Figures.MoveMsg THEN Move(r, msg(Figures.MoveMsg).dx, msg(Figures.MoveMsg).dy) ELSE (* ignore *) END END Handle;

PROCEDURE New* (VAR r : Rectangle); BEGIN NEW(r); Figures.Init(r, Handle) END New;

END Rectangles.

In the Oberon operating system both of these techniques are used for dynamic dispatch. The first one is used for a known set of methods; the second is used for any new methods declared in the extension module. For example, if the extension module Rectangles were to implement a new Rotate() procedure, within the Figures module it could only be called via a message handler.

Implementations and variants

… excerpt ends here. Continue reading the full article.

Illustrations

Oberon (programming language) illustration

Worked examples

Example 1 — a first encounter with Oberon (programming language)

Start with the simplest possible case. Write down what Oberon (programming language) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Oberon (programming language) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Oberon (programming language) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Oberon (programming language)

In research
Oberon (programming language) appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Oberon (programming language) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Oberon (programming language) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Class-based programming languages, Compiled programming languages, Modula programming language family, so understanding it makes those chapters shorter.
In everyday life
Look for Oberon (programming language) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Oberon (programming language)” →

How to study Oberon (programming language) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Oberon (programming language) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Oberon (programming language) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Oberon (programming language) in simple terms?

Oberon is a general-purpose programming language first published in 1987 by Niklaus Wirth and the latest member of the Wirthian family of ALGOL-like languages (Euler, ALGOL W, Pascal, Modula, and Modula-2). Oberon was the result of a concentrated effort to increase the power of Modula-2, the direct…

Why does Oberon (programming language) matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Oberon (programming language)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Oberon (programming language).

Tags

  • Class-based programming languages
  • Compiled programming languages
  • Modula programming language family
  • Oberon programming language family
  • Procedural programming languages
  • Programming languages created in 1986
  • Statically typed programming languages
  • Systems programming languages

Keep exploring