Download presentation
Presentation is loading. Please wait.
1
Introduction Object-Oriented Programming
2
The Journey So Far Procedural Programming using Pseudocode You are
here
3
The Destination Procedural Programming Object Oriented Programming
using Pseudocode using Java
4
Introduction We are going to introduce two concepts at the same time:
Object-Oriented Programming Programming in a real language Why? Pseudocode is a good preparation for learning any language. The Object Oriented paradigm is a significant factor in modern programming We feel that an introductory course should at a minimum give students a good taste of real programming Many students have asked for exposure to a real language Excellent preparation for CS 1312
5
Introduction We will not abandon the principles you have learned so far: modularity abstraction the necessity to visually validate the logic Today we will give some basic ideas about: Object Oriented Programming Working with a real language: Java
6
Object Oriented Programming
A different programming style A different way of thinking Origins Problems with very large systems becoming unmanageable (> 100,000 lines of code) Graphical User Interfaces (e.g. Macintosh, Windows) required a different way of programming due to complex interactions of windows, mouse clicks, etc. Xerox PARC: Smalltalk C++ as an enhancement to C Java as a Web language
7
To be more specific...
8
The Scenario Items Recall the concept of a Queue:
Defined by a set of behaviors Enqueue to the end Dequeue from the front First in, first out Items
9
Where is the Queue? The logical idea of the queue consisted of:
Data stored in some structure (list, array, etc.) Modules to act on that data But where is the queue? We’d like some way of representing such a structure in our programs.
10
Why? We would like to have reusable “drop-in” programming components we could use to solve problems. We would like to encapsulate the data and the behaviors in order to “protect” it from misuse. We would like clear interfaces between different parts of programs We would like a programming system that was extensible We would like a programming language that would be excellent for modeling real world objects
11
Issues As is, there is no way to “protect” against violating the specified behaviors. Procedure Enqueue Procedure Dequeue The Queue Data Sneak into Middle
12
Issues If our queue could somehow be packaged we could drop in a “queue object” whenever we needed it. Queue Acme Manufacturing
13
Issues We’d like a way to put a “wrapper” around our structure to protect against intrusion. Queue Acme Manufacturing Enqueue Dequeue Sneak into Middle
14
Issues Contract The party of the first part hereinafter known as the queue agrees to... The party of the second part hereinafter known as the application agrees to... Clear lines of responsibility
15
Issues I need a queue that can tell me how many items it contains... Queue Enqueue Dequeue Acme Manufacturing “Magic Process” CountingQueue Acme Manufacturing Enqueue Dequeue Size
16
$ Issues Signal Elevator Signal Object Elevator Object Student Student
Car Object Car $ BankAccount BankAccount Object Real World Objects!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.