Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Object-oriented Programming CSIS 3701: Advanced Object Oriented Programming.

Similar presentations


Presentation on theme: "Introduction to Object-oriented Programming CSIS 3701: Advanced Object Oriented Programming."— Presentation transcript:

1 Introduction to Object-oriented Programming CSIS 3701: Advanced Object Oriented Programming

2 The “Software Crisis” Most “real world” programs 10,000 – 10,000,000 lines long Take months or years to develop Created by dozens or hundreds of programmers –Many are added to or leave the project throughout development Modified over time as customer needs change

3 Abstracton Ability to use tool without having to understand how it works –Example: can drive car without understanding physics of internal combustion, electronics, etc. Functional abstraction: y = sqrt(x); –Do you know how C computes square root? –Do you need to?

4 Objects Object-oriented classes are abstractions “Client programmer”: Programmer who uses class in their own code Methods to access state of object Current state of object Object Only has to understand how to call methods, not how they work Does not have to understand internal representation of object state

5 Abstract Data Types as Objects Example: Stack abstract data type Programmer who uses Stack class void push(int) int pop() boolean isEmpty() Stack Only has to understand how these affect abstract concept of a “stack” Internal representation could be array, linked list, etc. top contents

6 Examples of Objects GUI components: –Attributes: width, font, text, location, etc. –Methods: setText, getText, show, hide, etc. –Can use without knowing how drawn by OS Problem domain classes: –Example: Order class for financial system –Attributes: order#, item, quantity, totalCost, … –Methods: getNewOrderNumber, setItem, setQuantity…

7 Constructors and Abstraction User should not have to understand internal representation to create an object Constructor: code executed automatically at object startup to define initial state –Default values –Parameters passed to constructors –Values read from file

8 Objects vs. Classes Class defines: –Attribute types ( int top, String[] contents ) –Code for methods ( push, pop, isEmpty ) Object is an instance of a class –Constructed from class –Each may have different attribute values top: 3 contents: [“Larry”, “Curley”, “Moe”] top: 2 contents: [“Fred”, “Barney”] stoogesStackbedrockStack

9 Large-Scale Programming Abstraction key to large scale programming –No individual can understand entire system –Need to understand your subsystem –Need to know how to use methods in other modules it interacts with Your module Other module methods Other module methods Other module methods

10 Data Access 3-Tier Architecture User InterfaceBusiness Logic Order Database Product Database UI developers just need to know UI design and how to call business logic methods Business logic developers just need to know business model, how will be called by UI, and how to call data access methods Data access developers just need to know SQL and database design and how will be called by business logic

11 Abstraction in Design UML: Universal Modeling Language –Common representation for design at abstract level –Class types and relationships

12 Design Patterns Abstract designs that can be reused in different systems Class design level: –Typical types of classes –Typical methods within those classes System architecture level: –Typical ways to organize classes –Example: 3-Tier model Data AccessUser InterfaceBusiness Logic


Download ppt "Introduction to Object-oriented Programming CSIS 3701: Advanced Object Oriented Programming."

Similar presentations


Ads by Google