Instances and Classes. SOFTWARE ENGINEERING Christopher A. Welty David A. Ferrucci. 24 Summer 1999 intelligence

Similar documents
What s in an Instance?

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

The Notion of Inheritance in Object-Oriented Programming

Chapter 8: Enhanced ER Model

COMMOM OBJECT ORIENTED LISP SYSTEMS

A Java Execution Simulator

6.001 Notes: Section 4.1

Algebraic Specifications

Exam in TDDB84: Design Patterns,

SOME TYPES AND USES OF DATA MODELS

COMP219: Artificial Intelligence. Lecture 14: Knowledge Representation

Annotation Science From Theory to Practice and Use Introduction A bit of history

Knowledge representation Semantic networks and frames

Chapter 4. Enhanced Entity- Relationship Modeling. Enhanced-ER (EER) Model Concepts. Subclasses and Superclasses (1)

Specification of Content-Dependent Security Policies

Interaction Design

Deep Integration of Scripting Languages and Semantic Web Technologies

Lecture 5: The Halting Problem. Michael Beeson

Alan J. Perlis - Epigrams on Programming

Semantic Web. Ontology Engineering and Evaluation. Morteza Amini. Sharif University of Technology Fall 93-94

The compilation process is driven by the syntactic structure of the program as discovered by the parser

Enhanced Entity-Relationship (EER) Modeling

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Garbage Collection (2) Advanced Operating Systems Lecture 9

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

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

Instances of Instances Modeled via Higher-Order Classes

SOFTWARE ENGINEERING Prof.N.L.Sarda Computer Science & Engineering IIT Bombay. Lecture #10 Process Modelling DFD, Function Decomp (Part 2)

Category Theory in Ontology Research: Concrete Gain from an Abstract Approach

The C++ SoftBench Class Editor

Managing Change and Complexity

THINGS YOU NEED TO KNOW ABOUT USER DOCUMENTATION DOCUMENTATION BEST PRACTICES

Subset sum problem and dynamic programming

M301: Software Systems & their Development. Unit 4: Inheritance, Composition and Polymorphism

21. Document Component Design

Semantic Web. Ontology Engineering and Evaluation. Morteza Amini. Sharif University of Technology Fall 95-96

Rational Number Operations on the Number Line

CHAPTER. Knowledge Representation

Write a procedure powerset which takes as its only argument a set S and returns the powerset of S.

Multi-agent and Semantic Web Systems: Representation

Multi-Paradigm Approach for Teaching Programming

Programming Languages Research Programme

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

CPS122 Lecture: The User Interface

CS211 Lecture: The User Interface

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

VISUALIZING NP-COMPLETENESS THROUGH CIRCUIT-BASED WIDGETS

Integration of Product Ontologies for B2B Marketplaces: A Preview

SOFTWARE ENGINEERING DESIGN I

Semantic Nets, Frames, World Representation. CS W February, 2004

Lecture 4 CSE July 1992

CS103 Spring 2018 Mathematical Vocabulary

A macro- generator for ALGOL

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class

David K. Mellinger; G. E. Garnett; Bernard Mont-Reynaud. Computer Music Journal, Vol. 13, No. 2. (Summer, 1989), pp

Slide 1 Welcome to Fundamentals of Health Workflow Process Analysis and Redesign: Process Mapping: Entity-Relationship Diagrams. This is Lecture e.

Meta Information Concepts for Environmental Information Systems

Propositional Logic. Part I

Designing a System Engineering Environment in a structured way

Contextion: A Framework for Developing Context-Aware Mobile Applications

Chapter 9: Dealing with Errors

6.001 Notes: Section 15.1

Utility Maximization

Sentiment analysis under temporal shift

Reasoning and writing about algorithms: some tips

Chamberlin and Boyce - SEQUEL: A Structured English Query Language

Recursively Enumerable Languages, Turing Machines, and Decidability

Common Lisp Object System Specification. 1. Programmer Interface Concepts

More Notes on 'A Clash of Intuitions 9

Representing Symbolic Reasoning

Knowledge Sharing Among Heterogeneous Agents

IBM Research Report. The Semantics of Multiple Annotations

JASMINT: Language to User-Friendly AST with Emphasis on Transpilation. By: John Bradbury. Advisor: John Clements. Computer Science Department

Computation Club: Gödel s theorem

Integer Construction by Induction

such a manner that we are able to understand, grasp and grapple with the problem at hand in a more organized fashion.

Computer Science 210 Data Structures Siena College Fall Topic Notes: Recursive Methods

CPS331 Lecture: Fuzzy Logic last revised October 11, Objectives: 1. To introduce fuzzy logic as a way of handling imprecise information

Evaluation of Predicate Calculus By Arve Meisingset, retired research scientist from Telenor Research Oslo Norway

Chapter No. 2 Class modeling CO:-Sketch Class,object models using fundamental relationships Contents 2.1 Object and Class Concepts (12M) Objects,

An Ontological Analysis of Metamodeling Languages

3 ADT Implementation in Java

FOR Loops. Last Modified: 01 June / 1

Section 2.4: Arguments with Quantified Statements

Data Access Request Form

Programming Languages Third Edition. Chapter 10 Control II Procedures and Environments

BCS THE CHARTERED INSTITUTE FOR IT. BCS Higher Education Qualifications BCS Level 6 Professional Graduate Diploma in IT EXAMINERS' REPORT

Object-Oriented Thinking

6.001 Notes: Section 17.5

p x i 1 i n x, y, z = 2 x 3 y 5 z

Semantic Analysis Type Checking

Inherence and Nonsubstantial Particulars: An Object-Oriented View Samuel H. Kenyon

Week - 04 Lecture - 01 Merge Sort. (Refer Slide Time: 00:02)

Business Process Framework (etom)

4.2 Variations on a Scheme -- Lazy Evaluation

Testing is a very big and important topic when it comes to software development. Testing has a number of aspects that need to be considered.

Let s briefly review important EER inheritance concepts

Specific Proposals for the Use of Petri Nets in a Concurrent Programming Course

2 Which Methodology for Building Ontologies? 2.1 A Work Still in Progress Many approaches (for a complete survey, the reader can refer to the OntoWeb

KNOWLEDGE MANAGEMENT VIA DEVELOPMENT IN ACCOUNTING: THE CASE OF THE PROFIT AND LOSS ACCOUNT

Transcription:

Instances and Classes in SOFTWARE ENGINEERING Christopher A. Welty David A. Ferrucci 24 Summer 1999 intelligence

Software Engineering Over the past decade or so, one of the many areas that artificial intelligence has influenced is software engineering. Although artificial intelligence cannot lay a particular claim to such notions as taxonomies, relational models, activity/state diagrams, inheritance, or other techniques that are now part of mainstream software engineering, CASE, and database design, it is within the purview of AI that they were developed. Along the way from artificial intelligence to software engineering, some of these notions lost their meaning. Within the past 10 years, object-oriented analysis and modeling has led to significant improvements in productivity in the earlier phases of software engineering (such as requirements, design, and implementation). These improvements have been facilitated in part by the emergence of tools to support the process and languages such as UML for supporting partly standardized diagrams. The foundations of object-oriented modeling derive from philosophy through artificial intelligence to software engineering. In philosophy, the fields of epistemology and ontology have been considering for centuries what is needed to represent things in the world and what it means to do so. Within the past century, the development of first-order logic and, later, computers has significantly sped up and formalized many of these ideas. Knowledge representation (KR) is one of the original subfields of AI, and the study of modeling knowledge in a computer has always been its central theme. The modeling facilities provided by object-oriented languages, and the diagrammatic representation offered by UML and its predecessors, were developed and studied by KR researchers in the 1970s. The purpose of this article is not to claim credit for the success of object-oriented analysis and modeling, but to show how the transfer of this technology from KR to software engineering was not complete. We have encountered numerous examples of classic logical pitfalls in models developed by novices and by experts; with this article we begin what we hope will be a series of articles on the proper use of AI techniques in software engineering. We offer a few simple examples of the limitations of the object-oriented approach for modeling. Let us begin by considering some knowledge about s: An is a kind of bird, and we happen to know a particular,. Object-oriented systems provide two basic modeling primitives that we can use to Christopher A. Welty Vassar College Computer Science Dept. Poughkeepsie, NY weltyc@cs.vassar.edu David Ferrucci IBM Watson Research Center Yorktown Heights, NY ferrucci@us.ibm.com intelligence Summer 1999 25

subclass represent these objects: classes and s. A class describes a set of s, and an describes an object in the real world. In addition to these two primitives, object-oriented systems provide two basic relationships that we can use to help define how these Figure 1. An of a subclass. In object-oriented languages, an of a subclass (i.e. derived class) is also an of the superclass. bird theeagle Figure 2. Object-oriented languages do not support s of s. The result is that domain modelers are forced to work around the semantics of the representation system. Figure 3. One possible workaround is to split the representation of into two objects, one an of and the other a class. What is the relationship between theeagle and? objects relate to each other: subclass and. Using these facilities, we can construct a model of our simple domain, as shown in Figure 1. Even this simple example raises what has always been an interesting idea in KR: When an object is an of a class, and the class is a subclass of some base class, the is also considered an of the base class. This property of object-oriented systems is sometimes mistakenly called inheritance, a misnomer that refers to something else. What makes a bird is the implied semantics of the primitives being used in the model. This is one of the gray areas that is not typically taught as part of any introduction to object-orientation. The original semantics of a class is as a set, the set of all s of that type. A class definition includes a description that applies to all members of the set. The subclass relationship is actually the inverse of a subsumption relationship (i.e. subsumedby), which from the logic of sets means simply subset. In other words, according to our model the set of all s is a subset of the set of all birds. We can quickly go from the trivial to the overly complex in our domain by adding the notion of. The proper interpretation of is shown in Figure 2. Technically this is not quite correct an is neither a nor a proper scientific classification of birds at all, but our point is philosophical, not zoological. If we take as a given that is a, then is the set of all, and is a member of that set. In an object-oriented language, however, we cannot represent something that is both an of one class as well as a class itself. It is important to understand that Figure 2 shows the correct representation of the relationships among,, and. Given a domain such as this, how can we represent it using object-oriented modeling? Figure 3 shows one approach that breaks the class into two parts: one is an of, the other is a class of which is an. The has properties like the Boolean 26 Summer 1999 intelligence

Software Engineering endangered ; the class describes the properties of s in general, such as sharp beak. This approach is within the power of object modeling to represent; however, the model in Figure 3 does not capture the true nature of the domain it completely ignores the fact that the class and the refer to the same thing. Another approach is shown in Figure 4. This is the most common solution we have come across when even experienced modelers are presented with this kind of problem. It is also the most incorrect solution. Although the approach shown in Figure 3 does not capture all the domain knowledge, it does not add anything that is incorrect. In Figure 4, by virtue of the semantics discussed earlier, we have made an of, which is certainly not correct. This is a fairly simple example of a common problem that arises in domain modeling and cannot be properly addressed in an object-oriented model. We should note that this is not an academic thought-problem, but in fact prototypical of a class of problems that crop up quite frequently. For example, consider a domain model for a debugger. Figure 5 shows some of the objects in the domain that would need to be modeled. The debugger will need to know about data types and variables since they are part of the code, and it will also need to keep track of the relationship between variables and their data types. Again, the proper way to represent this is shown in Figure 5. Some dynamic object languages, such as Smalltalk and Common Lisp Object System (CLOS), allow one exception to the rule that s cannot be classes. In these systems, every class is an of the special class class. Classes can have two parts (see Figure 6) a meta-class that contains properties of the class that are not passed down to s, and the normal description. However, using the meta-class facility is not a solution to the problem we outlined earlier, because classes are allowed to be s of only one class: the class class. Therefore, we cannot represent the object or have a data-type class whose s are themselves classes that can have s. Figure 7 illustrates this problem. To gain a better understanding of this problem and how to recognize it, we have to subclass Figure 4. A more obviously incorrect workaround is to make a subclass of instead of an, which results in being a. data-type stack variable stack-01 Figure 5. The problem with modeling multiple levels of instantiation does not only occur in hypothetical environmental domains. In this example, we are trying to model the objects used in a debugger, which needs to keep track of the data-types defined in a program, and the variables that instantiate those data-types. class meta-class class-01 object object-01 Figure 6. Smalltalk, CLOS, and other dynamic object languages provide a meta-class facility that provides for the capability to represent a class as both an and a class. Class descriptions are separated into two parts one describes the properties of s of the class, the other describes the properties of the class itself. intelligence Summer 1999 27

class Figure 7. The meta-class facility is not a solution to our trivial modeling problem, because the interpretation of a class as an is only permitted as an of class. The class cannot be an of. bad driver PERMISSION TO MAKE DIGITAL OR HARD COPIES OF ALL OR PART OF THIS WORK FOR PERSONAL OR CLASSROOM USE IS GRANTED WITHOUT FEE PROVIDED THAT COPIES ARE NOT MADE OR DISTRIBUTED FOR PROFIT OR COMMERCIAL ADVANTAGE AND THAT COPIES BEAR THIS NOTICE AND THE FULL CITATION ON THE FIRST PAGE. TO COPY OTHERWISE, TO REPUBLISH, TO POST ON SERVERS OR TO REDIS- TRIBUTE TO LISTS, REQUIRES PRIOR SPECIFIC PERMISSION AND/OR A FEE. ACM 1523-8822 99/0600 $5.00 meta-class person John Doe object good driver John Doe @ 16 John Doe @ 30 Figure 8. Even objects that most experienced modelers agree are clearly s, such as a person, can still cause modeling problems. In this example, an insurance company may want to track a person s driving record over time. Clearly John Doe at 30 is a new man. revisit logic. In fact, problems such as these were discussed almost a century ago by the first logicians as they experimented with their new tool (formal logic). Once again, a class is normally interpreted as a set, and in predicate logic sets are represented as unary predicates, for example, Eagle(). This implies that to represent s as a kind of we would have to say Species(Eagle). The problem with this expression is that the symbol Eagle has already been used as a predicate, therefore the statement Species(Eagle) is a predicate of a predicate. Predicating a predicate symbol is the definition of second order in logic. Secondorder logic is highly complex and computationally intractable. The point we wish to express is that objectoriented languages are first order. Modelers using this technology should be aware of this and should understand the semantics of the primitives (classes, s, and the subclass and relationships). They should also be familiar with the standard and well-known pitfalls of first-order systems so they can avoid making confusing or costly mistakes. Finally, there is a related problem regarding the semantics of s. We suggested here that s are to be interpreted as members of sets, and we showed several examples of how the same object can be thought of as both a set and an. A frequent response to this point is that s and data types aside, there are certainly examples of things that are s and always will be. Normally these obvious s are objects that denote real things, such as people or parts of an inventory. A well-known argument in philosophy is that no matter how you slice it, there is always a way to think of anything as a class. We apply this philosophizing to a practical problem, as shown in Figure 8. An insurance company develops a software system to track its customers, and for each customer it maintains a record of whether the customer is a good or a bad driver. The problem with this approach is that when a customer changes from good to bad (or vice versa), the old classification information is lost. The insurance company decides to change its model and keep track of information about people over time. One way to approach this is to think of each person, such as John Doe in Figure 8, as a class whose s represent the way a person was at a certain age. Once again we have a model that seeks to represent s of s, and one that gives new meaning to the expression, I m a new man. 28 Summer 1999 intelligence