Simula Mother Tongue for a Generation of Nordic Programmers
Total Page:16
File Type:pdf, Size:1020Kb
Simula! Mother Tongue! for a Generation of! Nordic Programmers! Yngve Sundblad HCI, CSC, KTH! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Inspired by Ole-Johan Dahl, 1931-2002, and Kristen Nygaard, 1926-2002" “From the cold waters of Norway comes Object-Oriented Programming” " (first line in Bertrand Meyer#s widely used text book Object Oriented Software Construction) ! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Simula concepts 1967" •# Class of similar Objects (in Simula declaration of CLASS with data and actions)! •# Objects created as Instances of a Class (in Simula NEW object of class)! •# Data attributes of a class (in Simula type declared as parameters or internal)! •# Method attributes are patterns of action (PROCEDURE)! •# Message passing, calls of methods (in Simula dot-notation)! •# Subclasses that inherit from superclasses! •# Polymorphism with several subclasses to a superclass! •# Co-routines (in Simula Detach – Resume)! •# Encapsulation of data supporting abstractions! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Simula example BEGIN! REF(taxi) t;" CLASS taxi(n); INTEGER n;! BEGIN ! INTEGER pax;" PROCEDURE book;" IF pax<n THEN pax:=pax+1;! pax:=n;" END of taxi;! t:-NEW taxi(5);" t.book; t.book;" print(t.pax)" END! Output: 7 ! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Teaching basic computer science from 1970 Data structures" on firm theoretical footing by Ole-Johan Dahl, Tony Hoare, Niklaus Wirth (Algorithms+Datastructues=Programs)! Simula excellent tool, example:! Binary tree node with post order scan method! CLASS node(left, right); REF(node) left, right;! BEGIN ! PROCEDURE scan(x); REF(node) x;! INSPECT x DO BEGIN! scan(left);! scan(right);! visit(THIS node);! END of scan;! END of node;! Built in Simula framework (class) for set handling, Simset! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Teaching basic computer science from 1970 Program structuring" In Simula Ole-Johan Dahl and Kristen Nygaard invented structuring into objects as instances of classes and subclasses," complementing the then current procedural structures.! This encourages encapsulation and inheritance for modularisation and reuse and tree structuring of program elements, supporting overview and maintainability of programs.! Structured Programming with Style was put on firm theoretical and practical foundation in the early 1970s by" Ole-Johan Dahl, Edsger Dijkstra & Niklaus Wirth (Structured Programming book), Brian Kernighan & P.J. Plauger (The Elements of Programming Style book), Donald Knuth and Kristen Nygaard ! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Teaching basic computer science from 1970 Program structures: Coroutines & Simulation" The advanced Simula constructions (procedures)! Detach! Resume(x)! Call(x)! allows an object under execution to stop and hand over control to another detached object, which then continues its execution, or the main program.! This quasi-parallellism is the basis for the discrete event simulation facilities in the framework (class) Simulation.! This can be used for emulation of real parallellism and was taught to the most advanced students.! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Teaching basic computer science from 1970 Computer Graphics and Interaction" Object-oriented structures, class and subclass hierarchy and objects with methods, are very natural when describing graphical entities on the screen with interaction.! In our first graphics courses basic structuring and algorithmic concepts such as display lists, hidden surface algorithms, finding object clicked on etc., were described and implemented in Simula.! In the 1980s Smalltalk, much more elaborated, and a graphic environment in itself, took over this role.! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Simula programming tools from the 1970s Around Simula were developed (in Simula) tools to facilitate structuring, debugging, analysing and safeguarding programs:! SIMED – structuring source code with indentation, capitalising Simula keyword etc.! SIMDDT – debugging with setting halt point, inspecting variables at those points, etc. ! FQC – getting statistics on number of executions of each statement! SAFEIO – Input routines that check validity of type of input, within prescribed interval, etc. ! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Simula dialog programming environment DEC-10 and DEC-20" A deciding factor for the success of Simula in education and research was the implementation for the DEC-systems, our first advanced dialog time-sharing environment, from early 1970s (Arnborg, Jones, Noble, Weston & al, FOA)! At KTH it was extensively used" 1976-1988, on three dedicated" DEC20-computers, " Nadja, Vera & Venus.! Here (June 2010) is Nadja, " which started directly after" 22 years of stand-still.! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Simula heritage in Programming languages:! •# 1970s: Smalltalk (Alan Kay, Adele Goldberg), " Modula-2 (Niklaus Wirth), LOOPS (Dan Bobrow)! •# 1980s: Eiffel (Bertrand Meyer), " C++ (Bjarne Stroustrup), Objective C (Brad Cox), " Object Pascal (Niklaus Wirth, Anders Hejlsberg)! •# 1990s: Python (Guido van Rossum), " Java (Jim Gosling), Objective Ada (Jean Ichbiah), " C# (Anders Hejlsberg)! All are based on concepts in Simula, the “Latin” of object oriented programming languages, that “modern” languages build on! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Simula heritage in programming environments! Smalltalk-80, the generic! program development browser" “Then there was Simula. It was a great concept and I was lucky enough to see it as almost a new thing.”! “If you combine Simula and Lisp—Lisp didn$t have data structures, it had instances of objects—you would have a dynamic type system that would give you the range of expression you need.”! “It is not too much of an exaggeration to say that most of my ideas from then on took their roots from Simula--but not as an attempt to improve it. It was the promise of an entirely new way to structure computations that took my fancy. As it turned out, it would take quite a few years to understand how to use the insights and to devise efficient mechanisms to execute them.”! Citations from Alan Kay and Adele Goldberg on the ideas behind Smalltalk! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Post-Simula in our education:! Until 1986 all first programming courses at KTH used Simula, majors the full object-oriented concepts, minors the Algol part.! From 1984 Smalltalk was introduced in second course on graphics and interaction, on Sun, Tektronix, Macintosh.! First course for majors from 1986 is Abelson-Sussman: Structure and Interpretation of Computer Programs, based on “pure” Lisp dialect Scheme. ! Minors start with Java, then elective Python.! The NADA Stockholm University major Computer Science education used Simula on Macintoshes until 1997, then Abelson-Sussman.! Computer Science in Lund also used Simula in education until 1997 and keeps up the heritage by providing compilers.! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Thanks! NADA (CSC), KTH:! FOA (FOI):! Stefan Arnborg! Kalle Mäkilä! Serafim Dahl! Mats Ohlin ! Örjan Leringe! Jacob Palme! Kjell Lindqvist! Lund University:! Staffan Romberger! Sten Henriksson! Boris Magnusson! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad! Simula in education:! Questions?! Similar or different experiences?! ! KTH - CSC (School of Computer Science and Communication) Yngve Sundblad – Simula OctoberYngve 2010Sundblad!.