Dynamic Object-Oriented Programming with Smalltalk 1. Introduction Prof. O. Nierstrasz Summer Semester 2006.

Slides:



Advertisements
Similar presentations
Dynamic Object-Oriented Programming with Smalltalk 1. Introduction Prof. O. Nierstrasz.
Advertisements

Dynamic Object-Oriented Programming with Smalltalk 1. Introduction Prof. O. Nierstrasz.
8. Static Single Assignment Form Marcus Denker. © Marcus Denker SSA Roadmap  Static Single Assignment Form (SSA)  Converting to SSA Form  Examples.
Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
MC697 Object-Oriented Programming Using Java. In this class, we will cover: How the class will be structured Difference between object-oriented programming.
OORPT Object-Oriented Reengineering Patterns and Techniques 7. Problem Detection Prof. O. Nierstrasz.
11. A bit of Smalltalk. © O. Nierstrasz P2 — A bit of Smalltalk 11.2 A bit of Smalltalk Overview  Some history  Smalltalk syntax & object model  The.
Dynamic Object-Oriented Programming with Smalltalk 1. Introduction Prof. O. Nierstrasz Autumn Semester 2009.
Chapter 1 Object-Oriented System Development
Dynamic Object-Oriented Programming with Smalltalk 1. Introduction Prof. O. Nierstrasz Autumn Semester 2007.
Object-Oriented Reengineering Patterns and Techniques Prof. O. Nierstrasz Prof. S. Ducasse T.
12. Summary, Trends, Research. © O. Nierstrasz PS — Summary, Trends, Research Roadmap  Summary: —Trends in programming paradigms  Research:...
ESE Einführung in Software Engineering N. XXX Prof. O. Nierstrasz Fall Semester 2009.
© Oscar Nierstrasz ST — Smalltalk Basics 2.1 Change sets  Make sure your changes are logged to a new change set.
The Software Composition Group Prof. O. Nierstrasz
Object Oriented System Development with VB .NET
13. Summary, Trends, Research. © O. Nierstrasz PS — Summary, Trends, Research Summary, Trends, Research...  Summary: functional, logic and object-oriented.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
Stéphane Ducasse 1 The Taste of Smalltalk.
13. A bit of Smalltalk. © Oscar Nierstrasz 2 Roadmap  The origins of Smalltalk  What is Smalltalk?  Syntax in a nutshell  Seaside — web development.
Dynamic Object-Oriented Programming with Smalltalk 1. Introduction Prof. O. Nierstrasz Summer Semester 2006.
13. Traits. Selected literature  Cook. Interfaces and Specifications for the Smalltalk-80 Collection Classes. OOPSLA 1992  Taivalsaari. On the Notion.
Exploring the iPhone SDK Toyin Adedokun & Daniel Laughlin.
Metamodeling Seminar X. CHAPTER Prof. O. Nierstrasz Spring Semester 2008.
Programmierung 2 Object-Oriented Programming with Java Prof. O. Nierstrasz Sommersemester 2006.
SMALLTALK Presented By Kameron Ethridge Sheree Martin Cassandra Void Michael Williams.
Stéphane Ducasse6.1 Essential Concepts Why OO? What is OO? What are the benefits? What are the KEY concepts? Basis for all the lectures.
© Oscar Nierstrasz ST — Smalltalk Basics 2.1 Change sets  Make sure your changes are logged to a new change set.
Principles of Object-oriented Programming Programming Language Paradigms August 26, 2002.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
Java Programming, 3e Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
N. XXX Prof. O. Nierstrasz Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes.
12. Summary, Trends, Research. © O. Nierstrasz PS — Summary, Trends, Research Roadmap  Summary: —Trends in programming paradigms  Research:...
© S. Demeyer, S. Ducasse, O. Nierstrasz Chapter.1 MakeMoney Corp. C*O of MakeMoney Corp. Our Vision  We invest in software  We do not know software 
OORPT Object-Oriented Reengineering Patterns and Techniques X. CHAPTER Prof. O. Nierstrasz.
Stéphane Ducasse3.1 The Squeak Environment. Stéphane Ducasse3.2 Smalltalk Run-Time Architecture Virtual Machine + Image + Changes and Sources Image =
CP — Concurrent Programming X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
12. A bit of Smalltalk. © O. Nierstrasz P2 — A bit of Smalltalk 11.2 Roadmap  Some history  Smalltalk syntax & object model  The Smalltalk environment.
12. eToys. © O. Nierstrasz PS — eToys 12.2 Denotational Semantics Overview:  … References:  …
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
S.Ducasse Stéphane Ducasse 1 The Taste of Smalltalk.
CMSC 202 Computer Science II for Majors Fall 2009 Introduction.
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Starting Chapter 4 Starting. 1 Course Outline* Covered in first half until Dr. Li takes over. JAVA and OO: Review what is Object Oriented Programming.
CSCI 224 Introduction to Java Programming. Course Objectives  Learn the Java programming language: Syntax, Idioms Patterns, Styles  Become comfortable.
Microsoft Visual Basic 2005: Reloaded Second Edition
3A-1 1 Introduction to Smalltalk History of Smalltalk The philosophy of Smalltalk:  “...we have a universe of well-behaved objects that courteously ask.
CSE 3302 Programming Languages Chengkai Li Spring 2008 Object-Oriented Programming Lecture 13 – OO Programming, Spring CSE3302 Programming Languages,
 2003 Joel C. Adams. All Rights Reserved. Calvin CollegeDept of Computer Science(1/10) An Overview of Objects and the Java API Joel Adams and Jeremy Frens.
7. Just In Time Compilation Prof. O. Nierstrasz Jan Kurs.
Introduction To System Analysis and Design
Visual C++ Programming: Concepts and Projects
Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation.
S.Ducasse Stéphane Ducasse 1 The VisualWorks Environment.
Mrs. Ulshafer August, 2013 Java Programming Chapter 1.
Chapter 2: A Brief History Object- Oriented Programming Presentation slides for Object-Oriented Programming by Yahya Garout KFUPM Information & Computer.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
Alan Kay: LCC 2700: Intro to Computational Media Spring 2005.
Smalltalk Mark Colangelo CMSC-631, Fall December 2002.
 Programming - the process of creating computer programs.
Stéphane Ducasse 1 Run-Time...
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
A Survey of Object-Oriented Concept Oscar Nierstrasz.
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
Augmenting Understanding: 2 Digital Innovators LCC 2700: Intro to Computational Media Fall 2005 Ian Bogost.
LCC 2700: Intro to Computational Media
Aaron Bloomfield CS 415 Fall 2005
Let’s Talk about… Smalltalk.
Presentation transcript:

Dynamic Object-Oriented Programming with Smalltalk 1. Introduction Prof. O. Nierstrasz Summer Semester 2006

© Oscar Nierstrasz ST — Introduction 1.2 Smalltalk LecturerProf. Oscar Nierstrasz AssistantsMarcus Denker, Lukas Renggli, Christoph Hofer LecturesIWI 001, 10h15-12h00 ExercisesIWI 001, 12h00-13h00 WWWwww.iam.unibe.ch/~scg/Teaching/Smalltalk/ Selected material courtesy Stéphane Ducasse

© Oscar Nierstrasz ST — Introduction 1.3 Roadmap > Course schedule, goals, resources > What is Smalltalk? > Origins of Smalltalk > Smalltalk key concepts > The Smalltalk environment

© Oscar Nierstrasz ST — Introduction 1.4 Roadmap > Course schedule, goals, resources > What is Smalltalk? > Origins of Smalltalk > Smalltalk key concepts > The Smalltalk environment

© Oscar Nierstrasz ST — Introduction 1.5 Course Schedule WeekDateLecture 1March 31, 2006Introduction 2April 7, 2006Basics I April 14, 2006Good Friday 3April 21, 2006Standard Classes 4April 28, 2006Smalltalk Idioms 5May 5, 2006Seaside 6May 12, 2006Debugging 7May 19, 2006Understanding Classes and Metaclasses 8May 26, 2006Best Practice Patterns 9June 2, 2006Refactoring 10June 9, 2006Reflection 11June 16, 2006ByteCode 12June 23, 2006Traits & Classboxes June 30, 2006Exam

© Oscar Nierstrasz ST — Introduction 1.6 Goals of this Course  Advanced design concepts  Meta-reflective architecture  Rapid prototyping  Interactive development

© Oscar Nierstrasz ST — Introduction 1.7 A Word of Advice You do not have to know everything!!! Try not to care — Beginning Smalltalk programmers often have trouble because they think they need to understand all the details of how a thing works before they can use it. This means it takes quite a while before they can master Transcript show: ‘Hello World’. One of the great leaps in OO is to be able to answer the question “How does this work?” with “I don’t care”. — Alan Knight. Smalltalk Guru

© Oscar Nierstrasz ST — Introduction 1.8 Resources  History —en.wikipedia.org/wiki/Smalltalken.wikipedia.org/wiki/Smalltalk —  Free books — —  Squeak —  VisualWorks —  European Smalltalk Users Group —

© Oscar Nierstrasz ST — Introduction 1.9 Recommended Books  Alec Sharp, Smalltalk by Example, McGraw-Hill,  Kent Beck, Smalltalk Best Practice Patterns, Prentice Hall,  Sherman Alpert et al., The Smalltalk Design Pattern Companion, Addison-Wesley, 1998

© Oscar Nierstrasz ST — Introduction 1.10 Roadmap > Course schedule, goals, resources > What is Smalltalk? > Origins of Smalltalk > Smalltalk key concepts > The Smalltalk environment

© Oscar Nierstrasz ST — Introduction 1.11 Why Smalltalk?  Pure object-oriented language and environment —“Everything is an object”  Origin of many innovations in OO development —RDD, IDE, MVC, XUnit …  Improves on many of its successors —Fully interactive

© Oscar Nierstrasz ST — Introduction 1.12 What is Smalltalk?  Pure OO language —Single inheritance —Dynamically typed  Language and environment —Guiding principle: “Everything is an Object” —Class browser, debugger, inspector, … —Mature class library and tools  Virtual machine —Objects exist in a persistent image [+ changes] —Incremental compilation

© Oscar Nierstrasz ST — Introduction 1.13 Smalltalk vs. C++ vs. Java SmalltalkC++Java Object modelPureHybrid Garbage collectionAutomaticManualAutomatic InheritanceSingleMultipleSingle TypesDynamicStatic ReflectionFully reflectiveIntrospection ConcurrencySemaphores, Monitors Some librariesMonitors ModulesCategories, namespaces NamespacesPackages

© Oscar Nierstrasz ST — Introduction 1.14 Smalltalk: a State of Mind  Small and uniform language: —Syntax fits on one sheet of paper  Large library of reusable classes: —Basic Data Structures, GUI classes, Database Access, Internet, Graphics  Advanced development tools: —Browsers, GUI Builders, Inspectors, Change Management Tools, Crash Recovery Tools, Project Management Tools  Interactive virtual machine technology —Truly platform-independent  Team Working Environment —Releasing, versioning, deploying

© Oscar Nierstrasz ST — Introduction 1.15 Smalltalk in industry  Worldwide: — — — —  In Bern: —Netstyle.ch —DVBern AG —Mobiliar (in-house) —Pulinco

© Oscar Nierstrasz ST — Introduction 1.16 Roadmap > Course schedule, goals, resources > What is Smalltalk? > Origins of Smalltalk > Smalltalk key concepts > The Smalltalk environment

© Oscar Nierstrasz ST — Introduction 1.17 Origins of Smalltalk  Project at Xerox PARC in 1970s —Language and environment for new generation of graphical workstations (target: “Dynabook”)  In Smalltalk-72, every object was an independent entity —Language was designed for children (!) —Evolved towards a meta-reflective architecture  Smalltalk-80 is the standard

© Oscar Nierstrasz ST — Introduction 1.18 Smalltalk — The Inspiration  Flex (Alan Kay, 1969)  Lisp (Interpreter, Blocks, Garbage Collection)  Turtle graphics (The Logo Project, Programming for Children)  Direct Manipulation Interfaces (Sketchpad, Alan Sutherland, 1960)  NLS, (Doug Engelbart, 1968), “the augmentation of human intellect”  Simula (Classes and Message Sending)  Xerox PARC (Palo Alto Research Center)  DynaBook: a Laptop Computer for Children —

© Oscar Nierstrasz ST — Introduction 1.19 Dynabook Mockup

© Oscar Nierstrasz ST — Introduction 1.20 Smalltalk on Alto III Alto: a Machine to Run Smalltalk

© Oscar Nierstrasz ST — Introduction 1.21 Precursor, Innovator & Visionary  First to be based on Graphics —Multi-Windowing Environment (Overlapping Windows) —Integrated Development Environment: Debugger, Compiler, Text Editor, Browser  With a pointing device  yes, a Mouse  Ideas were taken over —Apple Lisa, Mac —Microsoft Windows 1.0  Platform-independent Virtual Machine  Garbage Collector  Just-in-time Compilation  Everything was there, the complete Source Code

© Oscar Nierstrasz ST — Introduction 1.22 History

© Oscar Nierstrasz ST — Introduction 1.23 The History (Internal)  1972 — First Interpreter —More Agents than Objects (every object could specify its own syntax!)  1976 — Redesign —A Hierarchy of classes with a Unique Root, Fixed Syntax, Compact Byte Code, Contexts, Processes, Semaphores, Browsers, GUI Library. —Projects: ThingLab, Visual Programming Environment, Programming by Rehearsal.  1978 — NoteTaker Project —Experimentation with 8086 Microprocessor with only 256 KB RAM.

© Oscar Nierstrasz ST — Introduction 1.24

© Oscar Nierstrasz ST — Introduction 1.25 The History (External)  1980 — Smalltalk-80 —ASCII, cleaning primitives for portability, Metaclasses, Blocks as first- class Objects, MVC. —Projects: Gallery Editor (mixing text, painting and animations) + Alternate Reality Kit (physics simulation)  1981 — Books + 4 external virtual machines —Dec, Apple, HP and Tektronix —GC by generation scavenging  1988 — Creation of Parc Place Systems  1992 — ANSI Draft  1995 — New Smalltalk implementations —MT, Dolphin, Squeak, Smalltalk/X, GNU Smalltalk  2000 — Fscript, GNU Smalltalk, SmallScript  2002 — Smalltalk as OS: 128k ram

© Oscar Nierstrasz ST — Introduction 1.26 What is Squeak?  Modern, open-source, highly portable, fast, full-featured Smalltalk implementation —Based on original Smalltalk-80 code —

© Oscar Nierstrasz ST — Introduction 1.27 Roadmap > Course schedule, goals, resources > What is Smalltalk? > Origins of Smalltalk > Smalltalk key concepts > The Smalltalk environment

© Oscar Nierstrasz ST — Introduction 1.28 Smalltalk — Key Concepts  Everything is an object —numbers, files, editors, compilers, points, tools, boolean …  Objects communicate only by message passing.  Each object is an instance of one class —which is also an object —A class defines the structure and the behavior of its instances.  Objects have private state —Encapsulation boundary is the object  Dynamic binding —Variables are dynamically typed and bound

© Oscar Nierstrasz ST — Introduction 1.29 Objects and Classes  Every object is an instance of a class —A class specifies the structure and the behaviour of all its instances —Instances of a class share the same behavior and have a specific state —Classes are objects that create other instances —Metaclasses are classes that create classes as instances —Metaclasses describe class behaviour and state (subclasses, method dictionary, instance variables...)

© Oscar Nierstrasz ST — Introduction 1.30 Messages and Methods  Message — which action to perform  Method — how to carry out the action aWorkstation accept: aPacket aMonster eat: aCookie aWorkstation accept: aPacket aMonster eat: aCookie accept: aPacket (aPacket isAddressedTo: self) ifTrue:[ Transcript show: 'A packet is accepted by the Workstation ', self name asString ] ifFalse: [super accept: aPacket] accept: aPacket (aPacket isAddressedTo: self) ifTrue:[ Transcript show: 'A packet is accepted by the Workstation ', self name asString ] ifFalse: [super accept: aPacket]

© Oscar Nierstrasz ST — Introduction 1.31 Smalltalk Run-Time Architecture  Virtual Machine + Image + Changes and Sources  Image = bytecodes  Sources and changes = code (text)

© Oscar Nierstrasz ST — Introduction 1.32 Smalltalk Run-Time Architecture  Byte-code is translated to native code by a just-in-time compiler —Some Smalltalks, but not Squeak  Source and changes are not needed to interpret the byte-code. —Just needed for development —Normally removed for deployment  An application can be delivered as byte-code files that will be executed with a VM. —The development image is stripped to remove the unnecessary development components.

© Oscar Nierstrasz ST — Introduction 1.33 Roadmap > Course schedule, goals, resources > What is Smalltalk? > Origins of Smalltalk > Smalltalk key concepts > The Smalltalk environment

© Oscar Nierstrasz ST — Introduction 1.34 Mouse Semantics Select Operate Window

© Oscar Nierstrasz ST — Introduction 1.35 World Menu and Open Menu

© Oscar Nierstrasz ST — Introduction 1.36 “Hello World”

© Oscar Nierstrasz ST — Introduction 1.37 The Smalltalk Browser

© Oscar Nierstrasz ST — Introduction 1.38 The Debugger

© Oscar Nierstrasz ST — Introduction 1.39 The Inspector

© Oscar Nierstrasz ST — Introduction 1.40 Other Tools  File List —Browse, import, open files  Method Finder, Message Name tool —Find methods by name, behaviour  Change Sorter —Name, organize all source code changes  SUnit —Manage & run unit tests

© Oscar Nierstrasz ST — Introduction 1.41 FileList

© Oscar Nierstrasz ST — Introduction 1.42 Message Name Finder

© Oscar Nierstrasz ST — Introduction 1.43 Method Finder

© Oscar Nierstrasz ST — Introduction 1.44 Methods in ChangeSets & Versions

© Oscar Nierstrasz ST — Introduction 1.45 Preferences

© Oscar Nierstrasz ST — Introduction 1.46 SUnit

© Oscar Nierstrasz ST — Introduction 1.47 Challenges of this Course  Mastering Smalltalk syntax —Simple, but not Java-like  Squeak Programming Environment —Requires more effort to learn at first, but worth the effort  Squeak Class Library —Need time to learn what is there  Object-oriented thinking —This is the hardest part!  Smalltalk culture —Best Practice Patterns (cf. book by Kent Beck)

© Oscar Nierstrasz ST — Introduction 1.48 What you should know!  How does Smalltalk differ from Java or C++?  Where are Smalltalk programs stored?  Where are objects stored?  What was the Dynabook?  Is a class an object?  What is dynamic binding?  What is the difference between a message and a method?

© Oscar Nierstrasz ST — Introduction 1.49 Can you answer these questions?  What ideas did Smalltalk take from Simula? From Lisp?  Is there anything in Smalltalk which is not an object?  What exactly is stored in the changes file?  If objects have private state, then how can an Inspector get at that state?  How do you create a new class?  What is the root of the class hierarchy?  If a class is an object, then what is its class?The class of its class? …  If you don’t know, how would you find out?

© Oscar Nierstrasz ST — Introduction 1.50 License > Attribution-ShareAlike 2.5 You are free: to copy, distribute, display, and perform the work to make derivative works to make commercial use of the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. Attribution-ShareAlike 2.5 You are free: to copy, distribute, display, and perform the work to make derivative works to make commercial use of the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above.