UIUC CS 497 - Object Oriented Programming and Design

Unformatted text preview:

1Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 1CS497REJObject-OrientedProgramming and DesignRalph Johnson - 3109 DCL [email protected]://st-www.cs.uiuc.edu/users/johnson/Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 2Goals• Learn how to model world withobjects• Learn how to design for reuse• Learn Smalltalk•Learn a set of tools andcomponents•Learn a new culture• Have fun2Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 3Why Objects?A new way to think about softwareIndustrial revolution -- reuse software, notrewriteIncrease• programmer productivity• quality of software• understandability of software• lifetime of softwareObject-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 4The Software LifecycleWhat is important?maintainabilityextensibilityunderstandabilityAnalyzeDesignConstructTestMaintain3Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 5Old ParadigmComputer system consists of dataand programs.Programs manipulate data.Programs organized by• functional decomposition• dataflow• modulesObject-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 6New ParadigmComputer system consists of a set of objects.Objects are responsible for knowing and doingcertain things.Objects collaborate to carry out theirresponsibilities.Programs organized by classes, inheritancehierarchies and subsystems4Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 7What is an object, anyway?Mystical viewComputing systems are made up ofobjects that communicate only bysending messages between eachother. All computation is messagesending.Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 8What is an object, anyway?Scandinavian viewA program is a simulation. Each entityin the system being simulated isrepresented by an entity in theprogram.5Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 9What is an object, anyway?Programming language viewAn object-oriented system ischaracterized by• data abstraction• inheritance• polymorphism by late-binding ofprocedure callsObject-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 10Heart of Object-OrientedProgrammingDon't make a new language, extend your oldone.Objects should be abstractions of problemdomain.6Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 11ModelingAll phases of software life-cycle are modeling• analysis - modeling of problem• design - modeling of solution• implementation - making model run on acomputer• maintenance - fixing/extending yourmodelObject-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 12Assumption about ModelingBasing system design on structure ofproblem makes system• more reusable• more extensible7Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 13ModelingClaim: people model the world with "objects"• objects• classes• relationships between objects• relationships between classesObject-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 14ModelingAdvantages of object-oriented softwaredevelopment• more natural - matches the way peoplethink• single notation - makes it easy to movebetween software phases8Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 15Objects and RelationshipsJohn is Mary’s father. Mary is John’sdaughter.Bob is Mary’s dog. Mary is Bob’s owner.Ann is John’s employer. John is Ann’semployee.Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 16Objects and AttributesJohn’s name is "John Patrick O’Brian".John’s age is 27.John’s address is 987 N. Oak St,Champaign IL 61820What about John’s employer? John’s wife?What is an attribute, and what is arelationship?9Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 17Objects and BehaviorJohn goes on a trip.John makes reservations.John buys tickets.John travels by airplane.John checks into hotel.Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 18What Really is an Object?Reservation -- a promise to giveservice to a customerTicket -- proof that customer has paidfor service in advanceFlightPayment -- an event (transaction?) inwhich money is exchanged10Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 19What Really is an Object?Anything we can talk about can be an object,including relationships ("the husband of thefirst party", "first-born son").What are we trying to model?Models should be as simple as possible, butno simpler.Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 20ClassificationWe naturally put objects into classesthat have similar characteristics.• John is a man.• Mary is a woman.• Bob is a dog.• All women are people.• All people are mammals.MammalsDogsPeopleMenBobJohnWomenMary11Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 21Classification• John is an employee.• John is a father.• John is a sky-diver.• John is under 30.Is John an instance of Employee, Father,Sky-diver, and Under30?Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 22SummaryObjects• have identity• have attributes• have behavior• have relationships with otherobjects12Object-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 23SummaryClasses• describes the attributes, behavior, andrelationships of a set of objects• subclasses/superclasses form graphof generalizationsObject-oriented Programming and Design - Copyright 1998 by Ralph E. Johnson 24HomeworkFor details, look on home page.http://st-www.cs.uiuc.edu/users/johnson/cs497Purpose: Start reading textbook, startusing VisualWorks.Due at next


View Full Document

UIUC CS 497 - Object Oriented Programming and Design

Download Object Oriented Programming and Design
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Object Oriented Programming and Design and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Object Oriented Programming and Design 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?