Object-oriented programming languages and tools. Evolution of Smalltalk


Информатика, кибернетика и программирование

The lnguge ws first generlly relesed s Smlltlk80. Smlltlklike lnguges re in continuing ctive development nd hve gthered loyl communities of users round them. NSI Smlltlk ws rtified in 1998 nd represents the stndrd version of Smlltlk.



41 KB

0 чел.

Lecture 8. Object-oriented programming languages and tools. Part 2.

8.1 Evolution of Smalltalk1

Smalltalk is an object-oriented, dynamically typed, reflective programming language. The language was first generally released as Smalltalk-80. Smalltalk-like languages are in continuing active development, and have gathered loyal communities of users around them. ANSI Smalltalk was ratified in 1998 and represents the standard version of Smalltalk.

Smalltalk was the product of research led by Alan Kay at Xerox Palo Alto Research Center (PARC); Alan Kay designed most of the early Smalltalk versions, which Dan Ingalls implemented.

Smalltalk-80 was the first language variant made available outside of PARC, first as Smalltalk-80 Version 1, given to a small number of firms (Hewlett-Packard, Apple Computer, Tektronix, and DEC) and universities (UC Berkeley) for “peer review” and implementation on their platforms. Later (in 1983) a general availability implementation, known as Smalltalk-80 Version 2, was released as an image (platform-independent file with object definitions) and a virtual machine specification. ANSI Smalltalk has been the standard language reference since 1998.

Two of the currently popular Smalltalk implementation variants are descendants of those original Smalltalk-80 images. Squeak is an open source implementation derived from Smalltalk-80 Version 1 by way of Apple Smalltalk. VisualWorks is derived from Smalltalk-80 version 2 by way of Smalltalk-80 2.5 and ObjectWorks (both products of ParcPlace Systems, a Xerox PARC spin-off company formed to bring Smalltalk to the market). As an interesting link between generations, in 2001 Vassili Bykov implemented Hobbes, a virtual machine running Smalltalk-80 inside VisualWorks. (Dan Ingalls later ported Hobbes to Squeak.)

Object-oriented programming with Smalltalk.

As in other object-oriented languages, the central concept in Smalltalk-80 is that of an object. An object is always an instance of a class. Classes are “blueprints” that describe the properties and behavior of their instances. For example, a GUI’s window class might declare that windows have properties such as the label, the position and whether the window is visible or not. The class might also declare that instances support operations such as opening, closing, moving and hiding. Each particular window object would have its own values of those properties, and each of them would be able to perform operations defined by its class.

A Smalltalk object can do exactly three things:

  •  Hold state (references to other objects).
  •  Receive a message from itself or another object.
  •  In the course of processing a message, send messages to itself or another object.

The state an object holds is always private to that object. Other objects can query or change that state only by sending requests (messages) to the object to do so. Any message can be sent to any object: when a message is received, the receiver determines whether that message is appropriate. Alan Kay has commented that despite the attention given to objects, messaging is the most important concept in Smalltalk.

Smalltalk is a “pure” object-oriented programming language, meaning that, unlike Java and C++, there is no difference between values which are objects and values which are primitive types. In Smalltalk, primitive values such as integers, booleans and characters are also objects, in the sense that they are instances of corresponding classes, and operations on them are invoked by sending messages. A programmer can change or extend (through subclassing) the classes that implement primitive values, so that new behavior can be defined for their instances—for example, to implement new control structures—or even so that their existing behavior will be changed. This fact is summarized in the commonly heard phrase “In Smalltalk everything is an object”, which may be more accurately expressed as “all values are objects”, as variables are not.

Since all values are objects, classes themselves are also objects. Each class is an instance of the metaclass of that class. Metaclasses in turn are also objects, and are all instances of a class called Metaclass. Code blocks—Smalltalk’s way of expressing anonymous functions—are also objects


Smalltalk was one of many object-oriented programming languages based on Simula. Smalltalk was also one of the most influential programming languages. Virtually all of the object-oriented languages that came after—Flavors, CLOS, Objective-C, Java, Python, Ruby, and many others—were all influenced by Smalltalk. Smalltalk was also one of the most popular languages with the Agile Methods, Rapid Prototyping, and Software Patterns communities. The highly productive environment provided by Smalltalk platforms made them ideal for rapid, iterative development.

Smalltalk emerged from a larger program of ARPA funded research that in many ways defined the modern world of computing. In addition to Smalltalk working prototypes of things such as hypertext, GUIs, multimedia, the mouse, telepresence, and the Internet were developed by ARPA researchers in the 1960s. Alan Kay (one of the inventors of Smalltalk) also described a tablet computer he called the Dynabook which was essentially a design for an iPad.

Smalltalk environments were often the first to develop what are now common object-oriented software design patterns. One of the most popular is the Model–view–controller pattern for User Interface design. The MVC pattern enables developers to have multiple consistent views of the same underlying data. It's ideal for software development environments, where there are various views (e.g., entity-relation, dataflow, object model, etc.) of the same underlying specification. Also, for simulations or games where the underlying model may be viewed from various angles and levels of abstraction.

In addition to the MVC pattern the Smalltalk language and environment were tremendously influential in the history of the Graphical User Interface (GUI) and the What You See Is What You Get (WYSIWYG) user interface, font editors, and desktop metaphors for UI design. The powerful built-in debugging and object inspection tools that came with Smalltalk environments set the standard for all the Integrated Development Environments, starting with Lisp Machine environments, that came after.

8.2 C++2

C++ was developed by Bjarne Stroustrup of AT&T Bell Laboratories in the early 1980's, and is based on the C language. The name is a pun – “+” is a syntactic construct used in C (to increment a variable), and C++ is intended as an incremental improvement of C. Most of C is a subset of C++, so that most C programs can be compiled (i.e. converted into a series of low-level instructions that the computer can execute directly) using a C++ compiler.

C is in many ways hard to categorise. Compared to assembly language it is high-level, but it nevertheless includes many low-level facilities to directly manipulate the computer's memory. It is therefore an excellent language for writing efficient “systems” programs. But for other types of programs, C code can be hard to understand, and C programs can therefore be particularly prone to certain types of error. The extra object-oriented facilities in C++ are partly included to overcome these shortcomings.


The American National Standards Institution (ANSI) and the International Standards Organisation (ISO) provide “official” and generally accepted standard definitions of many programming languages, including C and C++. Such standards are important. A program written only in ANSI/ISO C++ is guaranteed to run on any computer whose supporting software conforms to the standard. In other words, the standard guarantees that standard-compliant C++ programs are portable. In practice most versions of C++ include ANSI/ISO C++ as a core language, but also include extra machine-dependent features to allow smooth interaction with different computers' operating systems. These machine dependent features should be used sparingly. Moreover, when parts of a C++ program use non-compliant components of the language, these should be clearly marked, and as far a possible separated from the rest of the program, so as to make modification of the program for different machines and operating systems as easy as possible. The four most significant revisions of the C++ standard are C++98 (1998), C++03 (2003) and C++11 (2011) and C++14 (2014). The next iteration is currently expected in 2017.

There are several editors available for UNIX-based systems. Two of the most popular editors are emacs and vi. For the compiler and linker, there is the GNU g++ compiler/linker, and for the debugger  the GNU debugger gdb. For those that prefer an integrated development environment (IDE) that combines an editor, a compiler, a linking program and a debugger in a single programming environment (in a similar way to Microsoft Developer Studio under Windows NT), there are also IDEs available for UNIX (e.g. Eclipse, xcode, kdevelop etc.).

Example. “Hello world” program.

//-- Hello world C++

#include <iostream.h>

#include <conio.h>

using namespace std;

int main ()


cout << "Hello, world!";


return 0;


8.3 Java


Before Java emerged as a programming language, C++ was the dominant player in the trade. The primary goals that the creators of Java was to create a language that could tackle most of the things that C++ offered while getting rid of some of the more tedious tasks that came with the earlier languages.

James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. Java was originally designed for interactive television, but it was too advanced for the digital cable television industry at the time. The language was initially called Oak after an oak tree that stood outside Gosling's office. Later the project went by the name Green and was finally renamed Java, from Java coffee, said to be consumed in large quantities by the language’s creators. Gosling designed Java with a C/C++-style syntax that system and application programmers would find familiar.

\Sun Microsystems released the first public implementation as Java 1.0 in 1995. It promised “Write Once, Run Anywhere” (WORA), providing no-cost run-times on popular platforms. Fairly secure and featuring configurable security, it allowed network- and file-access restrictions. Major web browsers soon incorporated the ability to run Java applets within web pages, and Java quickly became popular. The Java 1.0 compiler was re-written in Java by Arthur van Hoff to comply strictly with the Java 1.0 language specification. With the advent of Java 2 (released initially as J2SE 1.2 in December 1998 – 1999), new versions had multiple configurations built for different types of platforms. J2EE included technologies and APIs for enterprise applications typically run in server environments, while J2ME featured APIs optimized for mobile applications. The desktop version was renamed J2SE. In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE, Java ME, and Java SE, respectively.

In 1997, Sun Microsystems approached the ISO/IEC JTC 1 standards body and later the Ecma International to formalize Java, but it soon withdrew from the process. Java remains a de facto standard, controlled through the Java Community Process. At one time, Sun made most of its Java implementations available without charge, despite their proprietary software status. Sun generated revenue from Java through the selling of licenses for specialized products such as the Java Enterprise System.

On November 13, 2006, Sun released much of Java as free and open-source software, (FOSS), under the terms of the GNU General Public License (GPL). On May 8, 2007, Sun finished the process, making all of Java's core code available under free software/open-source distribution terms, aside from a small portion of code to which Sun did not hold the copyright.

Oracle Corporation acquired Sun Microsystems in 2009–2010. Java software runs on everything from laptops to data centers, game consoles to scientific supercomputers. There are 930 million Java Runtime Environment downloads each year and 3 billion mobile phones run Java.

Principles. There were five primary goals in the creation of the Java language:

  •  It must be “simple, object-oriented and familiar”
  •  It must be “robust and secure”
  •  It must be “architecture-neutral and portable”
  •  It must execute with “high performance”
  •  It must be “interpreted, threaded, and dynamic”

Versions. Major release versions of Java, along with their release dates:

  •  JDK 1.0 (January 21, 1996)
  •  JDK 1.1 (February 19, 1997)
  •  J2SE 1.2 (December 8, 1998)
  •  J2SE 1.3 (May 8, 2000)
  •  J2SE 1.4 (February 6, 2002)
  •  J2SE 5.0 (September 30, 2004)
  •  Java SE 6 (December 11, 2006)
  •  Java SE 7 (July 28, 2011)
  •  Java SE 8 (March 18, 2014)

Java platform.

One design goal of Java is portability, which means that programs written for the Java platform must run similarly on any combination of hardware and operating system with adequate runtime support. This is achieved by compiling the Java language code to an intermediate representation called Java bytecode, instead of directly to architecture-specific machine code. Java bytecode instructions are analogous to machine code, but they are intended to be executed by a virtual machine (VM) written specifically for the host hardware. End users commonly use a Java Runtime Environment (JRE) installed on their own machine for standalone Java applications, or in a web browser for Java applets.

Standardized libraries provide a generic way to access host-specific features such as graphics, threading, and networking.

A major benefit of using bytecode is porting. However, the overhead of interpretation means that interpreted programs almost always run more slowly than programs compiled to native executables would. Just-in-Time (JIT) compilers were introduced from an early stage that compile bytecodes to machine code during runtime.


The syntax of Java is largely derived from C++. Unlike C++, which combines the syntax for structured, generic, and object-oriented programming, Java was built almost exclusively as an object-oriented language. All code is written inside a class, and everything is an object, with the exception of the primitive data types, i.e., integers, floating-point numbers, boolean values, and characters, which are not classes for performance reasons.

Unlike C++, Java does not support operator overloading or multiple inheritance for classes. This simplifies the language and aids in preventing potential errors and anti-pattern design.

Java uses similar commenting methods to C++. There are three different styles of comments: a single line style marked with two slashes (//), a multiple line style opened with /* and closed with */, and the Javadoc commenting style opened with /** and closed with */. The Javadoc style of commenting allows the user to run the Javadoc executable to compile documentation for the program.


The traditional “Hello, world!” program can be written in Java as:

class HelloWorldApp {

   public static void main(String[] args) {

       System.out.println("Hello World!"); // Print the string to the console.



1 http://en.wikipedia.org/wiki/Smalltalk

2 http://www.doc.ic.ac.uk/~wjk/C++Intro/RobMillerL1.html


А также другие работы, которые могут Вас заинтересовать

  В общим случае МП состоит из трехполюсного контактора переменного тока электротеплового реле ЭТР и кнопок управления. Время токовая или защитная характеристика ЭТР зависимость времени срабатывания tср от тока I МП должна согласовываться с перегрузочной характеристикой электродвигателя зависимость допустимого времени протекания тока tдоп от тока I. К клеммам Х1 и Х2 подключается настольный амперметр для измерения тока в обмотке МП. Промежуточное реле KL1 и трансформатор тока ТА1 расположены за стендом.
21036. Электромагнитные воздушные контакты 56 KB
  Для катушек постоянного тока неблагоприятным условием при срабатывании является подача пониженного напряжения 085Uн на катушку нагретую до установившейся температуры Θдоп максимальным напряжением 105Uн. Иногда испытание на втягивание заключается в определении напряжения Uчс чёткого срабатывания т. напряжения при котором якорь переходит из одного крайнего положения в другое без заметного торможении в промежуточном положении. Поскольку чёткость срабатывания обычно определяется на слух то значение напряжения чёткого срабатывания...
21037. Исследование электрической дуги постоянного тока 134.5 KB
  Целью работы является исследование неподвижной дуги постоянного тока определение вольтамперной характеристики дуги между электродами выполненными из различных материалов исследование влияния длины дуги и шунтирующего сопротивления на характеристики дуги. Одной из основных характеристик дуги является ее вольтамперная характеристика зависимость напряжения на дуге от тока дуги. С ростом тока дуги вследствие разогрева дугового столба ее сопротивление уменьшается быстрее нежели растет ток.
21038. Исследование герконовых реле 552 KB
  Общие положения Отечественной промышленностью выпускаются одно и многоконтактные реле на замыкание размыкание и переключение преимущественно расположением герконов внутри катушки управления и с внешним магнитопроводом [12]. Для реле с одним замыкающим герконом рис.2 описывается выражением 1 и 2 и их соотношением определяются процессы срабатывания и возврата геркона где С приведенная жесткость контактных сердечников КС геркона; δн и δ начальное и текущее значения немагнитного зазора между КС; F магнитодвижущая сила МДС...
  Краткие сведения об автоматах Автоматы это аппараты предназначенные для нечастых включений и отключений электрических цепей по команде оператора и автоматического отключения цепей при ненормальных режимах в них. Автоматы изготовляются на номинальные токи до 6000 А а отдельные серии до 2030 кА на номинальные напряжения до 660 В переменного тока и до 440 В постоянного тока. В зависимости от требовании к времени срабатывания и от назначения автоматы подразделяются на: 1 Небыстродействующие постоянного и переменного тока время...
21040. Исследование электромагнитных контакторов 67 KB
  Электромагнитный контактор представляет собой электромагнит постоянного или переменного тока по обмотке которого протекает ток. В качестве приводных электромагнитов постоянного тока обычно применяются клапанные Побразные электромагниты с внешним качающимся якорем рис. Кроме того необходимо иметь гибкое соединение для подвода тока к подвижному контакту. Исполнение дугогасительных систем контакторов зависит от рода и уровня тока коммутируемой цепи.
21041. Исследование герконовых реле 178.5 KB
  Ульянова Электротехнический факультет Кафедра электрических и электронных аппаратов ЛАБОРАТОРНАЯ РАБОТА №64 Исследование герконовых реле Выполнили студенты группы ЭТ2103: Кузнецов А. Лабораторная работа №64 Исследование герконовых реле Цель работы: изучение конструкций герконов и реле на их основе исследование параметров реле и геркона. Отечественной промышленностью выпускаются одно и многоконтактные реле на замыкание размыкание и переключение преимущественно с расположением герконов внутри катушки управления и с внешним...
21042. Виртуальные машины 207.5 KB
  Опять же необходимо указать имя и место сохранения создаваемого диска. Поэтому сразу выберите место для сохранения с учетом достаточности свободного пространства на реальном разделе жесткого диска. Отмечу некоторые особенности: к системе можно подключить три жестких диска. Напоследок рассмотрим процедуру создания нового виртуального жесткого диска.
  Представьте как это удобно если вы хотите разрешить виртуальной машине полный доступ к вашим файлам на реальной машине. При выборе этого пункта создается лишь файл виртуальной машины без дефолтного железа после чего открывается окно настройки и на образ навешиваются и настраиваются дополнительные виртуальные комплектующие сетевые адаптеры образа дисков и прочее. Нажмите кнопку Next На третьем экране нам предлагают ввести имя нашей виртуальной машины и место где мы ее разместим на физическом диске компьютера.