Simula


Simula ( Sim ple u niversal the nguage ) was established in 1962 under the name Simula I by Ole-Johan Dahl and Kristen Nygaard on from Algol 60 . The language evolved in 1967 under the name of Simula 67 by implanting the first class model Hoare (Record Class, Hoare 1965). It is therefore the first class language and therefore the father of all class languages such as Smalltalk , C ++ , Java , or Eiffel . He inspired Dan Ingalls in the design of Smalltalk which introduced object-oriented programming. C ‘

History

Simula was developed in the 1960s at the Norwegian Computing Center in Oslo , initially by Ole-Johan Dahl and Kristen Nygaard . Syntactically speaking, it is a superset of Algol , which adds to it the familiar concepts of class-based languages ​​such as Java C ++ and discrete event simulation .

Simula has been used for industrial applications to date [when?] , But its historical influence is considered more important than applications that could have been developed with it.

By Simula generally means Simula-67 , that is to say, the 1967 version, while the previous version dated from 1962 Simula I .

Discrete Simulation

As its name suggests, in addition to being a general-purpose programming language, Simula was designed to contain class libraries that support concepts specific to discrete event simulation . The Process class , inheriting Simulation, allowed the user to inherit for his own simulation classes the basic behavior of a process that can be executed in a quasi-parallel mode , using the concept of Coroutine .

A coroutine is a routine with several exit points and, at each re-entry of the execution stream in it during a call to the Resume statement , resumes its execution at the last instruction where the stream Had previously left on a call to Detach instruction . The execution point is stored in the LSC: Local Sequence Counter .

To clarify this, the following program would produce the display shown below:

 Begin
 Ref (TwinProcess) firstProc, secondProc;
 Class TwinProcess (Name);
 Text Name;
 Begin
 ! Initial coroutine entry (creation)
 Ref (TwinProcess) Twin;
 OutText (Name); OutText ( ": Creation" ); OutImage;
 ! First coroutine exit
 Detach;
 ! Second coroutine entry
 OutText (Name); OutText ( ": Second coroutine entry" ); OutImage;
 ! Second coroutine exit: switch to the twin's coroutine
 Resume (Twin);
 ! Last coroutine entry
 OutText (Name); OutText ( ": Last coroutine entry" ); OutImage;
 Resume (Twin);
 End ;
 Begin
 firstProc: - New TwinProcess ( "1st Proc" );
 SecondProc: - New TwinProcess ( "2nd Proc" );
 FirstProc.Twin: - secondProc;
 SecondProc.Twin: - firstProc;
 OutText ( "Starting" ); OutImage;
 Resume (firstProc);
 OutText ( "End" );
 End ;
 End ;

Display:

 1st Proc: Creation
 2nd Proc: Creation
 Starting
 1st Proc: Second coroutine entry
 2nd Proc: Second coroutine entry
 1st Proc: Last Coroutine entry
 2nd Proc: Last coroutine entry
 End

The discrete simulation library was used to manage the process queue using dedicated instructions ( Activate , Passivate , Hold , etc.)

Programming object

Most of the constructions that will later enable the realization of the main concepts of object-oriented programming are already present in Simula 67 :

  • The classes as data structure in Simula gathering variables and operations on them (in Simula, they represented activities),
  • The instantiation via the New statement ,
  • The relations between objects (or processes in the original jargon of Simula) by means of references: Ref () and assignment of references with the instruction : –
  • Reference to the current instance using the keyword This
  • Null-supported null reference test Inspect-Do-Otherwise : Inspect rect do Draw here, x.Draw will only be called if x is not a null reference (keyword: None )
  • Virtual functions
  • Method call by dot-notation : <object>. <Method>
  • Call (ie statically bound) of virtual methods using the Qua operator or with Inspect-When
  • Type recognition at runtime ( Inspect , Is , In )
  • Simple inheritance between classes
  • Restricted access ( Hidden , Protected )
  • Nested (or internal) classes
  • Sophisticated nesting of calls of the method body of the class via the Inner statement , which can thus make it possible to force the execution of code before and / or after the execution of the body of a derived class: The concept of assertions, implemented by Eiffel in the 1980s , or even programming by aspect , which will be developed in the 1990s .
  • a crumb in English : garbage-collector .

This short list makes it possible to become aware of the conceptual breakthrough made by Simula in 1967 in the field of structured imperative languages.

Unfortunately, the authors of Simula brought some confusion in the world of object-oriented programming. With the emergence of this new paradigm with Smalltalk, Ole Johan Dahl and Kristen Nygaard changed the names used in Simula to conform to the concepts conveyed in Smalltalk (classes of objects, objects, attributes, methods, etc.) and declared that Simula 67 was actually the first object-oriented language. Yet the approach used in Simula 67 is not that defined by Alan Kay, the author of the oriented programming.