Top Banner
Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013
35

Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Dec 15, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Informática IIProf. Dr. Gustavo PatiñoMJ 16- 1805-09-2013

Page 2: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 3: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

A model is a simplification of reality.Main reason for developing models:

Understanding the system being developed.

We build models of complex systems because we can not comprehend such a system in its entirety.

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 4: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

The choice of the model has a significant impact on how the problem is approached and how a solution is devised. A model can be expressed at different

levels of precision. A good model is connected to reality. A single model is not sufficient to represent

most systems.▪ A set of nearly independent models are required.

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 5: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Modeling is an essential part of all the disciplines in engineering, including software engineering.

The importance of having a “good” model increases with the complexity of the project.

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 6: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Software engineering is an engineering discipline. A modeling technique suitable for the

programming approach should be used. Since object-oriented approach has

proven to be superior to other approaches, models designed for this approach are widely used in software engineering.

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 7: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Objects are abstractions of real-world or system entities and manage themselves.

Objects are independent and encapsulate state and representation information.

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 8: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

System functionality is expressed in terms of object services.

Shared data areas are eliminated. Objects communicate by message passing.

Objects may be distributed and may execute sequentially or in parallel.

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 9: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Easier maintenance. Objects may be understood as stand-

alone entities.Objects are appropriate reusable

components.For some systems, there may be an

obvious mapping from real world entities to system objects.

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 10: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 11: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

OOA is concerned with developing an object model of the application domain.

OOD is concerned with developing an object-oriented system model to implement requirements.

OOP is concerned with realising an OOD using an OO programming language such as Java or C++.

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 12: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Object Orientation Abstraction Encapsulation Modularity Hierarchy

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 13: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

A model that includes most important aspects of a given problem while ignoring less important details.

An example of an item purchasing abstraction.

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Counter

Queue Item

Page 14: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Hide implementation from clients Clients depend on interface

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 15: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

The breaking up of something complex into manageable pieces or modules

Canteen System

Queue

Order Placement

Delivery

Billing

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 16: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Level of abstraction

Increasing abstraction

Decreasing Abstraction

Art

Music Films Sculptures

R&B Rap Sci-Fi Action

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 17: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

ObjectClassAttributesOperation Interface (Polymorphism)ComponentsPackageSubsystemRelationships

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 18: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Informally, an object represents an entity, either physical, conceptual, or software Physical entity

Conceptual entity

Software entity

truck

Chemical Process

Linked List Data Structure

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 19: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.
Page 20: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

An object is a concept, abstraction, or thing with sharp boundaries and meaning for an application

An object is something that has State Behavior Identity

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 21: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

The state of an object is one of the possible conditions in which an object may exist

The state of an object normally changes over time

Represented by: Attribute values + Links (relationship instances)

Y.Welikala

Name:

Employee ID:

Date hired:

Status:

Y.Welikala

567138

Oct 18, 2004

Teaching

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 22: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Behavior determines how an object acts and reacts to requests from other objects

Behavior is represented by the set of messages it can respond to (the operations the object can perform)

Registration System

Assign Y.Welikala

(Returns: confirmation)

CS 201 Course

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 23: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Each object has a unique identity, even if its state is identical to that of another object

Y. Welikala Teaches OOP

“Y.Welikala” Teaches OOP

“Y.Welikala” Teaches OOP

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 24: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

An object is represented as rectangles with underlined names

: Lecturer

Y.Welikala : Lecturer

Class Name Only

Class and Object Name

Y.Welikala

Object Name Only

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 25: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Intro to OO 201

Algebra 110

Electricity 100

Algorithms 202

ThermalDynamics 110

Electronics 110

English 101

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 26: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

A class is a description of a group of objects with common properties (attributes), behavior (operations), relationships, and semantics. An object is an instance of a class

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 27: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

A class is an abstraction in that it: Emphasizes relevant characteristics Suppresses other characteristics

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 28: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Class

CourseProperties

Name

Location

Days offered

Credit hours

Start time

End time

Behavior

Add a student

Delete a student

Get course roster

Determine if it is full

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 29: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

How many class can you see?

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 30: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

A class is an abstract definition of an object It defines the structure and behavior of

each object in the class It serves as a template for creating

objectsObjects may be grouped into classesLecturer

Lecturer Yohan Lecturer Chinthana Lecturer Smith

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 31: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

Class

Attribute

CourseOffering

numberstartTimeendTime

:CourseOfferingNumber=CS201

endTime=1230startTime=1030

Object

Attribute Value

:CourseOfferingNumber=CS202

endTime=1500startTime=1300

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 32: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

CourseOffering

addStudent

deleteStudent

getStartTime

getEndTime

Class

Operation

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 33: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

What are the game’s objects?

What do those objects know how to do?

What properties do they have?

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 34: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

What are the game’s objects? piece, board

Capabilities: What do those objects know how to do? piece:▪ be created▪ fall▪ rotate▪ stop at collision

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

Page 35: Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 05-09-2013.

board:▪ be created▪ remove rows▪ check for end of game

Properties: What attributes and components do they have? piece:▪ orientation▪ Position▪ shape▪ color

board:▪ size▪ rows

Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2