Introduction to Object-oriented Programming in Smalltalk

Size: px
Start display at page:

Download "Introduction to Object-oriented Programming in Smalltalk"

Transcription

1 Introduction to Object-oriented Programming in Smalltalk 1

2 Objects are responsible for their own actions! In procedural programming, I write code that reaches into the internals of some data structure and twiddles with the bits string process reads/ writes process reads/ writes process reads/ writes 2

3 In O-O programming, I politely request some other object to perform some work on my behalf, and it politely answers me String copy print concat 3

4 In O-O programming, I politely request some other object to perform some work on my behalf, and it politely answers me String Encapsulation boundary copy print concat 3

5 In O-O programming, I politely request some other object to perform some work on my behalf, and it politely answers me String Encapsulation boundary copy print concat copy 3

6 In O-O programming, I politely request some other object to perform some work on my behalf, and it politely answers me String Encapsulation boundary copy print concat 3

7 In O-O programming, I politely request some other object to perform some work on my behalf, and it politely answers me String Encapsulation boundary copy print concat anewstring 3

8 In O-O programming, I politely request some other object to perform some work on my behalf, and it politely answers me String Encapsulation boundary copy print concat 3

9 Computation as Simulation This collection of autonomous objects is like the world of discreet event simulation Anthropomorphize! It s OK to think about this object talking to that object... In fact, it s recommended 4

10 Programming Philosophy Object-Oriented programming is programming by simulation. The algorithm is less important than the structure of the solution. When requirements change: If the structure represented the structure of some reality, then the new requirements will be consistent in that reality. Object-oriented design is the search for this structure: uncover the structure rather than construct in isolation. 5

11 Shopping vs. Building Constructing an Object-oriented application is a process of shopping for the components that one needs occasionally we add a new item to the shelf. usually we can find a component that almost fits. The openness of an OO language allows the programmer to change the component that almost fits into one that is a good fit. works only if we have a rich set of components on the shelf, and if they are open to change. 6

12 Is this the only view of OO Programming? No! People disagree on the meaning and role of: 1. Encapsulation 2. Types 3. Inheritance 4. Polymorphism 5. Sets and classes 7

13 Smalltalk Squeak is an open-source version of Smalltalk. Smalltalk is still the best example of a Pure O-O language The Squeak workspace is a place in which you can create and interact with objects. Large and active community of contributors Runs bit identical on just about any platform, including many PDAs 8

14 9

15 "#$!%&'$()!*+,-. Yes, you are... LIVE in MORPHIC x S q u e a k Text morphs can be chained together, causing their contents to flow between containers as m ha t the contents or the containers orp t of change. If a TextMorph is h. pe embedded in another If th a morph, then you canask e to have itfill thesh te xt is embedded in a curve, then you can ask to have the text follow that curve, as illustrated in this image. You can also ask to have the text avoid occlusions, in which case it will do its XII XI I best to avoid Text sibling submorphs in this X II that are in front of it. Kerning rectangle (cmd sh + or -) can flows help with the IX III awkward spacing around that results from narrow margins. me VIII IV Other morphs can also be embedded in text as glyphs. VII V VI Embedding placement is based on the top left corner of the morph s bounding box. T o o l s S u p p l i e s %&'$()!89 /0(1$ #+2:!;% 61++./$27 2+',3$2!4!3#(51$2 10

16 "#$%%&$%'!"()&$* 6 7#!89.5*:!$#1!24*88)8;!0*2+*<)8;!etc. = >4*88!21)*5?#.!*.@!3)5A#@!2*5)<#1?B*5?#.!*1)!@#.)! imperatively!(8?.<!5a)!@)c)4#03).5!5##48 6 DA)!3)5A#@!89.5*:!?8!8?304);!E(5!@?$$)1).5 +,!$"&-.)/! F-.8G)1!GA)5A)1!5A)!1)2)?C)1!8#158!*$5)1!#1!)'(*4!5#! K!I8)4$!2#30*1),!8)4$!G?5A,!*&51?.<!2#44*5)@,!-82??/1@)1J!LM!N 11

17 786*2+5!09:*36; "#$%%&$%'!(!)*+!,$-./$.+ #< =>*!)/8()*!$9:*36!#< D+!;628/BD E2*()*;6 K2 ;+4*!+;!+9$C* +!;628/B 6>*!;F49$5!request. G6!8;!)/8()*H!6I$!;F49$5;! I86>!6>*!;+4*!/+4*!J*/$6*!6>*!;+4*!$9:*36 6>*!;8/B5*!3>+2+36*2!r 3$/6+8/8/B!+/!8/6*B*2N!+!!$+6N!+/J!+!;628/B 12

18 !"#$%#&'("))*&") 7/+28#9*::+;*#</$#+2;)4*/6:= #E#12?/6'62?/; 2*3*?J*2 <6+2;*6#$%#4*::+;*= :*5*36$2 > C *D+415*:-## "#%+36$2?+5 # E#/*;+6*A# F3#+:G/6*;*2 C /$6*-#/$#3$5$/#+6#6H*#*/A#$%#6H*#:84I$5 13

19 67.*18#9)::*;)#<$.)#*1;(3).5=> D##H#G 1)2)7K)1 :)4)25$1 *1;(3).5? B#C#D i G#H#I!B#JJ#I!B#J#I 3)::*;)#= 5##:).5#5$#$EF)25#B 3)::*;)#+ 3##:).5#5$#$EF)25#G 3)::*;)#// 3##:).5#5$#7.5);)1#$EF)25#!B# <1):(45#7:#D> 3)::*;)#/ 3##:).5#5$#7.5);)1#$EF)25#!B# <1):(45#7:#######> i 14

20 67.*18#9)::*;)#<$.)#*1;(3).5=> D##H#G 1)2)7K)1 :)4)25$1 *1;(3).5? B#C#D i G#H#I!B#JJ#I!B#J#I 3)::*;)#= 5##:).5#5$#$EF)25#B 3)::*;)#+ 3##:).5#5$#$EF)25#G 3)::*;)#// 3##:).5#5$#7.5);)1#$EF)25#!B# <1):(45#7:#D> 3)::*;)#/ 3##:).5#5$#7.5);)1#$EF)25#!B# <1):(45#7:#######> i Not exactly; i is not an object. It's a variable that's bound to an object 14

21 7*89$2:#;*<<+=*<# > BCD#"#E#F#!!G#+6-#H =+4*#4$I*%2$4-#1J/.#6$-#1J/K#)<J/=-#1J/L "#M*69**/-#N#+/:-#F > OP*#3$5$/#Q!R#J/:J3+6*<#6$#6P*#1+2<*2#6P+6#+/# +2=)4*/6#%$55$9<#6P*#,*89$2:S 15

22 !"#$"%&'%()*+,*-.&/ 7 89*#2*3*:;*2#<$2#+/#+2=)4*/6>#3+/#?*# +/$69*2#:/;$3+6:$/#<4*@@+=*#*A12*@@:$/> 7 B;+5)+6:$/#$2C*2#:@ D 1+2*/69*@:E*C#:/;$3+6:$/@ D )/+2F#:/;$3+6:$/G#*;+5)+6*C#left to right D?:/+2F#:/;$3+6:$/@G#*;+5)+6*C#left to right D,*FH$2C#:/;$3+6:$/@ 7 I$#J12:$2:6:*@K#%$2#1+26:3)5+2#$1*2+6$2@ D!#C$*@#/$6#?:/C#4$2*#6:=965F#69+/#L 16

23 !"#$"%&%'(&##")&#'*#+,-"$-.$'#/)"01 +/.22+7#+6-#!#1)6-#89 # +/.22+7#+6-#:#1)6-#!!9 # +/.22+7#+6-#;#1)6-#!;9 < =>?@#3+/#A*#+AA2*B?+6*C#+@ +/.22+7#+6-#!#1)6-#8J#+6-#:#1)6-#!!J#+6-#;#1)6-#!;# 2*3*?B*2#%$2#+55# ;#4*@@+E*@ K2*3*?B*25*@@#4*@@+E*@L < D*@)56#?@#6>+6#$%#6>*#5+@6#4*@@+E*#@*/C =2+/@32?16#@>$F-#GH*55$#I$25CGJ#32 17

24 !"#$"%&'( 7/86+/3*#9+2:+;5*8 < 4+,*#)1#:68#2*12*8*/6+6:$/D < E*35+2*E#:/#6>*#35+88 instancevariablenames: 'name1 name2' =*41$2+2:*8 < F+4*8#5$3+5#6$#+#4*6>$E#;$EG#$2#;5$3, H#student professoratogi#7 18

25 7#!#8#9#: :=!""#$%&'%( ; 4+,*#x# ## /+4*#6<*#$=>*36#2*?)56@/A#%2$4#6<*#*B+5)+6@$/# $%#6<*#*712*??@$/#3 + 5 C#-D#.22+C#/*E-#!FFFFFF ; 4+,*#y#/+4*#+#/*E#!GH#+22+C I J+2@+=5*?#/+4*#$=>*36? ; K<*C#L$#/$6#12$B@L*#?6$2+A*#%$2#$=>*36? I.??@A/@/A#6$#+#B+2@+=5*#4+,*?#@6#/+4*#+# L@%%*2*/6#$=>*36 ; /$#$=>*36#@?#32*+6*L#$2#3$1@*L#=C#+??@A/4*/6 19

26 :";4*<<)<!"#$%&%'()*$" = 2#33*.9@$"8."5A)";4*<<@2*5):#1?"0*.)"#$"*"B1#C<)1 = >?"<)4)258.:"*"3#10A"*.9"2A##<8.:"B1#C<)"3#10A" 24*<<"$1#3"5A)"9)B(:"3).( 20

27 7 89/:9/;#4*6<$:= %9/:*2 > ' ,#A2$D=*E*6<$:=F<$=*G+4*=H$/6+9/-# I=32**/I > ' ,#A2$D=*E*6<$:=F96<'629/;-#I)=*%)5IJ#$2# > <9;<59;<6#+#=*5*36$2J#3<$$=*#9415*4*/6$2=#$%#K# Lcommand-mM#$2#=*/:*2=#$%#KLcommand-nM 21

28 !"#$"#%&'#()*+( &$3)#6.7*4(*84)#1)9$(12)9, : *#>6+6#69#*#>)8965)#><)1)#*.A$.)#69#%1))#5$#2$.5168(5)# <550,DD36..$>E22EC*5)2<E)B(D9'()*+ F 9.*09<$5#*5#<550,DD9> $1E9'()*+90*2)E2$3D : G$2(3).5*56$.H#5(5$16*49H#9>6+69H#$5<)1#965)9H#8$$+9# *.B#0*0)19H#B$>.4$*B9H#*.B#6.%$13*56$.#$.#I 22

29 7 89*#'()*+,#4+:5:/;#5:<6 = +#%2:*/>5?#15+3*#@9*2*#A/*@B:*<C#+2*#4+>*#@*53$4* = <()*+,D2*()*<6E3<F):)3F*>) =.239:G*#$%#HIJKL*<M#HNOPL+/3*4*/6<M#HQ00RJNL< 9661-SS<@:,:F;<);F$2;-TUTUS'VIJKN' = '*+239+B5*#+239:G*#$%#@9$5*#5:< SS;2$)1<F?+9$$F3$4S;2$)1S<()*+, 23

30 Creating Objects in Smalltalk Object are created by sending a message to some other (exisiting!) object called a factory Usually, the factory object is a class, e.g. OrderedCollection new. Array with: 'one' with: 'two' with: 'three'. s := Bag new. The object will be deallocated automatically when it's no longer needed (garbage collected) 24

31 Blocks Blocks are Smalltalk objects that represent Smalltalk code [ ] They can have arguments: [ :x 1 + x ] compare with x. 1 + x Blocks understand messages in the value family: value value: value: value: value: value: value: The Block is not evaluated until it receives a value message 25

32 Examples of Blocks If-then-else is not a built-in control structure: it s a message aboolean iftrue: trueblock iffalse: falseblock discountrate := (transactionvalue > 100) iffalse: [0.05] iftrue: [0.10] You can build your own control structures: ( keyevent controlkeypressed ) and: [keyevent shiftkeypressed] 26

33 Returning an Answer! returns an answer from a method if there is no!, the method returns self! is very useful to return from a block color color ifnil: [!!Color black].! color! in a block returns from the method in which the block is defined - not the method that evaluates the block! 27

34 Arrays Arrays in Smalltalk are Objects They are special in 2 ways 1. there is language syntax to create them #(1 3.4 #symbol) an array literal { /5 asfloat. ('sym','bol') assymbol} a dynamically constructed array Array with: 4-3 with: 17.0/5 with: #symbol the same 2. there are ByteArrays, FloatArrays as well as Arrays 28

35 Characters & Strings Characters are also objects $H is the literal for the character H $H asciivalue is 72 $H digitvalue is 17, $3 digitvalue is 3 collect: creates a new array by applying a function to all elements of the receiver ' ABCDEF' asarray collect: [ :each each digitvalue] evaluates to #( ) 29

36 Other enumeration methods anarray do: ablock applies ablock to each element of anarray, and answers anarray anarray withindexcollect: a2argumentblock answers the new array containing the results of applying a2argumentblock to each element of anarray, together with its index. anarray withindexdo: a2argumentblock 30

37 Examples #(#one #two #three #four) withindexcollect: [ :each :i each,' = ', i asstring] evaluates to #('one = 1' 'two = 2' 'three = 3' 'four = 4') #(#one #two #three #four) withindexdo: [ :each :i Transcript nextputall: each,' = '; show: i; cr] evaluates to #(#one #two #three #four), i.e., the receiver 31

38 Indexing Arrays {#eins. #zwei. #drei} at: 1 {#eins. #zwei. #drei} first {#eins. #zwei. #drei} third {#eins. #zwei. #drei} at: 2 put: #deux modifies the receiver, and answers #deux 32

39 Assignment 1: Whole objects Parse numerals into numbers without using explicit loops or recursion Use the algorithm shown 33

The Smalltalk Environment, SUnit, and Inheritance

The Smalltalk Environment, SUnit, and Inheritance Creating Objects in Smalltalk The Smalltalk Environment, SUnit, and Inheritance Object are created by sending a message to some other (exisiting!) object called a factory! Usually, the factory object is

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming CS420/520 Winter 2012 Prof Andrew P. Black 1 Administrivia Instructor: Andrew Black, 503 725 2411 (office) 503 803 1669 (cell). email: black@cs.pdx.edu, put [CS520] in subject

More information

Smalltalk FOOP. Smalltalk

Smalltalk FOOP. Smalltalk 2015-03-20 Smalltalk Smalltalk 2015-03-20 Smalltalk 1 First Examples hello Transcript show: Hi World hello5 1 to: 5 do: [:i (Transcript show: Hi World ) cr] hello: times 1 to: times do: [:i (Transcript

More information

Smalltalk. Topics. History of Smalltalk. OOP and GUI. Steve Jobs, PARC, Dec Smalltalk 1. The best way to predict the future is to invent it.

Smalltalk. Topics. History of Smalltalk. OOP and GUI. Steve Jobs, PARC, Dec Smalltalk 1. The best way to predict the future is to invent it. Smalltalk The best way to predict the future is to invent it. Alan Kay, 1971 Topics History and significance of Smalltalk Object-oriented programming The Smalltalk language Smalltalk today Additional Examples

More information

Roll No. :... Invigilator's Signature :. CS/B.Tech(CSE)/SEM-7/CS-701/ LANGUAGE PROCESSOR. Time Allotted : 3 Hours Full Marks : 70

Roll No. :... Invigilator's Signature :. CS/B.Tech(CSE)/SEM-7/CS-701/ LANGUAGE PROCESSOR. Time Allotted : 3 Hours Full Marks : 70 Name : Roll No. :... Invigilator's Signature :. CS/B.Tech(CSE)/SEM-7/CS-701/2011-12 2011 LANGUAGE PROCESSOR Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates

More information

GUI-Based Software Development. The Model/View/Controller Pattern

GUI-Based Software Development. The Model/View/Controller Pattern GUI-Based Software Development The Model/View/Controller Pattern Origins of Personal Computing The most important part of a computer system is the individual human user. - Alan Kay Origins of Personal

More information

Squeak Object Model. Technion - Israel Institute of Technology. Updated: Spring Object-Oriented Programming 1

Squeak Object Model. Technion - Israel Institute of Technology. Updated: Spring Object-Oriented Programming 1 Squeak Object Model Technion - Israel Institute of Technology Updated: Spring 2015 236703 - Object-Oriented Programming 1 Agenda Class exploring Class object, default / common behaviors Objects equality

More information

2. Classes & Inheritance. Classes. Classes. Éric Tanter Objects and Design in Smalltalk. How do you create objects?

2. Classes & Inheritance. Classes. Classes. Éric Tanter Objects and Design in Smalltalk. How do you create objects? Objects and Design in Smalltalk 2. Classes & Inheritance Éric Tanter etanter@dcc.uchile.cl 1 Classes How do you create objects? Ex-nihilo in prototype-based languages With a class in class-based languages

More information

ST Introduction. Birds-eye view

ST Introduction. Birds-eye view 3. Standard Classes ST Introduction Birds-eye view Reify everything by reifying its entire implementation model, Smalltalk succeeds in being open, and extensible. New features can be added without changing

More information

Lecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction

Lecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction Lecture 13: Object orientation Object oriented programming Introduction, types of OO languages Key concepts: Encapsulation, Inheritance, Dynamic binding & polymorphism Other design issues Smalltalk OO

More information

Dynamic Object-Oriented Programming with Smalltalk 1. Introduction

Dynamic Object-Oriented Programming with Smalltalk 1. Introduction Dynamic Object-Oriented Programming with Smalltalk 1. Introduction Prof. O. Nierstrasz Autumn Semester 2009 LECTURE TITLE What is surprising about Smalltalk > Everything is an object > Everything happens

More information

A Lazy List Implementation in Squeak

A Lazy List Implementation in Squeak A Lazy List Implementation in Squeak Takashi Yamamiya This material is based upon work supported in part by the National Science Foundation under Grant No. 0639876. Any opinions, findings, and conclusions

More information

CS410/510 Advanced Programming Lecture 5: Collections in Smalltalk

CS410/510 Advanced Programming Lecture 5: Collections in Smalltalk CS410/510 Advanced Programming Lecture 5: Collections in Smalltalk 1 List Operations Last class you heard about list operations in Haskell For each there is a corresponding operation in Smalltalk; most

More information

An Introduction to Squeak

An Introduction to Squeak An Introduction to Squeak Hello! Squeak is a language largely derived from Smalltalk. Now imagine what a coincidence it is to be do an assignment that uses the Smalltalk language after having just finished

More information

Name :. Roll No. :... Invigilator s Signature : INTRODUCTION TO PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70

Name :. Roll No. :... Invigilator s Signature : INTRODUCTION TO PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 Name :. Roll No. :..... Invigilator s Signature :.. 2011 INTRODUCTION TO PROGRAMMING Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates are required to give

More information

3. A Simple Counter. Creating your own class

3. A Simple Counter. Creating your own class In this exercise, you will write your first complete program. The program is very simple, the goal of the exercise is to get used to the Pharo environment and the basics of the language. From the Pharo

More information

SRE VIDYASAAGAR HIGHER SECONDARY SCHOOL. TWO MARKS

SRE VIDYASAAGAR HIGHER SECONDARY SCHOOL. TWO MARKS SRE VIDYASAAGAR HIGHER SECONDARY SCHOOL. COMPUTER SCIENCE - STAR OFFICE TWO MARKS LESSON I 1. What is meant by text editing? 2. How to work with multiple documents in StarOffice Writer? 3. What is the

More information

CS 403/503 Exam 4 Spring 2015 Solution

CS 403/503 Exam 4 Spring 2015 Solution CS 403/503 Exam 4 Spring 2015 Solution Each problem initially scored out of 10 points possible. CS 403 Best 5 answers doubled. (5*20 + 2*10 = 120 possible) CS 503 Best 4 answers doubled. (4*20 + 3*10 =

More information

Why using Smalltalk for Teaching Object- Oriented Design

Why using Smalltalk for Teaching Object- Oriented Design Why using Smalltalk for Teaching Object- Oriented Design N. Bouraqadi - Ecole des Mines de Douai S. Ducasse - University of Berne S. Stinckwich - University of Caen R. Wuyts - Université Libres de Bruxelles

More information

Adriaan van Os ESUG Code Optimization

Adriaan van Os ESUG Code Optimization Introduction Working at Soops since 1995 Customers include Research (Economical) Exchanges (Power, Gas) Insurance Projects in VisualWorks GemStone VisualAge 2 Demanding projects Data-intensive Rule based

More information

omit A ] omit E, + (superlinear) A 1:17 Vs. 17 found only in mss DG 1:25 ] omit BDEFG ABDEFG ] omit D

omit A ] omit E, + (superlinear) A 1:17 Vs. 17 found only in mss DG 1:25 ] omit BDEFG ABDEFG ] omit D 1:1 ] omit C 1:2 ] DEFG ] BEF 1:3 ] BDEFG 2 ] EF 1:4 ] ABDG ] ABDG ] ABDG ] omit A 1:5 ] omit A ] omit ABDEFG ] ABCDEFG 1:6 1,2 ] + A ] ABCDG ] F 1:8 1,2 ] B 2 ] EF ] EF 1:9 1 ] + ADG 1:10 1 ] omit EF

More information

Basic Objects, Conditionals and Loops

Basic Objects, Conditionals and Loops Basic Objects, Conditionals and Loops Booleans Basic Loops Overview of the Collection hierarchy more than 80 classes: (Bag, Array, OrderedCollection, SortedCollection, Set, Dictionary...) Loops and Iteration

More information

Eliminating Procedural Code

Eliminating Procedural Code Chapter 28 Eliminating Procedural Code In procedural programming, we write a lot of code that gets information then makes a decision based on the information. In C, we see a lot of if/else if/else blocks,

More information

List of Examples List of Figures List of Tables. Acknowledgments 1. VERIFICATION GUIDELINES 1

List of Examples List of Figures List of Tables. Acknowledgments 1. VERIFICATION GUIDELINES 1 Contents List of Examples List of Figures List of Tables Preface Acknowledgments xiii xxvii xxix xxxi xxxvii 1. VERIFICATION GUIDELINES 1 1.1 The Verification Process 2 1.2 The Verification Methodology

More information

An Overview of Essential Collections

An Overview of Essential Collections An Overview of Essential Collections Damien Cassou, Stéphane Ducasse and Luc Fabresse W3S07 http://www.pharo.org W3S07 2 / 31 What You Will Learn Some basic collections Essential API to program collections

More information

fohgp siejt karbl mcqdn

fohgp siejt karbl mcqdn CS 403/503 Exam 4 Spring 2017 Solution CS 403 Score is based on your best 8 out of 10 problems. CS 503 Score is based on your best 9 out of 10 problems. Extra credit will be awarded if you can solve additional

More information

QUESTION BANK. Formal Languages and Automata Theory(10CS56)

QUESTION BANK. Formal Languages and Automata Theory(10CS56) QUESTION BANK Formal Languages and Automata Theory(10CS56) Chapter 1 1. Define the following terms & explain with examples. i) Grammar ii) Language 2. Mention the difference between DFA, NFA and εnfa.

More information

Smalltalk Best Practice Patterns. Part I

Smalltalk Best Practice Patterns. Part I Smalltalk Best Practice Patterns Part I 1 Based on the Book by Kent Beck 2 Based on the Book by Kent Beck Very little here is Smalltalk-specific 2 Why Patterns? 3 Why Patterns? There are only so many ways

More information

About the Authors... iii Introduction... xvii. Chapter 1: System Software... 1

About the Authors... iii Introduction... xvii. Chapter 1: System Software... 1 Table of Contents About the Authors... iii Introduction... xvii Chapter 1: System Software... 1 1.1 Concept of System Software... 2 Types of Software Programs... 2 Software Programs and the Computing Machine...

More information

esug.org (European Smalltalker Users Group) Javascript

esug.org (European Smalltalker Users Group) Javascript Serge Amber Pharo ( ) esug.org (European Smalltalker Users Group) Amber Web Smalltalk Web Smtalltalk Javascript Javascript Web Transcript Workspace SUnit (JUnit Smalltalk ) System Browser halt JQuery UI

More information

An Overview of Essential Collections

An Overview of Essential Collections Learning Object-Oriented Programming and Design with TDD An Overview of Essential Collections Stéphane Ducasse http://stephane.ducasse.free.fr http://www.pharo.org W2S08 W2S08 2 / 32 What You Will Learn

More information

6. Exemplary Solutions: Seaside: Components

6. Exemplary Solutions: Seaside: Components 6. Exemplary Solutions: Seaside: Components Exercise 6.1 STBuyTicketTask class >> canberoot ˆtrue self inform: Hello World Exercise 6.2 WAComponent subclass: #STPlayChooser instancevariablenames: plays

More information

:3002 Wilf 2017

:3002 Wilf 2017 95.3002 Name one thing that finds bugs early Making sure that the run or execute method for all tables that search have an error message at the end if the search fails to find anything. Readahead and ScannerReadahead

More information

Java Basics. Object Orientated Programming in Java. Benjamin Kenwright

Java Basics. Object Orientated Programming in Java. Benjamin Kenwright Java Basics Object Orientated Programming in Java Benjamin Kenwright Outline Essential Java Concepts Syntax, Grammar, Formatting, Introduce Object-Orientated Concepts Encapsulation, Abstract Data, OO Languages,

More information

UNIT 19 Similarity Lesson Plan 1

UNIT 19 Similarity Lesson Plan 1 UNIT 19 Similarity Lesson Plan 1 Enlargements 1A 1B Introducing 'enlargement' PB 19.1, Worked Example 1 (changed) T: I am planning to build a cupboard in a corner of my kitchen. I've drawn a plan of the

More information

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language Categories of languages that support OOP: 1. OOP support is added to an existing language - C++ (also supports procedural and dataoriented programming) - Ada 95 (also supports procedural and dataoriented

More information

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring Java Outline Java Models for variables Types and type checking, type safety Interpretation vs. compilation Reasoning about code CSCI 2600 Spring 2017 2 Java Java is a successor to a number of languages,

More information

Object Oriented Paradigm Languages

Object Oriented Paradigm Languages Object Oriented Paradigm Languages The central design goal is to build inherent abstraction into the system, moving all the abstract implementation details from the user level (ad-hoc) to the system level

More information

Microsoft Visual C# Step by Step. John Sharp

Microsoft Visual C# Step by Step. John Sharp Microsoft Visual C# 2013 Step by Step John Sharp Introduction xix PART I INTRODUCING MICROSOFT VISUAL C# AND MICROSOFT VISUAL STUDIO 2013 Chapter 1 Welcome to C# 3 Beginning programming with the Visual

More information

"Charting the Course... MOC Programming in C# with Microsoft Visual Studio Course Summary

Charting the Course... MOC Programming in C# with Microsoft Visual Studio Course Summary Course Summary NOTE - The course delivery has been updated to Visual Studio 2013 and.net Framework 4.5! Description The course focuses on C# program structure, language syntax, and implementation details

More information

design patterns FOR B.tech (jntu - hyderabad & kakinada) (IV/I - CSE AND IV/II - IT) CONTENTS 1.1 INTRODUCTION TO DESIGN PATTERNS TTERNS... TTERN?...

design patterns FOR B.tech (jntu - hyderabad & kakinada) (IV/I - CSE AND IV/II - IT) CONTENTS 1.1 INTRODUCTION TO DESIGN PATTERNS TTERNS... TTERN?... Contents i design patterns FOR B.tech (jntu - hyderabad & kakinada) (IV/I - CSE AND IV/II - IT) CONTENTS UNIT - I [CH. H. - 1] ] [INTRODUCTION TO ]... 1.1-1.32 1.1 INTRODUCTION TO... 1.2 1.2 WHAT T IS

More information

CSCE 314 Programming Languages. Monadic Parsing

CSCE 314 Programming Languages. Monadic Parsing CSCE 314 Programming Languages Monadic Parsing Dr. Hyunyoung Lee 1 What is a Parser? A parser is a program that takes a string of characters (or a set of tokens) as input and determines its syntactic structure.

More information

CSCE 314 Programming Languages. Functional Parsers

CSCE 314 Programming Languages. Functional Parsers CSCE 314 Programming Languages Functional Parsers Dr. Hyunyoung Lee 1 What is a Parser? A parser is a program that takes a text (set of tokens) and determines its syntactic structure. String or [Token]

More information

Control Flow February 9, Lecture 7

Control Flow February 9, Lecture 7 Chapter 6 Control Flow February 9, Lecture 7 Expressions A simple object Literal constant Named variable Constant Or a function applied to arguments For built-in functions we use the term operator (like

More information

QUESTION BANK CHAPTER 1 : OVERVIEW OF SYSTEM SOFTWARE. CHAPTER 2: Overview of Language Processors. CHAPTER 3: Assemblers

QUESTION BANK CHAPTER 1 : OVERVIEW OF SYSTEM SOFTWARE. CHAPTER 2: Overview of Language Processors. CHAPTER 3: Assemblers QUESTION BANK CHAPTER 1 : OVERVIEW OF SYSTEM SOFTWARE 1) Explain Analysis-synthesis model/fron end backend model of compiler 2) Explain various phases of compiler and symbol table. Consider the statement

More information

This course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery.

This course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery. HTML5/CSS3/JavaScript Programming Course Summary Description This class is designed for students that have experience with basic HTML concepts that wish to learn about HTML Version 5, Cascading Style Sheets

More information

5/23/2015. Core Java Syllabus. VikRam ShaRma

5/23/2015. Core Java Syllabus. VikRam ShaRma 5/23/2015 Core Java Syllabus VikRam ShaRma Basic Concepts of Core Java 1 Introduction to Java 1.1 Need of java i.e. History 1.2 What is java? 1.3 Java Buzzwords 1.4 JDK JRE JVM JIT - Java Compiler 1.5

More information

CS 403/503 Exam 4 Spring 2017 Name

CS 403/503 Exam 4 Spring 2017 Name CS 403/503 Exam 4 Spring 2017 Name CS 403 Score is based on your best 8 out of 10 problems. CS 503 Score is based on your best 9 out of 10 problems. Extra credit will be awarded if you can solve additional

More information

CSCE 314 TAMU Fall CSCE 314: Programming Languages Dr. Flemming Andersen. Functional Parsers

CSCE 314 TAMU Fall CSCE 314: Programming Languages Dr. Flemming Andersen. Functional Parsers 1 CSCE 314: Programming Languages Dr. Flemming Andersen Functional Parsers What is a Parser? A parser is a program that takes a text (set of tokens) and determines its syntactic structure. String or [Token]

More information

AUBER (Models of Computation, Languages and Automata) EXERCISES

AUBER (Models of Computation, Languages and Automata) EXERCISES AUBER (Models of Computation, Languages and Automata) EXERCISES Xavier Vera, 2002 Languages and alphabets 1.1 Let be an alphabet, and λ the empty string over. (i) Is λ in? (ii) Is it true that λλλ=λ? Is

More information

Microsoft. Microsoft Visual C# Step by Step. John Sharp

Microsoft. Microsoft Visual C# Step by Step. John Sharp Microsoft Microsoft Visual C#- 2010 Step by Step John Sharp Table of Contents Acknowledgments Introduction xvii xix Part I Introducing Microsoft Visual C# and Microsoft Visual Studio 2010 1 Welcome to

More information

Expressions vs statements

Expressions vs statements Expressions vs statements Every expression results in a value (+side-effects?): 1+2, str.length(), f(x)+1 Imperative prg: Statements have just side-effects, no value: (for, if, break) Assignment is statement/expression

More information

The DCI Paradigm Implemented in Squeak

The DCI Paradigm Implemented in Squeak The DCI Paradigm Implemented in Squeak Trygve Reenskaug, Dept. of Informatics, University of Oslo, Norway Home: http://folk.uio.no/trygver E-mail: The DCI paradigm separates a program into different perspectives

More information

Example two door Setup.

Example two door Setup. Example two door Setup. Version 0. 1 Prepared by: Michael Davis- Hannibal Softcon Software Control Services (Pty) Ltd. 7 March 2017 Revision History Name Date Reason For Changes Version MDH 5-Nov-10 Initial

More information

An Introduction to Object Orientation

An Introduction to Object Orientation An Introduction to Object Orientation Rushikesh K Joshi Indian Institute of Technology Bombay rkj@cse.iitb.ac.in A talk given at Islampur Abstractions in Programming Control Abstractions Functions, function

More information

An Object Oriented Programming with C

An Object Oriented Programming with C An Object Oriented Programming with C By Tanmay Kasbe Dr. Ravi Singh Pippal IDEA PUBLISHING WWW.ideapublishing.in i Publishing-in-support-of, IDEA PUBLISHING Block- 9b, Transit Flats, Hudco Place Extension

More information

Simula 67. Simula and Smalltalk. Comparison to Algol 60. Brief history. Example: Circles and lines. Objects in Simula

Simula 67. Simula and Smalltalk. Comparison to Algol 60. Brief history. Example: Circles and lines. Objects in Simula CS 242 Simula 67 Simula and Smalltalk John Mitchell First object-oriented language Designed for simulation Later recognized as general-purpose prog language Extension of Algol 60 Standardized as Simula

More information

Some instance messages and methods

Some instance messages and methods Some instance messages and methods x ^x y ^y movedx: dx Dy: dy x

More information

LATENT METHODS. Richard CS

LATENT METHODS. Richard CS LATENT METHODS Richard O'Keefe @ CS Outline Background The problem Some non-solutions My solution Does it apply elsewhere Background Alan Kay invented tablet computers (the Dynabook) His research group

More information

This chapter describes some of the more common errors that Smalltalk programmers make and gives suggestions on how to prevent the errors.

This chapter describes some of the more common errors that Smalltalk programmers make and gives suggestions on how to prevent the errors. Chapter 22 Common Errors This chapter describes some of the more common errors that Smalltalk programmers make and gives suggestions on how to prevent the errors. Notifier window messages As you test your

More information

CSE 12 Abstract Syntax Trees

CSE 12 Abstract Syntax Trees CSE 12 Abstract Syntax Trees Compilers and Interpreters Parse Trees and Abstract Syntax Trees (AST's) Creating and Evaluating AST's The Table ADT and Symbol Tables 16 Using Algorithms and Data Structures

More information

Syntax and Messages. Stéphane Ducasse S.Ducasse

Syntax and Messages. Stéphane Ducasse   S.Ducasse Syntax and Messages Stéphane Ducasse Stephane.Ducasse@univ-savoie.fr http://www.listic.univ-savoie.fr/~ducasse/ 1 License: CC-Attribution-ShareAlike 2.0 http://creativecommons.org/licenses/by-sa/2.0/ 2

More information

CSc 520 Principles of Programming Languages. 26 : Control Structures Introduction

CSc 520 Principles of Programming Languages. 26 : Control Structures Introduction CSc 520 Principles of Programming Languages 26 : Control Structures Introduction Christian Collberg Department of Computer Science University of Arizona collberg+520@gmail.com Copyright c 2008 Christian

More information

Inheritance, Polymorphism and the Object Memory Model

Inheritance, Polymorphism and the Object Memory Model Inheritance, Polymorphism and the Object Memory Model 1 how objects are stored in memory at runtime? compiler - operations such as access to a member of an object are compiled runtime - implementation

More information

CHAIN OF RESPONSIBILITY (DP 223)

CHAIN OF RESPONSIBILITY (DP 223) CHAIN OF RESPONSIBILITY (DP 223) Object Behavioral Intent Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects

More information

a. It will output It s NOT Rover b. Class Main should be changed to the following (bold characters show the changes)

a. It will output It s NOT Rover b. Class Main should be changed to the following (bold characters show the changes) May 2015 Computing Advanced Paper 1 Question 1 a. It will output It s NOT Rover b. Class Main should be changed to the following (bold characters show the changes) public class Main public static void

More information

About Instance Initialization

About Instance Initialization Learning Object-Oriented Programming and Design with TDD About Instance Initialization Stéphane Ducasse http://stephane.ducasse.free.fr http://www.pharo.org W5S06 W5S06 2 / 26 How to ensure that an instance

More information

ITEC2620 Introduction to Data Structures

ITEC2620 Introduction to Data Structures ITEC2620 Introduction to Data Structures Lecture 10a Grammars II Review Three main problems Derive a sentence from a grammar Develop a grammar for a language Given a grammar, determine if an input is valid

More information

What s different about Factor?

What s different about Factor? Harshal Lehri What s different about Factor? Factor is a concatenative programming language - A program can be viewed as a series of functions applied on data Factor is a stack oriented program - Data

More information

ST Introduction. Birds-eye view

ST Introduction. Birds-eye view 6. Debugging ST Introduction Birds-eye view It can be easier to talk to objects than to read classes The system is alive. Talk to it. The debugger can be your best friend. Donʼt be afraid of it. 1.2 Roadmap

More information

Pro Objective-C Design Patterns for ios

Pro Objective-C Design Patterns for ios Pro Objective-C Design Patterns for ios Carlo Chung Contents Contents at a Glance About the Author About the Technical Reviewer Acknowledgments Preface x xi xii xiii Part I: Getting Your Feet Wet 1 Chapter

More information

XII- COMPUTER SCIENCE VOL-II MODEL TEST I

XII- COMPUTER SCIENCE VOL-II MODEL TEST I MODEL TEST I 1. What is the significance of an object? 2. What are Keyword in c++? List a few Keyword in c++?. 3. What is a Pointer? (or) What is a Pointer Variable? 4. What is an assignment operator?

More information

Lecture 23: Object Lifetime and Garbage Collection

Lecture 23: Object Lifetime and Garbage Collection The University of North Carolina at Chapel Hill Spring 2002 Lecture 23: Object Lifetime and Garbage Collection March 18 1 Fundamental Concepts in OOP Encapsulation Data Abstraction Information hiding The

More information

Pharo Syntax in a Nutshell

Pharo Syntax in a Nutshell Pharo Syntax in a Nutshell Damien Cassou, Stéphane Ducasse and Luc Fabresse W1S06, 2015 W1S06 2 / 28 Getting a Feel About Syntax In this lecture we want to give you the general feel to get started: Overview

More information

XXXXXXXXXXXXXXXXXXXXXXX. Evolution of Software Languages

XXXXXXXXXXXXXXXXXXXXXXX. Evolution of Software Languages Section 8: Simula Smalltalk Evolution of Software Languages Theo D'Hondt Bachelor of Computer Science Faculty of Sciences and Bio-Engineering Sciences Vrije Universiteit Brussel Academic Year 2015-2016

More information

Back to OCaml. Summary of polymorphism. Example 1. Type inference. Example 2. Example 2. Subtype. Polymorphic types allow us to reuse code.

Back to OCaml. Summary of polymorphism. Example 1. Type inference. Example 2. Example 2. Subtype. Polymorphic types allow us to reuse code. Summary of polymorphism Subtype Parametric Bounded F-bounded Back to OCaml Polymorphic types allow us to reuse code However, not always obvious from staring at code But... Types never entered w/ program!

More information

COMPUTER SCIENCE TRIPOS

COMPUTER SCIENCE TRIPOS CST.2003.4.1 COMPUTER SCIENCE TRIPOS Part IB Tuesday 3 June 2003 1.30 to 4.30 Paper 4 Answer five questions. Submit the answers in five separate bundles, each with its own cover sheet. On each cover sheet,

More information

CIS-331 Exam 2 Spring 2016 Total of 110 Points Version 1

CIS-331 Exam 2 Spring 2016 Total of 110 Points Version 1 Version 1 1. (20 Points) Given the class A network address 121.0.0.0 will be divided into multiple subnets. a. (5 Points) How many bits will be necessary to address 8,100 subnets? b. (5 Points) What is

More information

Contents. Telcordia SR-332-Documentation Information

Contents. Telcordia SR-332-Documentation Information Telcordia SR-332-Documentation Information Special Report Notice Of Disclaimer.......................... iii 1. Introduction...................................... 1 1 1.1 Purpose and Scope.................................

More information

Django with Python Course Catalog

Django with Python Course Catalog Django with Python Course Catalog Enhance Your Contribution to the Business, Earn Industry-recognized Accreditations, and Develop Skills that Help You Advance in Your Career March 2018 www.iotintercon.com

More information

CSCE 314 Programming Languages. Monadic Parsing

CSCE 314 Programming Languages. Monadic Parsing CSCE 314 Programming Languages Monadic Parsing Dr. Hyunyoung Lee 1 What is a Parser? A parser is a program that takes a string of characters (or a set of tokens) as input and determines its syntactic structure.

More information

Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5

Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5 Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5 1 Not all languages are regular So what happens to the languages which are not regular? Can we still come up with a language recognizer?

More information

Introduction... ix. Chapter 1: Exploring Fundamental Programming Concepts... 1

Introduction... ix. Chapter 1: Exploring Fundamental Programming Concepts... 1 Table of Contents Introduction... ix Chapter 1: Exploring Fundamental Programming Concepts... 1 1.1 Exploring the Editors... 2 History of Editors... 2 Exploring the Types of Text Editors... 3 Describing

More information

Step 1: Download the Overdrive Media Console App

Step 1: Download the Overdrive Media Console App Step 1: Download the Overdrive Media Console App I. Tap the Play Store icon on your tablet. II. Using the Search Feature, Type Overdrive and select the first entry in the suggested apps list (it has an

More information

Normal Forms for CFG s. Eliminating Useless Variables Removing Epsilon Removing Unit Productions Chomsky Normal Form

Normal Forms for CFG s. Eliminating Useless Variables Removing Epsilon Removing Unit Productions Chomsky Normal Form Normal Forms for CFG s Eliminating Useless Variables Removing Epsilon Removing Unit Productions Chomsky Normal Form 1 Variables That Derive Nothing Consider: S -> AB, A -> aa a, B -> AB Although A derives

More information

From Access to SQL Server

From Access to SQL Server IURQWIP3DJHL7XHVGD\$XJXVW30 From Access to SQL Server RUSSELL SINCLAIR IURQWIP3DJHLLL7XHVGD\$XJXVW30 Contents at a Glance Introduction... xi Chapter 1 What Every Access Programmer Needs to Know about SQL

More information

CSc 372. Comparative Programming Languages. 2 : Functional Programming. Department of Computer Science University of Arizona

CSc 372. Comparative Programming Languages. 2 : Functional Programming. Department of Computer Science University of Arizona 1/37 CSc 372 Comparative Programming Languages 2 : Functional Programming Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2013 Christian Collberg 2/37 Programming Paradigms

More information

SSA Construction. Daniel Grund & Sebastian Hack. CC Winter Term 09/10. Saarland University

SSA Construction. Daniel Grund & Sebastian Hack. CC Winter Term 09/10. Saarland University SSA Construction Daniel Grund & Sebastian Hack Saarland University CC Winter Term 09/10 Outline Overview Intermediate Representations Why? How? IR Concepts Static Single Assignment Form Introduction Theory

More information

Traits in C# Stefan Reichhart Oscar Nierstrasz, Stephane Ducasse. Software Composition Group

Traits in C# Stefan Reichhart Oscar Nierstrasz, Stephane Ducasse. Software Composition Group Traits in C# Stefan Reichhart stefan_reichhart@student.unibe.ch Software Composition Group Oscar Nierstrasz, Stephane Ducasse Roadmap Project Context / Why Traits? What s a Trait? Flattening Traits? Traits

More information

CS 406: Syntax Directed Translation

CS 406: Syntax Directed Translation CS 406: Syntax Directed Translation Stefan D. Bruda Winter 2015 SYNTAX DIRECTED TRANSLATION Syntax-directed translation the source language translation is completely driven by the parser The parsing process

More information

"Charting the Course... Java Programming Language. Course Summary

Charting the Course... Java Programming Language. Course Summary Course Summary Description This course emphasizes becoming productive quickly as a Java application developer. This course quickly covers the Java language syntax and then moves into the object-oriented

More information

Syntax and Messages. Stéphane Ducasse 8.1

Syntax and Messages. Stéphane Ducasse 8.1 Syntax and Messages The syntax of Smalltalk is simple and uniform, but it can look strange at first sight! Literals: numbers, strings, arrays... Variable names Pseudo-variables Assignments, returns Message

More information

ECE570 Lecture 2: Types and Conventions

ECE570 Lecture 2: Types and Conventions ECE570 Lecture 2: Types and Conventions Jeffrey Mark Siskind School of Electrical and Computer Engineering Fall 2017 Siskind (Purdue ECE) ECE570 Lecture 2: Types and Conventions Fall 2017 1 / 28 Booleans

More information

ECE473 Lecture 2: Types and Conventions

ECE473 Lecture 2: Types and Conventions ECE473 Lecture 2: Types and Conventions Jeffrey Mark Siskind School of Electrical and Computer Engineering Spring 2019 Siskind (Purdue ECE) ECE473 Lecture 2: Types and Conventions Spring 2019 1 / 28 Booleans

More information

OO Design with Smalltalk a Pure Object Oriented Language and Environment

OO Design with Smalltalk a Pure Object Oriented Language and Environment OO Design with Smalltalk a Pure Object Oriented Language and Environment About the exercises The exercises developped in the following lessons have been originally written by Roel Wuyts and Koen De Hondt

More information

Midterm 2 Solutions Many acceptable answers; one was the following: (defparameter g1

Midterm 2 Solutions Many acceptable answers; one was the following: (defparameter g1 Midterm 2 Solutions 1. [20 points] Consider the language that consist of possibly empty lists of the identifier x enclosed by parentheses and separated by commas. The language includes { () (x) (x,x) (x,x,x)

More information

3 CHAPTER. Coordinate Geometry

3 CHAPTER. Coordinate Geometry 3 CHAPTER We are Starting from a Point but want to Make it a Circle of Infinite Radius Cartesian Plane Ordered pair A pair of numbers a and b instead in a specific order with a at the first place and b

More information

Stat 602 The Design of Experiments

Stat 602 The Design of Experiments Stat 602 The Design of Experiments Yuqing Xu Department of Statistics University of Wisconsin Madison, WI 53706, USA April 28, 2016 Yuqing Xu (UW-Madison) Stat 602 Week 14 April 28, 2016 1 / 10 Blocking

More information

Guru 101 Grokking the Smalltalk system. Smalltalk Solutions Europe 1998 Joseph Pelrine Daedalos Consulting Group

Guru 101 Grokking the Smalltalk system. Smalltalk Solutions Europe 1998 Joseph Pelrine Daedalos Consulting Group Guru 101 Grokking the Smalltalk system Smalltalk Solutions Europe 1998 Joseph Pelrine Daedalos Consulting Group jpelrine@daedalos.de About this talk 10:00-12:00 AM Coffee break Beer afterwards Intermediate

More information

CSE 341: Programming Languages

CSE 341: Programming Languages CSE 341: Programming Languages Hal Perkins Spring 2011 Lecture 2 Functions, pairs, and lists Hal Perkins CSE341 Spring 2011, Lecture 2 1 What is a programming language? Here are separable concepts for

More information