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


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

81234. Методические рекомендации по теме «Первое знакомство с компьютером» 44.26 KB
  Функция Человек Компьютер Хранение информации Память Устройства памяти Обработка информации Мышление Процессор Прием информации Органы чувств Устройства ввода Передача информации Речь двигательная система Устройства вывода Устройства компьютера связаны между собой каналами передачи информации. Суть принципа программного управления компьютером сводится к следующим трем положениям: Любая работа выполняется компьютером по программе; Исполняемая программа находится в оперативной памяти; Программа выполняется автоматически. Затем следует...
81235. Методика изучения темы «дисковая ос». Методические рекомендации по изучению темы «Программы-оболочки ОС» 38.31 KB
  Любые операционные системы независимо от типа выполняют три основные функции: управление устройствами компьютера; взаимодействие с пользователем; работа с файлами. Третья функция операционной системы работа с файлами. Первоначальные понятия которые должны быть даны ученикам по данной теме это имя файла тип файла файловая структура логический диск каталог путь к файлу дерево каталогов. Для Windows сообщаете что имя файла может быть длинным до 255 символов и допускает использование русских букв.
81236. Методические рекомендации по организации и проведению практических занятий при изучении темы «Текстовый редактор» 36.45 KB
  Обучить основным приемам работы с текстовым редактором. Рекомендации по организации практической работы на компьютере. Навыки ввода и редактирования текста нужны пользователю не только для работы с текстовым редактором. Ввод и редактирование текстов осуществляется с помощью специальных программ – текстовых редакторов используемых в семействах операционных систем UNIX и MS Windows Семейство ОС Названия редакторов UNIX Emcs Vi TED Str Office Writer MS Windows Блокнот Word WordPd Лексикон Str Office Writer Несмотря на различия все...
81237. Методические рекомендации по организации и проведению практических занятий при изучении темы «Электронные таблицы» 38.16 KB
  Состав электронной таблицы. Прямоугольная область таблицы называется диапазоном ячеек. Каждая ячейка таблицы имеет следующие характеристики: адрес содержимое изображение формат имя примечание комментарий Абсолютная и относительная адресация ячеек.
81238. Методические рекомендации по организации и проведению практических занятий при изучении темы «базы данных» 38.44 KB
  Для сознательной работы с БД на уровне пользователя рекомендуется примерный минимум этих понятий: объект атрибут система связь; структурирование представление и нормализация данных; таблица первичный и внешний ключи; связь между таблицами индексирование поиск выборка и некоторые другие они имеют специфический неочевидный смысл. Обязательный минимум содержания образования по информатике в разделе информационные технологии: Базы данных. Системы управления базами данных.
81239. Методические рекомендации по организации и проведению практических занятий при изучении темы «графический редактор» 38.11 KB
  Режимы определяют возможные действия пользователя а также команды которые пользователь может отдавать редактору в данном режиме. В этом режиме можно выполнять команды записи рисунка на диск считывания рисунка с диска вывода рисунка на печать. Система команд графического редактора Команды выбора инструмента; Команды настройки инструмента ширина линий шрифт; Команды выбора цветов; Команды масштабирования рисунка; Команды работы с буфером обмена вырезать копировать вставить; Команды манипулирования с выделенным фрагментом...
81240. Компьютерные сети в образовании. Методические рекомендации по изучению темы «Сетевые информационные технологии» 38.58 KB
  Дать представление о назначении и структуре локальных и глобальных сетей; Познакомить учся с основными инф. услугами сетей с возможностями internet; Обучить способам обмена файлами в лок. сетей на 2 типа: локальные сети и глобальные. сетей обширна по числу понятий и может излагаться с разной степенью подробности.
81242. Цели и задачи обучения информатике в средней школе. Педагогические функции курса информатики. Структура обучения информатике в общеобразовательной школе 35.38 KB
  Федеральный компонент структурирован по ступеням общего образования начальное общее основное общее среднее полное общее образование; внутри ступеней по учебным предметам Изучение информатики и ИКТ направлено на достижение следующих целей: освоение знаний составляющих основу научных представлений об информации информационных процессах системах технологиях и моделях; овладение умениями работать с различными видами информации с помощью компьютера и других средств информационных и коммуникационных технологий ИКТ организовывать...