chapter6_nn - Chapter 6 ObjectOriented Programming 1...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 6 - Object-Oriented Programming Object-oriented programming overview objects classes encapsulation UML Class Diagram First OOP Class private  and  public  Access Driver Class Reference Variables and Instantiation Calling a Method Calling Object 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The  this  Reference Default Values Variable Persistence OOP Tracing Procedure UML Class Diagram for Next Version of the Mouse Program Local Variables return  statement void  Return Type Empty  return  Statement Argument Passing Specialized methods: accessor methods mutator methods boolean  methods Chapter 6 - Object-Oriented Programming 2
Background image of page 2
Object-Oriented Programming Overview  In the old days, the standard programming technique  was called "procedural programming." That's because the emphasis was on the procedures  or tasks that made up a program. You'd design your program around what you thought  were the key procedures. Today, the most popular programming technique is  object-oriented programming  (OOP). With OOP, instead of thinking first about procedures,  you think first about the things in your problem. The  things are called objects. 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Object-Oriented Programming Overview  An object is: A set of related data which identifies the current  state  of the  object. + a set of behaviors Example objects: Car object in a traffic-flow simulation: data = ? methods = ? human entities physical objects mathematical entities employees cars in a traffic-flow simulation points on coordinate system customers Aircraft in an air-traffic control system Complex numbers students Electrical components in a circuit- design program time 4
Background image of page 4
Object-Oriented Programming Overview Benefits of OOP: Programs are more understandable - Since people tend to think about problems in terms of objects, it's easier  for people to understand a program that's split into objects. Fewer errors - Since objects provide  encapsulation  (isolation) for the data, it's harder for  the data to get messed up. methods data rest of program object 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Object-Oriented Programming Overview class  is a description for a set of objects. On the next slide, note the three computers on a  conveyer belt in a manufacturing plant: The three computers represent objects, and  the  specifications document represents a class. The  specifications document is a blueprint that describes the  computers: it lists the computers' components and describes  the computers' features.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/19/2012 for the course SOC 1101 taught by Professor A.tan during the Fall '08 term at National University of Singapore.

Page1 / 48

chapter6_nn - Chapter 6 ObjectOriented Programming 1...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online