Object-Oriented Programming - Hobart and William Smith Colleges
Object-Oriented Programming
School of Computer Science University of KwaZulu-Natal
February 5, 2007
Object Oriented Programming using Java
Notes for the Computer Science Module Object Oriented Programming COMP200
Adapted from Introduction to Programming Using Java
Version 5.0, December 2006 by David J. Eck
Adapted by Anban Pillay
School of Computer Science University of KwaZulu-Natal
Durban February 2007
3
4
Contents
1 Introduction to Objects
11
1.1 What is Object Oriented Programming? . . . . . . . . . . . . . . . . . . . 11
1.1.1 Programming Paradigms . . . . . . . . . . . . . . . . . . . . . . . . 12
1.1.2 Object Orientation as a New Paradigm: The Big Picture . . . . . 14
1.2 Fundamentals of Objects and Classes . . . . . . . . . . . . . . . . . . . . 16
1.2.1 Objects and Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.2.2 Class Members and Instance Members . . . . . . . . . . . . . . . 22
1.2.3 Access Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.2.4 Creating and Destroying Objects . . . . . . . . . . . . . . . . . . . 29
1.2.5 Garbage Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
1.2.6 Everything is NOT an object . . . . . . . . . . . . . . . . . . . . . . 35
2 The Practice of Programming
37
2.1 Abstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.1.1 Control Abstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.1.2 Data Abstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.1.3 Abstraction in Object-Oriented Programs . . . . . . . . . . . . . . 39
2.2 Methods as an Abstraction Mechanism . . . . . . . . . . . . . . . . . . . 40
2.2.1 Black Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.2.2 Preconditions and Postconditions . . . . . . . . . . . . . . . . . . . 41
2.2.3 APIs and Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.3 Introduction to Error Handling . . . . . . . . . . . . . . . . . . . . . . . . 46
2.4 Javadoc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.5 Creating Jar Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.6 Creating Abstractions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2.6.1 Designing the classes . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2.7 Example: A Simple Card Game . . . . . . . . . . . . . . . . . . . . . . . . 58
3 Tools for Working with Abstractions
63
3.1 Introduction to Software Engineering . . . . . . . . . . . . . . . . . . . . 63
3.1.1 Software Engineering Life-Cycles . . . . . . . . . . . . . . . . . . . 63
3.1.2 Object-oriented Analysis and Design . . . . . . . . . . . . . . . . . 64
3.1.3 Object Oriented design . . . . . . . . . . . . . . . . . . . . . . . . . 65
3.2 Class-Responsibility-Collaboration cards . . . . . . . . . . . . . . . . . . 66
3.3 The Unified Modelling Language . . . . . . . . . . . . . . . . . . . . . . . 67
3.3.1 Modelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- leccture 3 object oriented programming in java
- java 3 object oriented programming programmer books
- object oriented programming kandula yellaswamy
- object oriented programming in java southern adventist university
- lecture notes on object oriented programming through java iare
- object oriented programming oop a review colorado state university
- java object oriented programming example pdf webinar proposals
- introduction to object oriented programming semantic scholar
- introduction to object oriented programming exceptions
- object oriented programming basics with java university of san francisco
Related searches
- object oriented programming in matlab
- matlab object oriented programming pdf
- object oriented programming tutorial pdf
- object oriented programming book pdf
- object oriented programming c pdf
- object oriented programming 2 pdf
- object oriented programming pdf download
- object oriented programming c book
- object oriented programming java examples
- object oriented programming language pdf
- object oriented programming python pdf
- c object oriented programming examples