Stéphane Ducasse7.1 Let’s Play Objects Simulate a LAN physically Set up a context for –future chapters –Exercises Some forward references to intriguate.

Slides:



Advertisements
Similar presentations
Wireless network Usually use Radio Frequency (RF) technology Adv :
Advertisements

1 Formalising Behaviour-Preserving Object-Oriented Program Transformations Tom Mens( ) Postdoctoral Fellow – Fund for Scientific Research.
Networking Some of the basics. What is a Network Simply put, its two or more computer connected together through a communication medium. A communication.
From Objects to Actors Study of a Limited Symbiosis in Smalltalk-80.
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.
Stéphane Ducasse«ChapterNr».1 Selected Design Patterns Design Patterns are recurrent solutions to design problems They are pros and cons We already saw:
Principles of Object-Oriented Software Development The language Smalltalk.
2. Smalltalk Basics. © Oscar Nierstrasz ST — Smalltalk Basics 2.2 Roadmap  Everything is an Object  Syntax on a Postcard  Three Kinds of Messages 
Networks Types. Spring 2002Computer Network Applications Data Transfer During the ’70s: Minicomputers became affordable; Need to communicate information;
Stéphane Ducasse9.1 Inheritance Semantics and Lookup.
Stéphane Ducasse8.1 Syntax and Messages The syntax of Smalltalk is simple and uniform, but it can look strange at first sight! Literals: numbers, strings,
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.
PZ06BX Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ06BX - Introduction to Smalltalk Programming Language.
2. Smalltalk Basics. © Oscar Nierstrasz ST — Smalltalk Basics 2.2 Roadmap  Everything is an Object  Syntax on a Postcard  Three Kinds of Messages 
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.
Some Basic Points on Classes
S.Ducasse Stéphane Ducasse 1 A Taste of Smalltalk.
Stéphane Ducasse 1 Syntax and Messages.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 13 Object-Oriented Programming I am surprised.
Communication Protocols III Tenth Meeting. Connections in TCP A wants to send to B. What is the packet next move? A travels through hub and bridge to.
Stéphane Ducasse«ChapterNr».1 Advanced Classes Indexed Classes Classes as Objects Class Instance Variables and Methods Class Variables Pool Dictionaries.
Stéphane Ducasse5.1 Smalltalk in a Nutshell OO Model in a Nutshell Syntax in a Nutshell.
12. A bit of Smalltalk. © O. Nierstrasz P2 — A bit of Smalltalk 11.2 Roadmap  Some history  Smalltalk syntax & object model  The Smalltalk environment.
Stéphane Ducasse 1 Smalltalk in a Nutshell.
Stéphane Ducasse4.1 A Taste of Smalltalk Two examples: –‘hello world’ –A Tomagoshi To give you an idea of: –the syntax –the elementary objects and classes.
S.Ducasse Stéphane Ducasse 1 The Taste of Smalltalk.
Chapter 5 - Writing a Problem Domain Class Definition1 Chapter 5 Writing a Problem Domain Class Definition.
1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW p Waleed Ejaz
Introducing Network Standards
SE-1010 Dr. Mark L. Hornick 1 Introduction to Object-Oriented Programming (OOP) Part 1.
CIT-Dept-IFM 2006/7 Institute of Finance Management 2006 CIT232- Computer Networks 1/30 Protocols and Standards Protocols and Standards Protocols Standards.
CS 598 Scripting Languages Design and Implementation 7. Smalltalk 80.
Computer and Information Science Ch1.3 Computer Networking Ch1.3 Computer Networking Chapter 1.
S.Ducasse Stéphane Ducasse 1 Classes and Metaclasses - an Analysis.
S.Ducasse Stéphane Ducasse savoie.fr e/ e/ 1 Inheritance Semantics and Method Lookup.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Stéphane Ducasse 1 Elements of Design - Inheritance/Compositio n.
Stéphane Ducasse 1 Singleton.
CS101 Network Setup. Parts of a network Everything on a network is called a ____ Three main types of _____: –__________ Devices = Printers, Scanners,
S.Ducasse Stéphane Ducasse 1 Common Mistakes and Debugging in VW.
4000 Imaje 4020 – Connectivity Imaje 4020 – Content Content of Chapter Connectivity: 1. Interfaces 2. Serial connections 3. Ethernet connection.
Stéphane Ducasse 1 Some Advanced Points on Classes.
3C-1 Identifiers Variables Literal Objects  Numbers  Characters  Strings Control Structure  Blocks  Conditionals  Loops Messages Defining New Classes.
Stéphane Ducasse 1 Strategy.
Active Message Application: CONNECT Presented by Xiaozhou David Zhu Oommen Regi July 6, 2001.
S.Ducasse Marcus Denker 1 Working with Bytecodes: IRBuilder and InstructionStream.
Stéphane Ducasse 1 Some Points on Classes.
S.Ducasse Stéphane Ducasse 1 Smalltalk in a Nutshell.
S.Ducasse Stéphane Ducasse savoie.fr e/ e/ 1 Smalltalk in a Nutshell.
Networking Components William Isakson LTEC 4550 October 7, 2012 Module 3.
(ITI310) By Eng. BASSEM ALSAID SESSIONS 9: Dynamic Host Configuration Protocol (DHCP)
CSE 3302 Programming Languages Chengkai Li Fall 2007 Smalltalk Lecture 14 – Smalltalk, Fall CSE3302 Programming Languages, UT-Arlington ©Chengkai.
Stéphane Ducasse 1 A Little Journey in the Smalltalk Syntax.
Stéphane Ducasse 1 Elements of Design - Unit of Reuse.
Stéphane Ducasse 1 Abstract Classes.
S.Ducasse Stéphane Ducasse 1 Some Advanced Points on Classes.
Delivery Categories of Messaging. Messaging Categories Unicast: Messages are sent to a single, specific recipient Multicast: Messages are sent to a group.
S.Ducasse 1 Instance Initialization How to ensure that an instance is well initialized? Automatic initialize Lazy initialization Proposing the right interface.
LAN, WAN, and Network Topologies
Let’s Play Objects.
Design Points - Law of Demeter
2.2 Framework Techniques.
2.3 Collaboration Contracts
Introduction to Data-Link Layer
Tiers vs. Layers.
Introduction to Computer Concept
Introduction to Smalltalk
Let’s Talk about… Smalltalk.
Introduction to Smalltalk
Presentation transcript:

Stéphane Ducasse7.1 Let’s Play Objects Simulate a LAN physically Set up a context for –future chapters –Exercises Some forward references to intriguate you

Stéphane Ducasse7.2 A LAN Simulator A LAN contains nodes, workstations, printers, file servers. Packets are sent in a LAN and each node treats them differently.

Stéphane Ducasse7.3 Three Kinds of Objects Node and its subclasses represent the entities that are connected to form a LAN. Packet represents the information that flows between Nodes. NetworkManager manages how the nodes are connected

Stéphane Ducasse7.4 LAN Design

Stéphane Ducasse7.5 Interactions Between Nodes

Stéphane Ducasse7.6 Node and Packet Creation |macNode pcNode node1 printerNode node2 node3 packet| macNode := Workstation withName: #mac. pcNode := Workstation withName: #pc. node1 := Node withName: #node1. node2 := Node withName: #node2. node3 := Node withName: #node2. printerNode := Printer withName: #lpr. macNode nextNode: node1. node1 nextNode: pcNode. pcNode nextNode: node2. node3 nextNode: printerNode. lpr nextNode: macNode. packet := Packet send: 'This packet travelled to' to: #lpr.

Stéphane Ducasse7.7 Objects communicate via Messages (II) Message: –receiver : 1 (an instance of SmallInteger) –selector: #+ –arguments: 2 Message: lpr nextNode: macNode –receiver lpr (an instance of LanPrinter) –selector: #nextNode: –arguments: macNode (an instance of Workstation) Message: Packet send: 'This packet travelled to' to: #lpr –receiver: Packet (a class) –selector: #send:to: –arguments: 'This packet travelled to' and #lpr

Stéphane Ducasse7.8 The Definition of a LAN To simplify the creation and the manipulation of a LAN: | aLan | aLan := NetworkManager new. aLan createAndDeclareNodesFromAddresses: #(node1node2 node3) ofKind: Node. aLan createAndDeclareNodesFromAddresses: #(mac pc) ofKind: Workstation. aLan createAndDeclareNodesFromAddresses: #(lpr) ofKind: LanPrinter. aLan connectNodesFromAddresses: #(mac node1 pc node2 node3 lpr) Now we can query the LAN to get some nodes: aLan findNodeWithAddress: #mac

Stéphane Ducasse7.9 Transmitting a Packet | aLan packet macNode|... macNode := aLan findNodeWithAddress: #mac. packet := Packet send: 'This packet travelled to the printer' to: #lpr. macNode originate: packet. -> mac sends a packet to pc -> pc sends a packet to node1 -> node1 sends a packet to node2 -> node2 sends a packet to node3 -> node3 sends a packet to lpr -> lpr is printing -> this packet travelled to lpr

Stéphane Ducasse7.10 How to Define a Class Fill the template: NameOfSuperclass subclass: #NameOfClass instanceVariableNames: 'instVarName1' classVariableNames: 'ClassVarName1 ClassVarName2' poolDictionaries: '' category: 'LAN’ For example to create the class Packet Object subclass: #Packet instanceVariableNames: 'addressee originator contents ' classVariableNames: '' poolDictionaries: '' category: 'LAN'

Stéphane Ducasse7.11 How to define a method? message selector and argument names "comment stating purpose of message" | temporary variable names | statements LanPrinter>>accept: thePacket "If the packet is addressed to me, print it. Otherwise just behave like a normal node." (thePacket isAddressedTo: self) ifTrue: [self print: thePacket] ifFalse: [super accept: thePacket]

Stéphane Ducasse7.12 In Java In Java we would write void accept(thePacket Packet) /*If the packet is addressed to me, print it. Otherwise just behave like a normal node.*/ if (thePacket.isAddressedTo(this)){ this.print(thePacket)} else super.accept(thePacket)}