are you in the right course? software engineering 430 object oriented modeling september 10, 2015se...
TRANSCRIPT
Are you in the right course?Are you in the right course?
Software Engineering 430
Object Oriented Modeling
September 10, 2015 SE 430: Lecture 1 1 of 94
SE 430 SE 430 Object Oriented ModelingObject Oriented Modeling
Dennis Mumaugh, Instructor
Office: CDM, Room 432
Office Hours: Thursday, 4:00 – 5:30
September 10, 2015 SE 430: Lecture 1 2 of 94
Administrivia: IntroductionAdministrivia: IntroductionDennis Mumaugh
Undergraduate: BSEE – University of California, BerkeleyMS Computer Science – University of MarylandPh.D. Studies – University of MarylandTeaching at DePaul since September 2000
WorkSenior Engineer – National Security Agency
ARPANet Pioneer, Unix™ Technology TransferMember of the Technical Staff – Bell Labs/Lucent Technologies
Unix Development – Current EngineeringIS&R Systems – Knowledge Based SystemsSoftware Tools and OO Technology
InterestsOperating Systems and System ProgrammingSoftware Productivity, Compilers and Software MetricsSoftware Engineering
September 10, 2015 SE 430: Lecture 1 3 of 94
Administrivia: Basic InformationAdministrivia: Basic Information Contact Information:
Email: [email protected] Phone: 630-983-1221 (10:00 am - 11:00 pm) except just before
class (After 3pm) Office Hours
Thursday: 4:00 pm to 5:30 pm, Loop, CDM, Room 432 By arrangement
September 10, 2015 SE 430: Lecture 1 4 of 94
Administrivia: Basic InformationAdministrivia: Basic Information Class home page
http://condor.depaul.edu/dmumaugh/classes/SE430F16, contains syllabus and schedule, lecture notes, homework, more reading material
About the Lecture Notes – look at “notes” section of the slides Also look at the expanded readings page:
http://condor.depaul.edu/dmumaugh/readings/SE430readings.html
Desire2Learn: Course materials, assignments, assignment submissions,
assignment solutions, examinations and quizzes and grades will be available on the Desire2learn – https://d2l.depaul.edu/
September 10, 2015 SE 430: Lecture 1 5 of 94
Administrivia: Basic Information Administrivia: Basic Information Email
All students are expected to have a email address. Please make sure it is valid and make sure Campus Connection
has the current email address. Course mailing list:
[email protected] To subscribe to the list or unsubscribe from it, go to
http://mailman.depaul.edu/mailman/listinfo/se430.» I’ll bulk subscribe on Wednesday.
If necessary, update your spam filter to accept messages from the mailing list.
Unless your message is personal, send it to the course mailing list! Last minute information will go to the mailing list
September 10, 2015 SE 430: Lecture 1 6 of 94
Administrivia: reading materialsAdministrivia: reading materialsTextbooksArlow, Jim and Neustadt, Ila (2005). UML 2 and the Unified Process, Second Edition: Practical Object-Oriented Analysis and Design. Addison-Wesley, ISBN 0-321-32127-8.Deemer, Pete, Benefield, Gabrielle, Larman, Craig, and Vodde, Bas (2012). The Scrum Primer: A Lightweight Guide to the Theory and Practice of Scrum, Version 2.0. Download available free at
http://www.scrumprimer.org/.
Another book you may wantUML Distilled: A Brief Guide to the Standard Object Modeling Language, Third Edition, Martin Fowler (with Kendall Scott), Addison-Wesley Prof./Pearson, 2003. ISBN: 978-0321193681
September 10, 2015 SE 430: Lecture 1 7 of 94
Administrivia: reading materialsAdministrivia: reading materials A note on reading list
You are not expected to read all of the material on the reading list. Look at the various articles as you have time.
» Many say the same thing but with a different perspective. Don't get overwhelmed in reading
September 10, 2015 SE 430: Lecture 1 8 of 94
Administrivia: Course structureAdministrivia: Course structure Ten classes + Midterm Exam + team project + Final Exam Weekly reading, assignments (7) and critique. Common domain problem (The Museum Automation
Problem) for examples and for assignments. Team project:
Choose topic and get approval by October 22. Deliver end of classes (November 19)
Class structure: lecture (with short break near the middle). Topics and reading assignments are on the class web page
September 10, 2015 SE 430: Lecture 1 9 of 94
Administrivia: required softwareAdministrivia: required software Access to MS Word. Access to a drawing program such as Visio (see next slide). Useful:
Commercial CASE tools:» Rational Rose» Together Soft» See reading list for URLs and pointers
Freeware CASE Tool» Poseidon for UML: http://www.gentleware.com
September 10, 2015 SE 430: Lecture 1 10 of 94
Administrivia: Diagramming resourcesAdministrivia: Diagramming resourcesSee readings list on CASE tools for more details A good, free, fully-featured UML modeling tool is Poseidon for UML
Community Edition Available at www.gentleware.com (free registration required) To export a diagram, go to File Save Graphics… I recommend using the Portable Network Graphics format (.png).
Do NOT use JPEG—it obliterates fine details in a diagram You can get Microsoft Visio 2003 for free at:
https://my.cdm.depaul.edu/resources/msdnaa.asp Instructions are at the bottom of the page
You can directly embed Visio diagrams in Word documents Visio 2003 has UML drawing templates
Apple Macintosh users have some resources as well OmniGraffle is a high quality drawing tool with UML diagrams UseCaseBench is a tool for developing use cases.
September 10, 2015 SE 430: Lecture 1 11 of 94
Administrivia: MiscellanyAdministrivia: Miscellany Communications development:
An essential part of this course is communicating your ideas in prose, as well as in technical graphical artifacts.
The ability to communicate clearly and effectively is a skill that will pay off both in and out of class.
Motivation from a recent NPR business report:» Robert Half surveyed their corporate customers concerning
resumes they had received.» Corporate reviewers spent about 10-15 seconds deciding
whether to examine the resume further.» They instantly tossed the resume if they detected any
grammatical or spelling errors. Treat your coursework as if it were being reviewed by the manager
who does your performance review and sets your salary.
September 10, 2015 SE 430: Lecture 1 12 of 94
Administrivia: MiscellanyAdministrivia: Miscellany There will be a lot of ambiguity and lack of firm direction in the
assignments and the information. That is typical of much of engineering. This requires you to provide your own experience. Or to research
and discover your information. Using previous solutions/techniques will not necessarily work. You
may have to invent something. Understanding a problem (statement):
An essential part of this course is understanding written material, ideas in prose. The ability to understand a document, to "read between the lines", is a skill that will pay off both in and out of class.
Areas of concern: Projects are implemented with the wrong features. Students answer the wrong question on a test. People confuse the subsystems of a design. People do not read, really read things.
September 10, 2015 SE 430: Lecture 1 13 of 94
Administrivia: MiscellanyAdministrivia: Miscellany Intellectual property issues:
All material in this course is property of either the instructor or Harold Streeter.
You are permitted to download and print copies of the material. You are not permitted to redistribute the material in any form.
Plagiarism: All individual assignments must represent your own work. It's a great idea to get together in study groups to discuss the
problems, but you should then do the assignments individually. Plagiarism is to take and use as one’s own, or copy without
acknowledgement, the works of another person. The provider of such material can be ruled equally culpable.
If you hand in late homework with prior permission, it must be your own work, not a copy of the solutions presented in class.
September 10, 2015 SE 430: Lecture 1 14 of 94
Administrivia: SupportAdministrivia: Support Technical questions can be addressed during office hours or
by email Use the mailing list for all technical questions
Provide appropriate support to each other I do not preview homework, but I will answer questions or
make suggestions to generic problems If you contact me by e-mail
Please include your name and the course number in all correspondence
September 10, 2015 SE 430: Lecture 1 15 of 94
Administrivia: Feedback/ParticipationAdministrivia: Feedback/Participation Feedback/Participation
Share your thoughts Ask questions – wave your hand forcefully to get my
attention Speak loudly so all can hear Give me verbal and non-verbal feedback Don't just sit there . . . nod, smile, frown, shake your head
Make sure your email address is correct and works
September 10, 2015 SE 430: Lecture 1 16 of 94
Administrivia: assessmentAdministrivia: assessment Regular assignments (7) + critique A team/term project Midterm examination Final examination Each of the above will be weighted as follows:
Homework 30% Midterm Exam 20% Term paper activities 30% Final Examination 20%
Grading will be done on the usual 60/70/80/90 bands but will be adjusted to account for clustering and banding of scores. Bands may be adjusted if there seems to be a systemic bias to the scores.
September 10, 2015 SE 430: Lecture 1 17 of 94
Homework logisticsHomework logistics Homework must be submitted via Desire2Learn by 11:59 PM Chicago
Time on the assignment due date. Submit MS Word or Adobe PDF files only [I accept either format of
MS Word] All figures must be embedded in the file, not bundled in a ‘.zip’ file
No extra credit assignments.
September 10, 2015 SE 430: Lecture 1 18 of 94
Team project logisticsTeam project logistics All students must work in a team on the final project There is no option for individual final projects Project teams will be chosen by the Week 3 class. On-line
students will be part of the team. This means you will need to devise ways of working with remote members.
September 10, 2015 SE 430: Lecture 1 19 of 94
IntroductionIntroduction Roll On-line students: you must send me an email confirming
that you are taking the course. The email must include the “magic word” – that is: ______________ You must confirm attendance by September ??.
You are welcome to send a message to the mailing list with (after it is in place) Your Background Day Job (if any) Major Project Management Experience Industry Experience Optional: Expectations & goals from the class
September 10, 2015 SE 430: Lecture 1 20 of 94
Course goalsCourse goals Learn techniques for analyzing a problem Use patterns and UML notation to formalize solutions. Provide the background and skills needed to solve software
engineering problems using object-oriented techniques. Present techniques and practices suitable for complex,
large-scale systems. Develop an understanding of object oriented concepts Solidify and apply knowledge of core O-O concepts. Develop skills in a practical O-O analysis and design
process which: Uses the industry-standard UML notation Uses the most effective parts of the Unified Process methodology. May be used ‘as is’ or tweaked for effectiveness.
September 10, 2015 SE 430: Lecture 1 21 of 94
Course objectivesCourse objectivesAfter taking this course, the student should be able to Read and understand some of the basic object oriented
modeling notations (especially UML) Analyze simple problems using use cases and the CRC
card techniques Create a list of the responsibilities or services that describe
the external interface of a class Describe the interactions between objects Use simple state machines to model the time-dependent
behavior of a class Create examples of classes where inheritance is useful in
an object oriented design Develop models for a problem
September 10, 2015 SE 430: Lecture 1 22 of 94
Goals and ObjectivesGoals and ObjectivesA good programmer, using whatever language, needs to be able to think
in terms of levels-of-abstraction and reason in an orderly way. However, there are other criteria, too.
We could add,
The ability to see patterns
The ability to decompose a design into appropriate modules
The ability to know when to generalize or specialize a design artifact
The ability to know what to eliminate from a design
The ability to keep a design simple, understandable, maintainable, and readable
Programming is a human activity. Knuth makes the point that we need to write software that is readable by other humans rather than focus so intensely on programs that are targeted to the machine.
September 10, 2015 SE 430: Lecture 1 23 of 94
Engineering MethodologyEngineering MethodologyWhat is engineering and how does it differ from science?
Engineering is the application of science to the needs of humanity. This is accomplished through the application of knowledge, mathematics, and practical experience to the design of useful objects or processes in a cost effective way.
One of the objectives of this course is to teach some of the methodology of engineering Understanding the problem How to approach a problem Developing and following requirements Writing and reading specifications Analyzing a problem Designing a solution Verifying each step Testing the design against the original problem statement
September 10, 2015 SE 430: Lecture 1 24 of 94
Surviving SE430Surviving SE430 Make sure you read things, sometimes more than once. People do not seem
to read assignments and web pages (or do not follow instructions). The pace is quick. The intent of the course is to learn by doing, not by reading;
but there is a lot of information to process. Read the assignments carefully. Note special requirements, such as formats and
use of predefined templates! Start your assignments right after they are handed out (assigned). They will take
some time and starting on the night before it is due is not a good strategy. Reading list:
Is it required? No. Is it useful? Yes, especially if you are serious about a career in software
development. The articles are usually short but informative. Most are supplemental –
useful for understanding but the notes cover the major points. Reading should be done in parallel with the lectures. Pace yourself. Remember: “This too shall pass.”
September 10, 2015 SE 430: Lecture 1 25 of 94
SE 430 – Class 1SE 430 – Class 1Topics: Introduction and Overview
Course Logistics and Administrivia Important Object-Oriented Concepts Software Development Life Cycle Object-Oriented Analysis & Design and the Unified Process
Reading: Arlow & Neustadt: Preface; Ch. 7, Ch's 1-2 Phillip G. Armour, "Twenty Percent: Planning to fail on software
projects", CACM, Vol 50, No. 6 (June 2007), pp. 21-23. (local mirror) Core Object Principles in OO Programming (Thinking with Objects)
Review concepts and vocabulary in this lecture and be sure you understand them. We’ll be using them extensively throughout the quarter
September 10, 2015 SE 430: Lecture 1 26 of 94
Preliminary AssignmentPreliminary Assignment Review concepts and vocabulary in this lecture and be sure you
understand them. We’ll be using them extensively throughout the quarter.
Start understanding the domain information we will use for the class: Start reading the Museum Automation Problem Description and the Mobile Guide.
» Much of this is general knowledge and not new.
September 10, 2015 SE 430: Lecture 1 27 of 94
AssignmentsAssignmentsCritique – Due at the end of the term Students must write and submit a brief critique of their own work on the
assignments after reviewing the sample solution(s). The critique is due at the end of the term. The assignment critiques (taken together) will count as one homework assignment.
September 10, 2015 SE 430: Lecture 1 28 of 94
Thought for the DayThought for the Day
"Object technology means object-oriented thinking; shifting to object-centered development requires
adopting new; discarding old ways."
"The most important aspect of the system that must be object oriented is the thinking of the design team."
September 10, 2015 SE 430: Lecture 1 29 of 94
Important Object Oriented Important Object Oriented ConceptsConcepts
September 10, 2015 SE 430: Lecture 1 30 of 94
ObjectObject Objects
The most basic concept in an OO language is that of an object. Objects communicate by calling each other's methods. This concept
is called messaging. Objects provide services and have responsibilities.
An object consists of three things State Behavior Identity
A class is the template from which objects are made Classes have responsibilities A class without responsibilities (or operations) is not really a class
September 10, 2015 SE 430: Lecture 1 31 of 94
ObjectObject An object has
State [Attributes|Data] Behavior [Responsibilities|Operations|Methods] Identity [Handle|Reference]
An object Owns its data Is responsible for the data's processing
An object should embody one abstraction An object should do one thing and do it well.
September 10, 2015 SE 430: Lecture 1 32 of 94
O-O building blocks: types, classes, and objects O-O building blocks: types, classes, and objects
A type is an idealized description of an entity It specifies the interface (externally
visible behavior) for the entity It does not deal with the entity’s internal
structure (implementation) Example: A software product customer
A class represents a particular realization (implementation) of a type A class defines mechanisms for
behavior of a type Example: A customer
A class acts as a template for defining instances of the class (objects) Example: Erasmus Darwin, a customer
for three software products, all with support contracts
September 10, 2015 SE 430: Lecture 1 33 of 94
Types, classes, and objectsTypes, classes, and objects Types define interfaces, a class is an implementation of a type.
A type specifies the externally visible interface for an entity, but does not deal with its implementation
Classes act as abstract templates for producing instances (objects). A class represents an implementation of a type and acts as an abstract
template for producing instances (objects) via constructors Every object is an instance of a class. A class has zero or more instances
» Example: Consider static class members in Java Class issues are static: attributes (fields), interfaces, and relationships
Objects are dynamic: creation, attribute values, collaborations, and destruction.
Conceptual overlap among types, classes, and objects allows us to sometimes speak of their characteristics interchangeably, what the UML refers to as type-instance correspondence
September 10, 2015 SE 430: Lecture 1 34 of 94
Class and object characteristicsClass and object characteristics Every object is an instance of a class—it must have a generating class A class has zero or more instances
Example: Consider how static class members in Java allow one to build a class that requires no instances
Class characteristics are static: their attributes, behavior, and relationships are defined and fixed for all instances Examples: Attributes (e.g., Java fields), interfaces, and relationships
Objects are dynamic: they are created, have varying attribute values and collaborations, and they can be destroyed Example: Erasmus Darwin became a customer; he can add or delete
products or change their contract status; he can terminate his relationship with the company
September 10, 2015 SE 430: Lecture 1 35 of 94
Types, classes, and objectsTypes, classes, and objects Type distinguishes among kinds of objects; its purpose is to
control what values can be assigned to variables or used in operations
Most popular object-oriented programming languages do not distinguish between types and classes
Distinctions between types and classes do become important when discussing generalization/specialization and the related topic of inheritance.
September 10, 2015 SE 430: Lecture 1 36 of 94
Essential components of O-O paradigmEssential components of O-O paradigm
Analysis-oriented
Im plem entation-oriented
Entity-level
System -level
Abstraction: captures essential behavioral characteristics.
Encapsulation: hides behavioral mechanisms.
Hierarchy: structures abstractions.
Typing: enforces type of object.
Modularity: decomposes a system into manageable pieces.
September 10, 2015 SE 430: Lecture 1 37 of 94
Core Object PrinciplesCore Object Principles Encapsulation
Encapsulation revolves around the principle of exposing only as much information about an object as is absolutely necessary.
Two forms of encapsulation » "implementation hiding" » "information hiding.”
Interfaces An interface is a contract specifying what properties and behaviors
an object will support. Interfaces allow the processing of objects based on a type rather
than a class.
September 10, 2015 SE 430: Lecture 1 38 of 94
AbstractionAbstraction Captures essential behavioral characteristics of a domain
entity. Communicates what an entity does, not how it does it. Abstraction detail level depends upon viewer perspective. Good abstraction follows the ‘just right’ principle: it
captures entire behavior of an entity, no more and no less. Alternative statement: An effective abstraction captures
all the necessary and sufficient characteristics of an entity
September 10, 2015 SE 430: Lecture 1 39 of 94
AbstractionAbstraction Quality of abstraction ranges from:
Most-desirable entity-level (useful model); a cohesive set of related characteristics and responsibilities to:» Example: Individual tools in a Swiss Army knife.» Example: Current java.util.Date
Least-desirable coincidental (convenient packaging); (possibly unrelated) characteristics and responsibilities» Example: The whole knife itself. » Example: JDK 1.0 java.util.Date
Practice suggestion: Employ a ‘pay-as-you-go’ approach to abstraction characteristics—take an additive approach rather than a subtractive approach to abstraction characteristics
September 10, 2015 SE 430: Lecture 1 40 of 94
AbstractionAbstraction An abstraction is an essential representation of both the intrinsic and
behavioral characteristics of an entity Intrinsic characteristics are those that are static or relate to the state of
the entity at a given time Example: For a smartphone, size and shape are static, while ‘percent
charge’ relates to the state of the battery and its state varies with time
Behavioral characteristics are dynamic Behavior may be internally- or externally-induced Example: Smartphone generates event reminders internally but dials
phone number in response to (external) user button presses
Outstanding question: How do we determine the essential characteristics of an entity for purposes of abstraction?
Appropriate level of abstraction detail depends upon the specific problem to be solved: the problem requirements and constraints
September 10, 2015 SE 430: Lecture 1 41 of 94
EncapsulationEncapsulation Compartmentalizes elements of an abstraction, separating:
Contractual interface (what the abstraction does). Implementation (how it does it).
Realized by information/implementation-hiding (security) features of a programming language. Example: Java's public, private, and protected modifiers and the
compile- and run-time mechanisms that implement the policies
Enforces dictum: “No part of a complex system should depend on the internal details of any other part.”
September 10, 2015 SE 430: Lecture 1 42 of 94
Encapsulation & abstractionEncapsulation & abstraction Encapsulation and abstraction are complementary notions:
Abstraction defines (or ‘exposes’) the external behavior of an object through the object interface
Encapsulation hides the internal aspects of that behavior from public view
September 10, 2015 SE 430: Lecture 1 43 of 94
Abstraction by specificationAbstraction by specification Provides a concrete approach to achieving the goals of abstraction
and encapsulation Provides behavioral information to allow use of an operation without
looking at its implementation: Preconditions specify what is assumed upon entering the operation Postconditions specify what should be true when the operation
completes, provided the preconditions were satisfied Invariants specify what must always be true externally for an object
Embodied in the principles of design-by-contract as obligations and benefits
Test-Driven Development (TDD) encourages practical application of abstraction by specification
September 10, 2015 SE 430: Lecture 1 44 of 94
HierarchyHierarchy Most complex systems can be modeled as hierarchical in nature Hierarchy is an ordering or structuring of abstractions Two types of hierarchy:
Generalization/specialization (‘is kind of ’ or ‘is-a’ relationships) Aggregation (‘part of ’ or ‘has part ’ relationships)
Aggregation structure: More ‘natural’ hierarchy to develop in the early stages of analysis
and design Reflects readily-observable characteristics of the domain
Do not concentrate on generalization structure hierarchy in the early stages of analysis and design
September 10, 2015 SE 430: Lecture 1 45 of 94
Hierarchy: aggregationHierarchy: aggregation ‘Part of ’ hierarchies describe
aggregation relationships Permits physical grouping of
logically-related structures, often in repeatable patterns
We’ll discuss the different types of aggregation later in the quarter
We’ll discuss an interplay of aggregation and generalization/specialization in a few slides
SmartPhone
Display PDA Core
1
11
1
Keypad
N
Transceiver
Feature Module
1
September 10, 2015 SE 430: Lecture 1 46 of 94
Core Object PrinciplesCore Object Principles Inheritance
Inheritance provides the capabilities for one object to automatically contain attributes and behaviors of another object.
September 10, 2015 SE 430: Lecture 1 47 of 94
Hierarchy: generalization/specializationHierarchy: generalization/specialization One form of hierarchical ordering leads to creation of a
generalization/specialization (‘kind-of’) hierarchy Defines relationships among related types; the subtypes
share the behavioral characteristics of one or more supertypes
A related concept is inheritance: the sharing of code between two classes. A subclass shares the code of its superclass
Most O-O programming languages do not distinguish between subtyping and subclassing
Inheritance only involves sharing of code and does not imply that the subclass is a subtype of the supertype: not all subclasses are subtypes
September 10, 2015 SE 430: Lecture 1 48 of 94
Subtype and Subclass ExamplesSubtype and Subclass Examples Subtypes
A ‘cellular phone’ is a subtype of ‘telephone’ A ‘sailboat’ is a subtype of ‘water transport vessel’ All well-behaved Java classes are subtypes of Object
Subclasses A child is a subclass of its two parents A speed boat that uses the same engine and some other parts from
a sports car is a subclass of that car Any Java class which radically alters the behavior of a method
inherited from Object» Example: A subclass which does not adhere to the behavior
specifications of the hashcode() and equals(Object o) methods Bottom line: Strive to have your subclasses be true subtypes
September 10, 2015 SE 430: Lecture 1 49 of 94
Hierarchy example: generalizationHierarchy example: generalization Hierarchical ordering usually leads to
generalization/specialization (inheritance) hierarchy. Defines relationships among classes; classes share structure
and/or behavior of one or more superclasses. Abstraction and encapsulation work to hide internal aspects of
objects; inheritance fosters sharing of internal aspects.
September 10, 2015 SE 430: Lecture 1 50 of 94
Generalization/specializationGeneralization/specialization hierarchy hierarchy Generalization/specialization
represents ‘is-kind-of’ relationships among related types
Example: Smartphone is-kind-of mobile phone is-kind-of phone is-kind-of communication device
More-specialized subtypes share specific behavioral and structural properties of their more-general supertypes
Practice suggestion: Postpone effort on generalization/specialization structure hierarchy until later stages of analysis
September 10, 2015 SE 430: Lecture 1
is kind of
Basic UML class diagram notation illustrating generalization/specialization relationships
amongdifferent types of communication devices
51 of 94
Liskov Substitution PrincipleLiskov Substitution Principle In order for a subclass to be considered a subtype, it must meet the
requirements of the Liskov Substitution Principle Requires that subtype specification supports reasoning based on the
supertype specification Three properties must be supported:
Signature rule. Subtype must have all the methods of supertype and subtype parameter signatures must be compatible with corresponding supertype methods
Methods (behavior) rule. Invocations of subtype methods must ‘behave like’ corresponding supertype methods even if they override (reimplement) the method
Properties rule. Subtype must preserve all properties (such as pre- and post-conditions and invariants) that can be proved about supertype
September 10, 2015 SE 430: Lecture 1 52 of 94
Liskov Substitution PrincipleLiskov Substitution Principle Implications:
A subtype instance may be substituted where a supertype instance is required
Reverse is not true: a supertype cannot be substituted for a subtype
September 10, 2015 SE 430: Lecture 1 53 of 94
Generalization/specialization exampleGeneralization/specialization example
java.lang.Object // root of class hierarchy
java.util.AbstractCollection // skeletal implementation of Collection interface
java.util.AbstractSet // skeletal implementation of Set interface
java.util.HashSet // Set backed by Hashtable
java.util.LinkedHashSet // predictable iteration order
This represents a fairly deep specialization hierarchy in Java, which makes use of inheritance in the deeper subclasses in order to share code
This hierarchy obeys the Liskov Substitution Principle: you can substitute the subclasses in any reasoning you would do about the superclasses
September 10, 2015 SE 430: Lecture 1 54 of 94
Aggregation revisitedAggregation revisited Recall: Permits physical
grouping of logically-related structures, often in repeatable patterns
Inheritance allows these common groups of logically-related structures and patterns to be reused among different abstractions
Examples: Hypothetical “Trekker’s Phone” or Motorola iDEN (Nextel-type) combination phone/walkie-talkie devices
SmartPhone
Display PDA Core
1
11
1
Keypad
N
Transceiver
Feature Module
1
SmartPhone
Trekker'sPhone
GPS Module
September 10, 2015 SE 430: Lecture 1
Inherits all the structures of Smart Phone and adds GPS capability
55 of 94
TypingTyping Typing can help enforce design decisions. Two dimensions to typing:
Strong (versus weak) typing provides type consistency and avoids incompatibility among objects at run time.
Static/dynamic binding refers to the time when a specific implementation of a method is bound to a method invocation.
Strong and static typing are done at compile time, while weak and dynamic typing are done at run time.
Generalization + dynamic binding polymorphism
September 10, 2015 SE 430: Lecture 1 56 of 94
Core Object PrinciplesCore Object Principles Polymorphism
Polymorphism is the concept of an object changing its form to conform to a generic object abstraction.
Parametric polymorphism uses the concept of a common interface or lowest common denominator in terms of inheritance to implement a single abstraction across a number of types.
Foo bar = new Foo(42);out.println(42);out.println("42");out.println(42.0);out.println(bar);
September 10, 2015 SE 430: Lecture 1 57 of 94
Parametric PolymorphismParametric Polymorphism Allows a single parameter name
in a method to denote objects of several different classes
All these classes must be related by a common superclass
Any object denoted by this single parameter name is able to respond to a common set of operations in different, specific ways
Note application of Liskov Substitution Principle here!
delete()
PDAItem
delete()
Appointment
delete()
Task
delete()
Contact
delete()delete(anItem:PDAItem)
:ApplicationObject
Manager:DBManager
anItem:PDAItem
September 10, 2015 SE 430: Lecture 1
May be an instance of Contact, Appointment, or Task
Dynamic binding mechanism chooses the correct delete() implementation at invocation
58 of 94
Core Object PrinciplesCore Object Principles Coherence
Coherence is the concept of modeling objects in such a way that they reflect, as accurately as possible, the actual properties and behaviors of real-world entities.
September 10, 2015 SE 430: Lecture 1 59 of 94
ModularityModularity Property of a system that may be decomposed into a set of cohesive
and loosely-coupled components. A cohesive component is one which has a set of well-defined and
focused responsibilities Loosely-coupled components depend only on public knowledge
(i.e., the public interfaces) of a limited number of other components Loose coupling means aggregation or using relationships.
Module granularity: the ‘natural’ size of a system component suitable for separation. Example: An assembled phone is the appropriate granularity for
the information system managing the packaging production line Example: Java has a range of module granularities: class,
package, and bean Modularity expresses a critical aspect of the system architecture. Module granularity and organization—but not modularity, in general—
are design, not analysis, concerns: do not try to resolve too early.
September 10, 2015 SE 430: Lecture 1 60 of 94
Object Oriented ConceptsObject Oriented Concepts
Object Identity every object has its own
identity (regardless of its class or attribute values).
Usually implemented with a pointer reference (object-handle)
The object-handle is unique for every object
September 10, 2015 SE 430: Lecture 1
Composition
use components that interact to accomplish a task
Build complex "whole" systems by assembling simpler "parts" by association or aggregation
61 of 94
Object Oriented ConceptsObject Oriented ConceptsMessage Passing
Objects communicate to other objects via message passing.
Very few objects can accomplish the necessary tasks by themselves. They have to work with other objects.
Messages contain the object-handle, name of the operation that is to be performed and any additional arguments that should be used in the operation.
The message sender does not have to know the exact class of the receiver
September 10, 2015 SE 430: Lecture 1 62 of 94
Class and ObjectClass and ObjectDifference between Class and Object Class –
A description of a set of objects that have something in common. Class is also a programming concept used to define objects that
have the same attributes, operations, relationships and semantics.
Object – Is an instance of a Class. Objects are created from a Class at run-time. Since Classes have
state, an object retains information about its attributes for some indefinite time. This is different than functions or subprograms.
September 10, 2015 SE 430: Lecture 1 63 of 94
ConceptsConcepts Separation of concerns
“An object has one responsibility and does it well.”
Chain of responsibility If an object should/can not do something, it can delegate the
responsibility/request/service to another object (Delegate pattern).
Objects should be viewed as providing services
September 10, 2015 SE 430: Lecture 1 64 of 94
VocabularyVocabulary Class — a business object type or one of its components as indissoluble
combination of information and behavior
Attribute — an information field as one of the features of a class
Service — an elementary routine defining a specific type of behavior of a class
Relationship — a link between classes expressing a specific relationship or dependency between them
Actor — a party (organization) which performs actions in the business domain
Procedure — a sequence of activities which determines the performance of a specific business task
Flow — a link between procedures defining the sequence of procedure performance
Event — the output of an external procedure which triggers the performance of a model procedure
September 10, 2015 SE 430: Lecture 1 65 of 94
Object Oriented Approach to AnalysisObject Oriented Approach to Analysis The most appropriate programming structures should be
based on relevant objects of the application domain. Organize software as a collection of objects containing
Data structure Behavior
Build an object model of an application domain Add implementation details to the model during design
September 10, 2015 SE 430: Lecture 1 66 of 94
Object Oriented ApproachObject Oriented ApproachOO analysis should emphasize Front-end conceptual issues (analysis) Data structure before function Be iterative not sequential Language of the application domain
OO analysis should not emphasize Back-end implementation (code)
September 10, 2015 SE 430: Lecture 1 67 of 94
Object Oriented ApproachObject Oriented ApproachObject-oriented development (Rumbaugh OMT) A seamless progression of objects by identifying real-world
object classes in a domain Using same notation & language throughout development
stages (traceability) Adding detail to the object classes with each development
stage Adding necessary implementation objects at design
stages.
September 10, 2015 SE 430: Lecture 1 68 of 94
Software Development Life Software Development Life CycleCycle
September 10, 2015 SE 430: Lecture 1 69 of 94
What is the problem?What is the problem? Only 16.2% of projects are completed on-time & on-budget Over 50% of software projects never see the light of day [see note]:
They never worked Too late for the market window Did not do what the customer wanted
Most projects are Late in delivery Missing functionality Have major defects (bugs) Hard to maintain and support
This course is the beginning of software engineering Based on the premise if you start a project correctly it is harder to screw it
up. Or, "Good beginnings help for good endings." Systems are complex – In order to understand and manage a complex
system, decompose it into understandable chunks.
September 10, 2015 SE 430: Lecture 1 70 of 94
Software: why is it hard?Software: why is it hard? Software production often runs into problems, because it is mostly
concerned with completing a design that works as soon as possible Each development activity is focused on developing a specific feature Products (and even different sections within a product) are designed
independently from each other Software systems can become extremely complex during the
development process The best methods for controlling this complexity are abstraction and
encapsulation: if we use some techniques for building software that is less complex, we will get benefits in software that is more flexible: easier to maintain and modify later some opportunities to reuse designs and code
September 10, 2015 SE 430: Lecture 1 71 of 94
Software Development ProcessSoftware Development Process Ad hoc
Code and Fix Rapid Prototyping
Prescriptive Linear (Classic and Waterfall) Evolutionary (Iterative/incremental or spiral) Unified Process
Adaptive Lean and agile methods
September 10, 2015 SE 430: Lecture 1 72 of 94
The traditional software lifecycleThe traditional software lifecycle Feasibility study Requirements analysis and specifications Design and specification Implementation (coding and module test) Integrate/test (system testing) Install/operate (delivery) Maintain - 70% of cost
Frame of reference for us
September 10, 2015 SE 430: Lecture 1 73 of 94
Waterfall Life-cycleWaterfall Life-cycleThe most traditional software development lifecycle model is a linear
process (sometimes called the “waterfall model”): Each activity has to be completed before the next activity is started
For example, requirements writing must be complete before analysis can begin
No coding work is started before the design documents are finished
It is a very efficient process for solving a well-understood problem But there is no support for “iteration”: it is difficult to add in some of
the things that are learned during the development process
September 10, 2015 SE 430: Lecture 1 74 of 94
Waterfall Life-cycleWaterfall Life-cycle The term waterfall was coined by Winston Royce in a 1970 paper titled
Managing the Development of Large Software Systems, in the Proceedings of IEEE WESCON (Western Electronic Show and Convention)
The paper used the (pure) sequential waterfall approach as an example of an ill-conceived, risk-prone practice for developing large systems
Royce advocated adding a series of iterative feedback loops among the development stages, incrementally gaining learning value from working software
Instead of adopting the approach Royce advocated, managers and practitioners adopted its anti-form, without feedback loops
September 10, 2015 SE 430: Lecture 1 76 of 94
Waterfall Life-cycleWaterfall Life-cycleAdvantages of a Waterfall Life-cycle Easy to manage; Project Management (PM) tools support cycle:
GANNT and PERT charts
Disadvantages of a Waterfall Life-cycle Complexity overload at the beginning of the cycle Specifications frozen early, while business environment changes Delayed feedback, if any
If there are design incompatibilities do not find out until late in the cycle
Similarly for incorrect or incomplete requirements Fix fatal bugs now, but Make changes in next release (if any)
September 10, 2015 SE 430: Lecture 1 77 of 94
Iterative DevelopmentIterative DevelopmentIterative Development Successive enlargement and refinement of a system through
multiple development cycles of analysis, design, implementation and testing.
Spiral Model Developed by Barry Boehm at TRW in 1988 Incorporates risk management as an integral part of the life
cycle Prior to every major phase, risks are identified and
analyzed, and steps are taken to avert them If progress is not adequate, the project may be abandoned
September 10, 2015 SE 430: Lecture 1 78 of 94
Evolutionary Model (Spiral)Evolutionary Model (Spiral) Software is developed in a series of incremental releases ranging from
early prototypes to complete engineered versions of the system. Characterized by
Risk driven approach Milestones
Weaknesses Convincing customers that evolutionary approach is controllable. Demands expertise in risk assessment.
Strengths Matches the natural progression of a project. Reduces risk
September 10, 2015 SE 430: Lecture 1 79 of 94
An alternative development process An alternative development process An “iterative and incremental”
development approach is best when using object oriented analysis and design incremental development:
» the development team produces a series of functioning software systems
»each partial system contains an larger and larger subset of the total functionality
iterative development:»on each cycle, the quality and accuracy of the
models is checked» the customer might decide that some parts of
the model are incorrect and need revision to change the externally visible behavior
» the developers may decide that some parts of the model have poor performance and need revision to improve the internal operation
September 10, 2015 SE 430: Lecture 1
first analysismodel
first designmodel
first smallimplementation
second analysismodel
second designmodel
secondimplementation
. . .
81 of 94
Iterative Development Iterative Development Iterative development Concept uses multiple development cycles Time-boxing a Development Cycle
A cycle is two weeks to two months Choose requirements carefully Each cycle tackles a relatively small set of requirements.
» Implementation of part of a use case or (1 or more use cases) Rank order use cases. Choose requirements carefully.
The system grows incrementally as each cycle is completed. Some cycles are devoted to non-evident requirements
September 10, 2015 SE 430: Lecture 1 82 of 94
ProblemsProblems The iterative and incremental approach is more difficult to manage:
It isn’t always possible to say “we are X% complete” Team members are tempted to abandon all attempts at high-level
planning: there is a tendency to revert to “hacking” instead of working to understand system requirements, developing a complete analysis model, or creating design-level descriptions of the key parts of the solution
The documentation of the system always seems as if it is in a state of flux
But it has some advantages over traditional “waterfall” approaches: It is easier to manage risk - you can evaluate some of the critical
technology choices early in the project’s timeline In the waterfall process, the system integration step is very difficult
» And you find out about some incorrect assumptions late in the development cycle
September 10, 2015 SE 430: Lecture 1 83 of 94
Iterative DevelopmentIterative DevelopmentAdvantages of Iterative Development
Complexity reduced – avoids analysis paralysis and design paralysis.
Early overall system integration and testing
Early feedback from implementation
Requirements can be adjusted to match changing business needs
Main disadvantage of Iterative Development
Raised expectations by the client and management.
September 10, 2015 SE 430: Lecture 1 84 of 94
The Software Development Life CycleThe Software Development Life Cycle Waterfall method
Royce, W.W.: Managing the development of large software systems. In Proc. WESTCON, San Francisco CA. 1970.
Spiral method Boehm B. W.: A spiral model of software development and
enhancement. IEEE Computer, 21 (5), 61-72. 1988.
Agile methodologies Similar to spiral
September 10, 2015 SE 430: Lecture 1 85 of 94
Object-Oriented Analysis & Object-Oriented Analysis & Design and the Unified Design and the Unified
ProcessProcess
September 10, 2015 SE 430: Lecture 1 86 of 94
Object-oriented analysis & designObject-oriented analysis & design Analysis
Discover the key abstractions that form the vocabulary of the problem domain.
Remove programming language concepts and emphasize the language of the domain.
Invent additional domain abstractions and mechanisms. Abstractions, their behavior, and interactions that define the
conceptual model of the problem (not software) domain Design
Structure the system within an architectural framework Map analysis abstractions into a software design class hierarchy. Assemble objects (class instances) and their behaviors into
collaborations. Discover and invent software abstractions not in the problem domain
but needed for implementation Organize classes in hierarchies
September 10, 2015 SE 430: Lecture 1 87 of 94
Object-oriented analysisObject-oriented analysis Defines the problem domain according to the requirements Sets the basic “vocabulary” of the problem domain for the
design and coding activities Surveys the possible solutions and discusses tradeoffs Provides the environment for productive team analysis Models the problem from the object perspective
One advantage of object oriented analysis: the analysts don't have to be “language experts” The experts in the problem domain and the implementation-level
experts can communicate using a common notation
September 10, 2015 SE 430: Lecture 1 88 of 94
Object-oriented designObject-oriented design Takes the products produced by analysis, then details and designs the
solution in terms of some target environment Concerned with real-world concerns like
Reliability Performance Capacity
Deals with “assignment of functionality to different processes or tasks”, so there is significant knowledge of the operating system at design time
Deals with database issues and “distributed object environments” Object oriented analysis and object oriented design use the same kinds
of modeling notations - the main difference is “problem” vs. “solution” modeling
September 10, 2015 SE 430: Lecture 1 89 of 94
Object-oriented programmingObject-oriented programming Translates OO design into code OO programming can actually be done in any language: even C,
COBOL, or assembler There are languages that provide better support for OO programming
Examples: Smalltalk, Java, C++, C# These languages support the notions of class, object, messaging,
inheritance, encapsulation, polymorphism In object oriented programming, reuse of existing libraries is very
important OO programs often create new objects as needed (and destroy them
when they are no longer active), so OO programs may use a lot of “dynamic memory”
September 10, 2015 SE 430: Lecture 1 90 of 94
Object Oriented ModelingObject Oriented ModelingAn Object-Oriented System Depends on "local" knowledge of objects to accomplish their
tasks. There are very few things an object can do on its own, in order to accomplish any significant task, objects must communicate with other objects.
Emphasis on Abstraction Model relevant attributes and behavior of a given entity for a
particular purpose. Focus on what an object "is" and "does.” Class defines both behavior and state.
September 10, 2015 SE 430: Lecture 1 91 of 94
Examples of object-oriented modelsExamples of object-oriented models Requirements and
analysis: Use case diagram Interface model Business/Domain Object
model Application Object model Object Interaction model Dynamic model
Design: Design Object model Design Object Interaction
model Design Dynamic model
Implementation Source code
Testing Test cases
September 10, 2015 SE 430: Lecture 1 92 of 94
Next ClassNext ClassTopic:
Requirements – "what the customer wanted"
Reading:Arlow & Neustadt: Ch’s 3 & 14
Articles on the Class Page
September 10, 2015 SE 430: Lecture 1 93 of 94
Preliminary AssignmentPreliminary Assignment Review concepts and vocabulary in this lecture and be sure you
understand them. We’ll be using them extensively throughout the quarter.
Start understanding the domain information we will use for the class: Start reading the Museum Automation Problem Description and the Mobile Guide.
» Much of this is general knowledge and not new.
September 10, 2015 SE 430: Lecture 1 94 of 94