02-objectspt1

02-objectspt1 - Object Fundamentals, Part One Kenneth M....

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

View Full Document Right Arrow Icon
Object Fundamentals, Part One Kenneth M. Anderson University of Colorado, Boulder CSCI 4448/5448 — Lecture 2 — 08/27/2009 1 Thursday, August 27, 2009
Background image of page 1

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

View Full DocumentRight Arrow Icon
Lecture Goals • Introduce basic concepts, terminology, and notations for object-oriented analysis, design, and programming • A beneFt of the OO approach is that the same concepts appear in all three stages of development • Start with material presented in Appendix II of your textbook • Continue (in lecture 3) with additional material from previous versions of this class as well as from Head First Java by Sierra & Bates, © O'Reilly, 2003 • Will present examples and code throughout 2 Thursday, August 27, 2009
Background image of page 2
Big Picture View • OO techniques view software systems as systems of communicating objects • Each object is an instance of a class • All objects of a class share similar features attributes methods • Classes can be specialized by subclasses • Objects communicate by sending messages 3 Thursday, August 27, 2009
Background image of page 3

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

View Full DocumentRight Arrow Icon
Welcome to Objectville • What were the major concepts discussed in Appendix II of the textbook? • UniFed Modeling Language (UML) • Class Diagrams • Inheritance • Polymorphism • Encapsulation 4 Thursday, August 27, 2009
Background image of page 4
UML • UML stands for Unifed Modeling Language • UML deFnes a standard set of notations for use in modeling object- oriented systems • Throughout the semester we will encounter UML in the form of • class diagrams • sequence/collaboration diagrams • state diagrams • activity diagrams, use case diagrams, and more 5 Thursday, August 27, 2009
Background image of page 5

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

View Full DocumentRight Arrow Icon
Class Diagrams getSpeed(): int setSpeed(int) speed: int Airplane A class is represented as a rectangle Class Name Attributes (member variables) Methods All parts are optional except the class name This rectangle says that there is a class called Airplane that could potentially have many instances, each with its own speed variable and methods to access it 6 Thursday, August 27, 2009
Background image of page 6
Translation to Code • Class diagrams can be translated into code in a fairly straightforward manner • DeFne the class with the speciFed name • DeFne speciFed attributes (assume private access ) • DeFne speciFed method skeletons (assume public ) • May have to deal with unspeciFed information • Types are optional in class diagrams • Class diagrams typically do not specify constructors • constructors are used to initialize an object 7 Thursday, August 27, 2009
Background image of page 7

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

View Full DocumentRight Arrow Icon
Airplane in Java public class Airplane { 1 2 private int speed; 3 4 public Airplane( int speed) { 5 this .speed = speed; 6 } 7 8 public int getSpeed() { 9 return speed; 10 } 11 12 public void setSpeed( int speed) { 13 this .speed = speed; 14 } 15 16 } 17 8 Thursday, August 27, 2009
Background image of page 8
Airplane in Python class Airplane(object): 1 2 def
Background image of page 9

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

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/11/2010 for the course CSCI 5448 taught by Professor Anderson during the Fall '09 term at Colorado.

Page1 / 28

02-objectspt1 - Object Fundamentals, Part One Kenneth M....

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

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