© Oscar Nierstrasz ST — Smalltalk Basics 2.1 Change sets  Make sure your changes are logged to a new change set.

Slides:



Advertisements
Similar presentations
The State Transition Diagram
Advertisements

8. Static Single Assignment Form Marcus Denker. © Marcus Denker SSA Roadmap  Static Single Assignment Form (SSA)  Converting to SSA Form  Examples.
10. Applications of Logic Programming. © O. Nierstrasz PS — Applications of Logic Programming 10.2 Roadmap 1. Search problems —SEND + MORE = MONEY 2.
8. Introduction to Denotational Semantics. © O. Nierstrasz PS — Denotational Semantics 8.2 Roadmap Overview:  Syntax and Semantics  Semantics of Expressions.
12. Common Errors, a few Puzzles. © O. Nierstrasz P2 — Common Errors, a few Puzzles 12.2 Common Errors, a few Puzzles Sources  Cay Horstmann, Computing.
ESE Einführung in Software Engineering 6. Modeling Objects and Classes Prof. O. Nierstrasz.
ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.
CP — Concurrent Programming 5. Safety and Liveness Properties Prof. O. Nierstrasz Wintersemester 2005 / 2006.
CP — Concurrent Programming 8. Liveness and Asynchrony Prof. O. Nierstrasz Wintersemester 2005 / 2006.
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.
10. Petri Nets Prof. O. Nierstrasz. Roadmap  Definition: —places, transitions, inputs, outputs —firing enabled transitions  Modelling: —concurrency.
3. A Testing Framework. © O. Nierstrasz P2 — A Testing Framework 3.2 A Testing Framework Overview  What is a framework?  What is an Annotation?  JUnit.
Object-Oriented Reengineering Patterns and Techniques Prof. O. Nierstrasz Prof. S. Ducasse T.
2. Smalltalk Basics. © Oscar Nierstrasz ST — Smalltalk Basics 2.2 Roadmap  Everything is an Object  Syntax on a Postcard  Three Kinds of Messages 
12. Summary, Trends, Research. © O. Nierstrasz PS — Summary, Trends, Research Roadmap  Summary: —Trends in programming paradigms  Research:...
7. Understanding Classes and Metaclasses. © Oscar Nierstrasz ST — Understanding Classes and Metaclasses 7.2 Roadmap  Metaclasses in 7 points  Indexed.
12. Common Errors, a few Puzzles. © O. Nierstrasz P2 — Common Errors, a few Puzzles 12.2 Common Errors, a few Puzzles Overview  Common errors … —Typical.
ESE Einführung in Software Engineering N. XXX Prof. O. Nierstrasz Fall Semester 2009.
The Software Composition Group Prof. O. Nierstrasz
ESE Einführung in Software Engineering
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.
7. Fixed Points. © O. Nierstrasz PS — Fixed Points 7.2 Roadmap  Representing Numbers  Recursion and the Fixed-Point Combinator  The typed lambda calculus.
12. Common Errors, a few Puzzles. © O. Nierstrasz P2 — Common Errors, a few Puzzles 12.2 Common Errors, a few Puzzles Overview  Common errors … —Typical.
13. A bit of Smalltalk. © Oscar Nierstrasz 2 Roadmap  The origins of Smalltalk  What is Smalltalk?  Syntax in a nutshell  Seaside — web development.
CP — Concurrent Programming 12. Petri Nets Prof. O. Nierstrasz Wintersemester 2005 / 2006.
13. Traits. Selected literature  Cook. Interfaces and Specifications for the Smalltalk-80 Collection Classes. OOPSLA 1992  Taivalsaari. On the Notion.
Metamodeling Seminar X. CHAPTER Prof. O. Nierstrasz Spring Semester 2008.
Programmierung 2 Object-Oriented Programming with Java Prof. O. Nierstrasz Sommersemester 2006.
3. A Testing Framework. © O. Nierstrasz P2 — A Testing Framework 3.2 A Testing Framework Overview  What is a framework?  JUnit — a simple testing framework.
2. Smalltalk Basics. © Oscar Nierstrasz ST — Smalltalk Basics 2.2 Roadmap  Everything is an Object  Syntax on a Postcard  Three Kinds of Messages 
© Oscar Nierstrasz ST — Smalltalk Basics 2.1 Change sets  Make sure your changes are logged to a new change set.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
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.
7. Fixed Points. © O. Nierstrasz PS — Fixed Points 7.2 Roadmap Overview  Representing Numbers  Recursion and the Fixed-Point Combinator  The typed.
12. Common Errors, a few Puzzles. © O. Nierstrasz P2 — Common Errors, a few Puzzles 12.2 Common Errors, a few Puzzles Sources  Cay Horstmann, Computing.
7. Fixed Points. © O. Nierstrasz PS — Fixed Points 7.2 Roadmap  Representing Numbers  Recursion and the Fixed-Point Combinator  The typed lambda calculus.
7. Liveness and Asynchrony Prof. O. Nierstrasz. Roadmap  Asynchronous invocations  Simple Relays —Direct invocations —Thread-based messages —Command-based.
6. Debugging. © Oscar Nierstrasz ST — Debugging 6.2 Roadmap  Common syntactic errors  Common semantic errors  Encapsulation errors  Class/instance.
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.
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:  …
SWOT Analysis Strengths Weaknesses SWOT Opportunities Threats.
Collecting Images & Clippings Chapter 2.3 in Sketching User Experiences: The Workbook.
Win8 on Intel Programming Course The challenge Paul Guermonprez Intel Software
This work is licensed under a Creative Commons AttributionCreative Commons Attribution © Copyright Showeet.com E XAMPLES S TICKY N OTES Thank you ! Thank.
7. Just In Time Compilation Prof. O. Nierstrasz Jan Kurs.
© Copyright Showeet.com I NSERT YOUR TITLE HERE. © Copyright Showeet.com Insert Your Title Here 2 Master text styles –Second level Third level –Fourth.
The Animated Sequence Chapter 5.1 in Sketching User Experiences: The Workbook.
Numerical Methods Continuous Fourier Series Part: Continuous Fourier Series
Sketching Vocabulary Chapter 3.4 in Sketching User Experiences: The Workbook Drawing objects, people, and their activities.
Win8 on Intel Programming Course Paul Guermonprez Intel Software
Design of Everyday Things Part 2: Useful Designs? Lecture /slide deck produced by Saul Greenberg, University of Calgary, Canada Images from:
SWOT Analysis Matrix S W O T SWOT Analysis.
About the Author A Lifetime of Software Development Started Writing Code at Age 11 Programming Summer Camp at Age 12 Writing Code Ever Since At Age 25,
CP — Concurrent Programming 6. Liveness and Guarded Methods Prof. O. Nierstrasz Wintersemester 2005 / 2006.
Institutional Repositories July 2007 Intellectual property management : the DISA experience Dr D Peters DISA: Digital Innovation South Africa.
Launching the Dean digitally : the Jonathan Jansen Collection in UPSpace eIFL.net in co-operation with the Research Library Consortium Institutional repositories.
Images of pesticides By: Leslie London, University of Cape Town This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5.
Digital Ecosystems supporting growth and SMEs 1st cluster meeting Results and commitments 1st cluster meeting Results and commitments.
Open Access and Institutional Repositories, 10 July 2007, UKZN, Durban,,South Africa Metadata for institutional repositories: an introduction Pat Liebetrau.
Insert the title of your presentation here Insert the subtitle of your presentation here.
Sketching Vocabulary Chapter 3.4 in Sketching User Experiences: The Workbook Drawing objects, people, and their activities.
Drop Shape Pie Chart White Background.
Porting U-boot Michael Opdenacker Free Electrons
FOTW Worksheet Slides Christopher Penn, Financial Aid Podcast Student Loan Network.
Presentation transcript:

© Oscar Nierstrasz ST — Smalltalk Basics 2.1 Change sets  Make sure your changes are logged to a new change set

© Oscar Nierstrasz ST — Smalltalk Basics 2.2 SUnit

© Oscar Nierstrasz ST — Smalltalk Basics 2.3 Money TestCase subclass: #MoneyTest instanceVariableNames: 'chf2 chf8 chf10' classVariableNames: '' poolDictionaries: '' category: 'Money' TestCase subclass: #MoneyTest instanceVariableNames: 'chf2 chf8 chf10' classVariableNames: '' poolDictionaries: '' category: 'Money'  We will implement the Money example in Smalltalk —First, we develop a test case for a single currency NB: This is just a message sent to the TestCase class object (!)

© Oscar Nierstrasz ST — Smalltalk Basics 2.4 SetUp  We will need setters for the private Money state MoneyTest>>setUp chf2 := Money new currency: 'CHF'; amount: 2. chf8 := Money new currency: 'CHF'; amount: 8. chf10 := Money new currency: 'CHF'; amount: 10. MoneyTest>>setUp chf2 := Money new currency: 'CHF'; amount: 2. chf8 := Money new currency: 'CHF'; amount: 8. chf10 := Money new currency: 'CHF'; amount: 10.

© Oscar Nierstrasz ST — Smalltalk Basics 2.5 MoneyTest>>testEquals  Some obvious tests MoneyTest>>testEquals self assert: chf2 = chf2. self assert: chf2 = (Money new currency: 'CHF'; amount: 2). self assert: chf2 != chf8. MoneyTest>>testEquals self assert: chf2 = chf2. self assert: chf2 = (Money new currency: 'CHF'; amount: 2). self assert: chf2 != chf8.

© Oscar Nierstrasz ST — Smalltalk Basics 2.6 Money  We define Money as a subclass of Object, with getters and setters Object subclass: #Money instanceVariableNames: 'currency amount' classVariableNames: '' poolDictionaries: '' category: 'Money' Object subclass: #Money instanceVariableNames: 'currency amount' classVariableNames: '' poolDictionaries: '' category: 'Money' Money>>currency: aString currency := aString. Money>>currency: aString currency := aString. Money>>currency ^ currency Money>>currency ^ currency

© Oscar Nierstrasz ST — Smalltalk Basics 2.7 Failing tests

© Oscar Nierstrasz ST — Smalltalk Basics 2.8 Comparisons Money>>= aMoney ^ self currency = aMoney currency and: [ self amount = aMoney amount ] Money>>= aMoney ^ self currency = aMoney currency and: [ self amount = aMoney amount ] Money>>!= aMoney ^ (self = aMoney) not Money>>!= aMoney ^ (self = aMoney) not

© Oscar Nierstrasz ST — Smalltalk Basics 2.9 Constructors MoneyTest>>testEquals self assert: chf2 = chf2. self assert: chf2 = (Money currency: 'CHF' amount: 2). self assert: chf2 != chf8. MoneyTest>>testEquals self assert: chf2 = chf2. self assert: chf2 = (Money currency: 'CHF' amount: 2). self assert: chf2 != chf8. We need a constructor on the class side of Money

© Oscar Nierstrasz ST — Smalltalk Basics 2.10 Class methods NB: What “self” is referred to in the method body?

© Oscar Nierstrasz ST — Smalltalk Basics 2.11 Addition Money>>+ aMoney ^ Money currency: self currency amount: self amount + aMoney amount Money>>+ aMoney ^ Money currency: self currency amount: self amount + aMoney amount MoneyTest>>testAdd self assert: chf2 + chf8 = chf10 MoneyTest>>testAdd self assert: chf2 + chf8 = chf10 And so on …

© Oscar Nierstrasz ST — Smalltalk Basics 2.12 Filing out your changes  You can “file out” all your changes so they can be loaded into another image

© Oscar Nierstrasz ST — Smalltalk Basics 2.13 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.