lecture6-june17 - Lecture 6 Announcements Assignment 1 Test...

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

View Full Document Right Arrow Icon
Lecture 6 Announcements • Assignment 1 – Designs due today – Programs due Sunday before midnight • Read Chapter 1 and Appendix B • Topics for today – OO thinking and design – How classes and objects work Classes and Objects “Introduction to Object Oriented (OO) Thinking” “Objects are good” - Aristotle Classes You Have Seen So Far Programs are constructed from many classes. e.g. • Your program’s class that contains the main (and perhaps other) methods • Scanner class • String class • System class • BankAccount class (today) • So far we have been using Java classes in a limited way - i.e. just to be able to use the methods defined inside each A Class is really a programmer defined type that provides encapsulation of data and operations. 9 This allows access to data and operations on it to be isolated through a defined interface. Objects And Classes - in Two Worlds •A class is an abstract grouping (or categorization) of related objects, containing members that have something in common (e.g. at least one attribute); it defines a general kind of or type of object (e.g. all cars, all students in this course) •A n object is a specific, identifiable thing; is a member of 1 or more classes, has attributes, exhibits behavior (e.g. my Toyota, you) Real World Java OO World •A class is a container of methods, variables, etc.; and is a generalization of and a generator for all objects of that class •A n object is a member (or instance) of a class, it is a composite data structure with methods attached, and is a thing you can create and manipulate in your program. It has a state, and behavior. For some programming problems it is easy to map between these two worlds - that is what OOP tries to do OO Models and Nomenclature relationship/ association between classes classname operations/methods UML Class Diagrams attributes class super/sub classes String substr, indexOf, etc. length, value, etc. Dog bark,sleep,eat name,gender, breed What is a Class ? • Is how we implement an ADT in Java (or C++, etc.) •A n A b s t r a c t D a t a T y p e
Background image of page 1

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

View Full DocumentRight Arrow Icon
Purposes of Classes Classes serve the following purposes: Creates a new programmer defined data type A class is like a factory used to create (or construct) objects of that data type. Specifies the functions (methods) you can
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/15/2009 for the course EE 322C taught by Professor Nettles during the Summer '08 term at University of Texas at Austin.

Page1 / 6

lecture6-june17 - Lecture 6 Announcements Assignment 1 Test...

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

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