Frames and Inheritance. Winston, Chapter 9

Similar documents
Managing Change and Complexity

CMPT Data and Program Organization

Chapter 1. Storage Concepts. CommVault Concepts & Design Strategies:

Semantic Nets and Frames SEEM

Inheritance (Chapter 7)

REVIEW OF THE BASIC CHARACTERISTICS OF OBJECT ORIENTATION

Introducing the UML Eng. Mohammed T. Abo Alroos

Eliminate enterprise software design instability - protect variations! Nickolay Kofanov

Inheritance and Interfaces

Curriculum Map Grade(s): Subject: AP Computer Science

Programming Language Concepts 1982, 1987, Outline. Period

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Sorting lower bound and Linear-time sorting Date: 9/19/17

The Bizarre Truth! Automating the Automation. Complicated & Confusing taxonomy of Model Based Testing approach A CONFORMIQ WHITEPAPER

Metrics and OO. SE 3S03 - Tutorial 12. Alicia Marinache. Week of Apr 04, Department of Computer Science McMaster University

Object-Oriented Software Engineering Practical Software Development using UML and Java

Common Lisp Object System Specification. 1. Programmer Interface Concepts

Overview. COMP 4200: Expert Systems. Knowledge Representation 2. Knowledge Representation 1

Design Patterns. Design Patterns 1. Outline. Design Patterns. Bicycles Simulator 10/26/2011. Commonly recurring patterns of OO design

LISP. Everything in a computer is a string of binary digits, ones and zeros, which everyone calls bits.

CHAPTER. Knowledge Representation

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

Building custom components IAT351

An Overview of Visual Basic.NET: A History and a Demonstration

Design Patterns Design patterns advantages:

Lecture 2 and 3: Fundamental Object-Oriented Concepts Kenneth M. Anderson

(Refer Slide Time: 1:27)

Object Oriented Design. Program Design. Analysis Phase. Part 2. Analysis Design Implementation. Functional Specification

4CAPS differs from other production system interpreter-based architectures in two major ways.

Chapter 10 Classes Continued. Fundamentals of Java

Inheritance (Outsource: )

History of object-oriented approaches

Organization of Programming Languages (CSE452) Why are there so many programming languages? What makes a language successful?

Chapter 8: Enhanced ER Model

Patterns and Testing

Plan. Design principles: laughing in the face of change. What kind of change? What are we trying to achieve?

Goal of the course: The goal is to learn to design and analyze an algorithm. More specifically, you will learn:

The Essence of Object Oriented Programming with Java and UML. Chapter 2. The Essence of Objects. What Is an Object-Oriented System?

Object-Oriented Technology. Rick Mercer

Solved Question Paper June 2017

Object-based representation. Objects

Object-Oriented Programming and Design

NOTES ON OBJECT-ORIENTED MODELING AND DESIGN

Object-Oriented Design

PC204. Lecture 5 Programming Methodologies. Copyright 2000 by Conrad Huang and the Regents of the University of California. All rights reserved.

16 April 2011 Alan, Edison, etc, Saturday.

Forth Meets Smalltalk. A Presentation to SVFIG October 23, 2010 by Douglas B. Hoffman

The architecture of Eiffel software 3.1 OVERVIEW classes clusters systems

Plan. Design principles: laughing in the face of change. What kind of change? What are we trying to achieve?

Ontologies for Agents

Object Fundamentals Part Three. Kenneth M. Anderson University of Colorado, Boulder CSCI 4448/6448 Lecture 4 09/06/2007

Object Model. Object Orientated Analysis and Design. Benjamin Kenwright

Requirements and Design Overview

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

Object-Oriented Programming Paradigm

21ST century enterprise. HCL Technologies Presents. Roadmap for Data Center Transformation

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

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

More About Objects. Zheng-Liang Lu Java Programming 255 / 282

Introduction. A. Bellaachia Page: 1

Chapter 10. Object-Oriented Analysis and Modeling Using the UML. McGraw-Hill/Irwin

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 5: Modelling with Classes

Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department

CIO s Guide to Make $ense of Data Center Modernization

Describing the architecture: Creating and Using Architectural Description Languages (ADLs): What are the attributes and R-forms?

6.001 Notes: Section 15.1

Object Oriented Programming

DESIGN AS RISK MINIMIZATION

8/27/17. CS-3304 Introduction. What will you learn? Semester Outline. Websites INTRODUCTION TO PROGRAMMING LANGUAGES

Chapter 3:: Names, Scopes, and Bindings (cont.)

Lecture 09. Ada to Software Engineering. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

ava with Object-Oriented Generic Programming+ Java Java with Object-Oriented + Generic Programming by Paul S. Wang sofpower.com

Chapter 3:: Names, Scopes, and Bindings (cont.)

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

Section 3.1 Shapes of Distributions MDM4U Jensen

Chapter 12. OOP: Creating Object- Oriented Programs. McGraw-Hill. Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.

Object- Oriented Design with UML and Java Part I: Fundamentals

OBJECT ORIENTED SYSTEM DEVELOPMENT Software Development Dynamic System Development Information system solution Steps in System Development Analysis

Oracle Applications Cloud User Experience Strategy & Roadmap


1 Executive Overview The Benefits and Objectives of BPDM

Object-Oriented Systems Development: Using the Unified Modeling Language

Practical UML - A Hands-On Introduction for Developers

Review sheet for Final Exam (List of objectives for this course)

R/3 System Object-Oriented Concepts of ABAP

SOLID Principles. Equuleus Technologies. Optional Subheading October 19, 2016

Testing. Unit, integration, regression, validation, system. OO Testing techniques Application of traditional techniques to OO software

1: Introduction to Object (1)

Analysis and Design with UML

COMP 250 Fall inheritance Nov. 17, 2017

Developing ASP Components By Shelley Powers READ ONLINE

Chapter 3 System Models

Concepts of Programming Languages

1. Write two major differences between Object-oriented programming and procedural programming?

Building Knowledge Models Using KSM

MORE OO FUNDAMENTALS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 4 09/01/2011

ICS 52: Introduction to Software Engineering

Subclasses, Superclasses, and Inheritance

Keywords: Abstract Factory, Singleton, Factory Method, Prototype, Builder, Composite, Flyweight, Decorator.

Object-oriented perspective

Chapter 3: Google Penguin, Panda, & Hummingbird

Transcription:

Frames and Inheritance Winston, Chapter 9 Michael Eisenberg and Gerhard Fischer TA: Ann Eisenberg AI Course, Fall 1997 Eisenberg/Fischer 1

Programming Languages A Knowledge Representation View procedural: examples: Fortran, Pascal, Lisp, C main features: subroutines, recursion AI contribution: dynamic memory structures (beyond arrays) rule-based: examples: OPS-5, expert system shells, embedded rule interpreters main features: simplicity, uniformity, modelling of expert knowledge AI contribution: production systems (protocol analysis), modelling of expert knowledge object-oriented: examples: Simula, Smalltalk, C++, Clos main features: class/instance, single/multiple inheritance AI contribution: frames, modelling of common sense knowledge Eisenberg/Fischer 2

An Example: One Turtle ---> Multiple Turtles ---> Multiple Objects one (existing) turtle: <message>, <verb><noun>} forward 10 {<object> multiple turtles: option 1: forward t1 10 option 2: talk to t1 forward 10 right 90 talk to t2 multiple kind of objects forward enterprise 10 define forward (object, amount) select (object) object = turtle ---> forward-turtle amount object = ship ---> forward-ship amount Eisenberg/Fischer 3

Turtles Object-Oriented Design (OOD) t1 forward 10 <message>, <noun><verb>} {<object> turtles and ship can be subclasses from moving objects Object-Oriented design methodology: - what objects do exist (which have a state associated with it) - how can these objects be grouped into classes Eisenberg/Fischer 4

Factorization of Knowledge in procedural environments turtle ship plane forward train puma in object-oriented environments smell when-hit turtle forward Eisenberg/Fischer 5

An Evolutionary of Model Object-Oriented Development Frameworks B Frameworks C, B' Classes A Classes A' Classes B Classes B', A'' Classes C Project A Project B Project C Project Y Time solid-tip arrows: evolution, driven by software developers creating new software objects to accommodate new projects hollow-tip arrows: indicate software developers reusing components, although reuse at times leads to redesign stable structures of class libraries and frameworks emerge over multiple projects domain-orientation permeates the model as all of the creation, reuse, and redesign of components is driven by problems arising in the development of specific projects Eisenberg/Fischer 6

Evolving Components in Object-Oriented Development Abstraction Factorization Composition Refinement refinement: subclassing composition: combine classes abstraction: from commonalties in behaviors and properties factorization: partition properties and methods of an object into simpler, more cohesive and presumably more reusable components Eisenberg/Fischer 7

Claims of Object-Oriented Development Technologies OO systems support software evolution, extension, and/or modification OO systems are reusable and easily constructed from existing components OO systems are understandable to domain experts (users) and developers Eisenberg/Fischer 8

Beyond Current Object-Oriented Design focus on the needs of the human software developers (Fischer 1987) more than on the formal properties of classes, instances, and inheritance (Stefik & Bobrow 1986). OO technology presents not simply a new way to program, but a new way for people to think about problems and problems domains. OOD is necessary/advantageous for many problems, but not sufficient Eisenberg/Fischer 9

Why is OOD Not Sufficient good abstractions are not given, but need to be created insufficient support for reuse and redesign (location, comprehension and modification) lack of domain-orientation claim: no single methodology and/or tool will be suited to all problems Eisenberg/Fischer 10

Example: General Knowledge about Fairy- Tails Dwarfs fairy-tail competitors and gourmands are fairy-tale dwarfs most fairy-tale dwarfs are fat most fairy-tale dwarfs appetites are small most fairy-tale gourmands are huge most fairy-tale competitors are thin Eisenberg/Fischer 11

Terminology: From Semantic Nets to Frames frame = nodes and links grouped together slot = link slot values = destination of links instances frames or instances: describe individual things (e.g., Grumpy, an individual dwarf) class frames of classes: describe groups of objects (e.g., all dwarfs) is-a -member-of-the-class slot: classes they are members of ties instances to the a - k ind- o f slot: ties classes together via sub- and superclass relationships direct subclass: of the superclass the ako slot is filled with then name Eisenberg/Fischer 12

Shared Knowledge Located Centrally Easier to construct when you write it down Easier to correct when you make a mistake Easier to keep up to date as times change Easier to distribute because it can be distributed automatically Eisenberg/Fischer 13

Inheritance To fill the Physique slot when a new Dwarf is constructed ---> write Fat in the slot. To fill the Physique slot when a new Competitor is constructed ---> write Thin in the slot. the class precedence list (see Figure 9.2): - Blimpy - Managers class - Competitors class procedure stored here - Dwarfs class procedure stored here - Everything class question: is Blimpy fat or thin? Eisenberg/Fischer 14

Inheritance with Multiple Superclasses To fill the Appetite slot when a new Dwarf is constructed - --> write Small in the slot. To fill the Appetite slot when a new Gourmand is constructed - --> write Huge in the slot. Search: - depth-first search - exhaustive depth-first search - up-to-join proviso Eisenberg/Fischer 15

Example - Blimpy - Managers class - Competitors class - Dwarfs class procedure stored here - Everything class - Gourmands class procedure stored here - Diarists class rule: each class should appear on class-precedence list before any of its superclasses (up-to-join proviso) - Blimpy - Managers class - Competitors class - Gourmands class procedure stored here - Diarists class - Dwarfs class procedure stored here - Everything class Eisenberg/Fischer 16

Demon Procedures reading or writing can activate: - when-requested procedures - when-read procedures - when-written procedures these procedures are called demons, because they lurk about doing something unless they see the operations they were designed to look for (compare to agents and critics) when-requested procedures ---> overwrite slot values; examples: - when a value for the Hobby slot of an Athlete is requested ----> return exercise - when a value for the Hobby slot of an Dwarf is requested ----> * if the dwarf s Personality slot is filled with Shy, return reading * otherwise, return dancing Eisenberg/Fischer 17

More Demons when-read procedures and when-written procedures ----> maintain consistency - when a value is written in the Physique slot of an Athlete ----> if the new value is Muscular, write Large in the Athlete s Appetite slot with-respect-to procedures deal with perspectives - when a value for the size slot of Blimpy, from the perspective of a typical dwarf, is requested ----> Return Big - when a value for the size slot of Blimpy, from the perspective of a typical person, is requested ----> Return Small with-respect-to procedures deal with contexts - when a value for the Mood slot of Patrick, in the context of Mountain Hiking, is requested ----> Return Happy - when a value for the Mood slot of Patrick, in the context of Airplane Travel, is requested ----> Return Grumpy Eisenberg/Fischer 18

Frame Systems A frame system is a representation that is a semantic net in which The language of nodes and links is replaced by the language of frames and slots. Ako slots define a hierarchy of class frames. Is-a slots determine to which classes an instance frame belongs. Various when-constructed, when-requested, when-read, when-written, and with-respect-to procedures supply default values, override slot values, and maintain constraints. A precedence procedure selects appropriate whenconstructed, when-requested, when-read, when-written, and with-respect-to procedures by reference to the class hierarchy. With constructors that Construct a class frame, given a list of superclasses, and a list of slots Construct an instance frame, given a list of direct superclasses Construct a when-requested, when-read, when-written, or with-respect-to procedure With writers that Establish a slot's value, given an instance, a slot, and a value With readers that Produce a slot's value, given an instance and a slot Eisenberg/Fischer 19

When-Applied Procedure procedures helping to perform an action in a manner suited to the object acted on example: To eat when Soup is to be eaten ----> use a big spoon. To eat when Salad is to be eaten ----> use a small fork. To eat when the Entree is to be eaten ----> use a big fork and a big knife. overwrite inheritance: To eat when the Entree is Lobster ----> use a tiny fork and a nutcracker Eisenberg/Fischer 20

Example: Digesting News Frame Retrieval and Slot Filling To fill the Time slot when a new Event is constructed, find a number with a colon in it and write it in the slot. To fill the Fatalities slot when a new Disaster is constructed, find an integer near a word with a root such as kill or die, and write it in the slot. To fill the Damage slot when a new Disaster is constructed, find a number next to a dollar sign, and write it in the slot. To fill the Magnitude slot when a new Earthquake is constructed, find a decimal number between 1.0 and 10.0, and write it in the slot. Other simple procedures can fill in nonnumeric slots: - To fill the Day slot when a new Event is constructed, find a word such as today, yesterday, tomorrow, or the name of one of the days of the week, and write it in the slot. - To fill the Place slot when a new Event is constructed, find a name that appears in a dictionary of geographical places and write that name in the slot. - To fill the Fault slot when a new Earthquake is constructed, find a proper name near the word fault and write it in the slot. Eisenberg/Fischer 21

Analyzing Stories with Title Evoking Earthquake Frame Earthquake Hits Lower Slabovia Today, an extremely serious earthquake of magnitude 8.5 hit Lower Slabovia, killing 25 people and causing $500 million in damage. The President of Lower Slabovia said that the hard-hit area near the Sadie Hawkins fault has been a danger zone for years. Earthquake Summary Pattern An earthquake occurred in <value in Location slot> <value in Day slot>. There were <value in Fatalities slot> fatalities and $<value in Damage slot> in property damage. The magnitude was <value in Magnitude slot> on the Richter scale; the fault involved was the <value in Fault slot>. Instantiated Earthquake Summary Pattern An earthquake occurred in Lower Slabovia today. There were 25 fatalities and $500 million in property damage. The magnitude was 8.5 on the Richter scale; the fault involved was the Sadie Hawkins. Earthquake Study Stopped Today, the President of Lower Slabovia killed 25 proposals totaling $500 million for research in earthquake prediction. Our Lower Slabovian correspondent calculates that 8.5 research proposals are rejected for every one approved. There are rumors that the President's science advisor, Sadie Hawkins, is at fault. Eisenberg/Fischer 22

SUMMARY A frame system can be viewed as a generalized semantic net. When you speak about frames, however, your language stresses instances or classes, rather than nodes, and stresses slots and slot values, rather than links and link destinations. Inheritance moves default slot values from classes to instances through the activation of the appropriate when-constructed procedure. To determine which when-constructed procedure dominates all other applicable when-constructed procedures, you have to convert a class hierarchy into a class-precedence list. Generally, the conversion should be such that each class appears before all that class's superclasses and each class's direct superclasses appear in order. When-requested procedures override slot values. When-read and when-written procedures maintain constraints. With-respectto procedures deal with perspectives and contexts. Digesting news seems to involve inheritance. Your understanding of an earthquake news story, for example, benefits from your knowledge of the connection between earthquakes and disasters and your knowledge of the connection between disasters and events in general. Shared knowledge, located centrally, is easier to construct when you write it down, easier to correct when you make a mistake, easier to keep up to date as times change, and easier to distribute because it can be distributed automatically. Eisenberg/Fischer 23