Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Understanding OOP: Abstraction, Encapsulation, Inheritance, Modularity, Lab Reports of Advanced Calculus

An introduction to object-oriented programming (oop) and its fundamental principles, including abstraction, encapsulation, inheritance, and modularity. It explains how these concepts are applied in software engineering and provides examples of interface and implementation inheritance. The document also discusses the benefits of oop and contrasts it with procedural programming.

Typology: Lab Reports

Pre 2010

Uploaded on 08/26/2009

koofers-user-mj6
koofers-user-mj6 🇺🇸

10 documents

1 / 54

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS302
Topic: Intro. to Object Oriented Pgmg.
Tuesday, Sept. 6, 2005
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36

Partial preview of the text

Download Understanding OOP: Abstraction, Encapsulation, Inheritance, Modularity and more Lab Reports Advanced Calculus in PDF only on Docsity!

CS

Topic:^

Intro. to Object Oriented Pgmg.^ Tuesday, Sept. 6, 2005

Announcements † Lab 1 due^ this Friday † Lab 2 is now available (online) (due Friday, Sept. 16)^ „^ Uses red-black trees^ „^ Still in C^ „^ Don’t procrastinate!!!Finish Lab 1 early, then get early start on Lab 2. † This week’s lab meetings will discuss Lab 2 assignment † ☺^ Today’s movie case study

: Movies of swarms, andrelationship to OOP

Computational Models † A model is a

simplification

of reality † Main reason for developingmodels: „^ Understanding the systembeing developed † We build models of complexsystems because we cannotcomprehend such a system inits entirety

Principles of Modeling † The choice of the model has a significant impact onhow the problem is approached and how a solution isdevised † A model can be expressed at different levelsof precision † A good model is connected to reality † A single model is not sufficient to represent mostsystems; A set of

nearly^ independent models are required

Basic Principles of Object Orientation †^ Abstraction †^ Encapsulation †^ Modularity †^ Hierarchy †^ Inheritance

What is Abstraction?

Counter Queue

Items

†^ A model that includes most important aspectsof a given problem while ignoring lessimportant details^ An example of an item purchasing abstraction:

What is Modularity? †^ The breaking up of something complex intomanageable pieces or modules

Queue Canteen System

Order Placement Delivery Billing

What is Hierarchy? †^ Level of abstraction^ Increasingabstraction^

Art

Music^

Films^ Sculptures

R&B^ Rap

Sci-Fi^

… Action

DecreasingAbstraction

Example of Interface Inheritance † Suppose you want to define Search_Object_1 that: „^ Stores (key, value) pairs „^ Allows values to be looked up using keys „^ Supported operations for Search_Object_1:^ †^ insert:^

Adds a (key, value) pair to the object † delete: Deletes a (key, value) pair from the object † lookup: Given a key, retrieves the value associated with that key fromthe object †^ Later, define new object (Search_Object_2) that additionallyallows traversing (key, value) pairs in sorted order^ „^ Supported operations for Search_Object_2:^ †^ All of above, plus:^ †^ rewind:

returns us to beginning † next: returns next (key, value) pair „^ Accomplish this by having Search_Object_2 inheritSearch_Object_1’s interface

Example of Implementation Inheritance^ †^ Suppose:^ „^ Search_Object_1 is implemented using binarysearch tree^ „^ You already have a binary search treeimplemented, including implementations for theprevious operations, but using different names^ †^ To inherit binary search tree implementation, wemake Search_Object_1 be a subclass of thebinary tree.^ „^ We then make the insert, delete, and lookupoperations call the appropriate binary treeoperations

More detailed look at Object Orientation…^ 1. Object^ 2. Class^ 3. Attributes^ 4. Operation^ 5. Interface (Polymorphism)^ 6. Generalization Relationships

1.^ What is an Object? †^ An object is a “smart” data structure^ „^ Set of state variables^ „^ Set of methods for manipulating state variables † Examples –

physical, conceptual, or software entities: „ Physical entity: „ Conceptual entity: „ Software entity:

robot chemical processlinked list data structure

An Object Has State †^ The state of an object is one of the possibleconditions in which an object may exist †^ The state of an object normally changes overtime †^ Represented by: Attribute values + Links(relationship instances) Object:^ L. Parker^

L. Parker Name: (^9738239) Employee ID: Aug. 1, 2002 Date hired: Teaching Status:

An Object Has Behavior †^ Behavior determines how an object acts andreacts to requests from other objects †^ Behavior is represented by the set of messagesit can respond to (i.e., the operations theobject can perform)

Add me to CS302 with L. Parker (Returns: confirmation) Registration System

CS302 Course