Introduction to Object-oriented Program Design

Slides:



Advertisements
Similar presentations
Based on Java Software Development, 5th Ed. By Lewis &Loftus
Advertisements

Fields, Constructors, Methods
Written by: Dr. JJ Shepherd
Wednesday, 10/2/02, Slide #1 CS 106 Intro to CS 1 Wednesday, 10/2/02  QUESTIONS (on HW02 – due at 5 pm)??  Today:  Review of parameters  Introduction.
Syntax & terminology review While the following slides are not exactly what we did on the board (object diagrams are not shown here) they cover most of.
Road Map Introduction to object oriented programming. Classes
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
1 Objects and Classes Introduction to Classes Object Variables and Object References Instantiating Objects Using Methods in Objects Reading for this Lecture:
Object Oriented Programming.  OOP Basic Principles  C++ Classes  September 2004  John Edgar 22.
Stéphane Ducasse6.1 Essential Concepts Why OO? What is OO? What are the benefits? What are the KEY concepts? Basis for all the lectures.
Evan Korth New York University Computer Science I Classes and Objects Professor: Evan Korth New York University.
Class template Describing a generic class Instantiating classes that are type- specific version of this generic class Also are called parameterized types.
1 Introduction to C++ Programming Concept Basic C++ C++ Extension from C.
Chapter 10 Classes Continued
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
CSM-Java Programming-I Spring,2005 Objects and Classes Overview Lesson - 1.
1 Review of Java Higher Level Language Concepts –Names and Reserved Words –Expressions and Precedence of Operators –Flow of Control – Selection –Flow of.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Object-Oriented Programming (OOP). Implementing an OOD in Java Each class is stored in a separate file. All files must be stored in the same package.
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
15440 Distributed Systems Recitation 1 Objected-Oriented Java Programming.
1 Chapter 8 – Classes and Object: A Deeper Look Outline 1 Introduction 2 Implementing a Time Abstract Data Type with a Class 3 Class Scope 4 Controlling.
Introducing Objects and stuff GABY and MATT Definition: Object: “a class that is the root of the hierarchy tree for all classes in JAVA.” –An object.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
11/28/2015B.Ramamurthy1 Object-Oriented Design and Java B.Ramamurthy.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Introduction to Object-Oriented Programming Lesson 2.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني Introduction to Object Oriented Programming (OOP) Object Oriented programming is method of programming.
Object-Oriented Design Bina Ramamurthy SUNY at Buffalo.
YG - CS Concept of Encapsulation What is encapsulation? - data and functions/methods are packaged together in the class normally.
OOP Basics Classes & Methods (c) IDMS/SQL News
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
COMPUTER SCIENCE & TECHNOLOGY DEGREE PROGRAMME FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UVA WELLASSA ‏ Properties of Object Oriented Programming.
9.1 CLASS (STATIC) VARIABLES AND METHODS Defining classes is only one aspect of object-oriented programming. The real power of object-oriented programming.
Seventh step for Learning C++ Programming CLASS Declaration Public & Private Constructor & Destructor This pointer Inheritance.
Inheritance a subclass extends the functionality of a superclass a subclass inherits all the functionality of a superclass don't reinvent the wheel – "stand.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
CSIS 123A Lecture 1 Intro To Classes Glenn Stevenson CSIS 113A MSJC.
Computer Programming II Lecture 5. Introduction to Object Oriented Programming (OOP) - There are two common programming methods : procedural programming.
The Movement To Objects
Inheritance ITI1121 Nour El Kadri.
Road Map Introduction to object oriented programming. Classes
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Section 11.1 Class Variables and Methods
Chapter 4: Writing classes
Object-oriented Design in Processing
Object-Oriented Programming
Week 3 Object-based Programming: Classes and Objects
Chapter 4 Writing Classes.
Object-Oriented Programming
Implementing Classes Chapter 3.
Problem Solving, Object-Oriented Design and Java
Java Programming Course
Object-Oriented Programming
Object-oriented Design in Processing
Problem Solving, Object-Oriented Design and Java
Object-Oriented Programming
B.Ramamurthy Copyright 1998 CSE Department
Methods, Data and Data Types
Defining Classes and Methods
Java Statements B.Ramamurthy CS114A, CS504 4/23/2019 BR.
Defining Classes and Methods
Object-oriented Design in Processing
Final and Abstract Classes
Abstract Data Types Abstraction is to distill a system to its most fundamental parts. Applying the abstraction paradigm to the design of data structures.
Object-oriented Design in Processing
CSG2H3 Object Oriented Programming
Presentation transcript:

Introduction to Object-oriented Program Design B. Ramamurthy 9/19/2018

Object-Oriented Principles OOP Inheritance -- Hierarchy -- Reusability -- Extensibility -- Expressive power -- Reflects many real-world problems Polymorphism -- Many forms of same function Encapsulation (class) -- Information Hiding -- Interface and Implementations -- Standardization -- Access Control mechanisms (private /public etc.) 9/19/2018

What is an Object? Object-oriented programming supports the view that programs are composed of objects that interact with one another. How would you describe an object? Using its characteristics (has a ----?) and its behaviors (can do ----?) Object must have unique identity (name) : Basketball, Blue ball Consider a ball: Color and diameter are characteristics (Data Declarations) throw, bounce, roll are behaviors (Methods) 9/19/2018

Classes are Blueprints A class defines the general nature of a collection of objects of the same type. The process creating an object from a class is called instantiation. Every object is an instance of a particular class. There can be many instances of objects from the same class possible with different values for data. 9/19/2018

Example objects Object References redRose class Rose blueRose class 9/19/2018

Bouquet Class Many instances of real bouquet objects of this Class can be instantiated 9/19/2018

Greenfoot Project controls World Greenfoot is a 2D environment to develop Java programs Greenfoot interface Class diagram Book scenarios available at http://www.greenfoot.org/book/ Execution controls 9/19/2018

Worlds and Actors Greenfoot has two main classes World Actor Place to hold and display actors Has a width and height and cell size Of type integer (int) Has a background image Actor Actors know how to act Actors have a x and y location in the world 9/19/2018

Objects and Classes Classes define what objects know and can do There is one Balloon class Objects do the action There can be many objects of the same class There are many balloon objects Objects Classes 9/19/2018

Elements of a Class class data declarations (variables, constants) methods header body header statements modifiers, type, name variables, constants parameters repetition others selection assignment 9/19/2018

Class Structure class variables constants methods 9/19/2018

Defining Classes Syntax: class class_name { data-declarations constructors methods } Constructors are special methods used for instantiating (or creating) objects from a class. Data declarations are implemented using variable and constant declarations. 9/19/2018

Operator new and “dot” new operator creates a object and returns a reference to that object. After an object has been instantiated, you can use dot operator to access its methods and data declarations (if you have access permissions). 9/19/2018

Interacting with objects: methods void move() void turnLeft() Return type method 9/19/2018

Instantiation : Examples new Wombat() new Leaf() constructor 9/19/2018

Parameters void setSize (int size) parameter 9/19/2018

10 things Greenfoot interface Class Object World class Actor class Instantiate an object Methods and data (defining a class) Return type Parameters OOP (Object oriented principles) 9/19/2018