1 / 17

Introduction Object-Oriented Programming

Introduction Object-Oriented Programming. The Journey So Far. Procedural Programming. using Pseudocode. You are here. The Destination. Procedural Programming. Object Oriented Programming. using Pseudocode. using Java. Introduction.

swong
Download Presentation

Introduction Object-Oriented Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. IntroductionObject-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 • 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 sucha 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. Queue Enqueue Dequeue Acme Manufacturing Issues • We’d like a way to put a “wrapper” around our structure to protect against intrusion. 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. CountingQueue Enqueue Size Dequeue Acme Manufacturing Issues • I need a queue that can tell me how many items it contains... Queue Enqueue Dequeue Acme Manufacturing “Magic Process”

  16. Signal Car $ Student BankAccount Issues Elevator Signal Object Elevator Object Student Object Car Object BankAccount Object Real World Objects!

More Related