CSCI 253. Outline. Background. George Blankenship 1

Similar documents
George Blankenship 1

Chapter 1. Introduction

Objectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Class object initialization block destructor Class object

Object oriented programming Concepts

2 rd class Department of Programming. OOP with Java Programming

Chapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing

JAVA: A Primer. By: Amrita Rajagopal

Introduction to Computers and Programming Languages. CS 180 Sunil Prabhakar Department of Computer Science Purdue University

Core Java Syllabus. Pre-requisite / Target Audience: C language skills (Good to Have)

ECE 122. Engineering Problem Solving with Java

Data Structures (list, dictionary, tuples, sets, strings)

Objects and Classes -- Introduction


BASIC CONCEPT OF OOP

CS1007: Object Oriented Design and Programming in Java. Lecture #2 Sept 8 Shlomo Hershkop Announcements

CSCI Object Oriented Design: Frameworks and Design Patterns George Blankenship. Frameworks and Design George Blankenship 1

Overview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017

Computational Expression

Chapter 4 Defining Classes I

Computer Science II. OO Programming Classes Scott C Johnson Rochester Institute of Technology

9 Working with the Java Class Library

Object Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming

Object Oriented Programming

Object-Oriented Programming Concepts

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

JAVA GUI PROGRAMMING REVISION TOUR III

CS260 Intro to Java & Android 02.Java Technology

Introduction to Object-Oriented Programming

Software Design Fundamentals. CSCE Lecture 11-09/27/2016

Chapter 6 Introduction to Defining Classes

Sri Vidya College of Engineering & Technology

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value

CMSC 132: Object-Oriented Programming II

Anatomy of a Class Encapsulation Anatomy of a Method

Java Basics. Object Orientated Programming in Java. Benjamin Kenwright

WA1278 Introduction to Java Using Eclipse

CHAPTER 5 GENERAL OOP CONCEPTS

Introduction to Computers and Java

STUDENT LESSON A5 Designing and Using Classes

Software Design COSC 4353/6353 D R. R A J S I N G H

CmSc 150 Fundamentals of Computing I. Lesson 28: Introduction to Classes and Objects in Java. 1. Classes and Objects

COMSC-051 Java Programming Part 1. Part-Time Instructor: Joenil Mistal

Object Oriented Programming. C++ 6 th Sem, A Div Ms. Mouna M. Naravani

COMP6700/2140 Objects

Compaq Interview Questions And Answers

Object-Oriented Concepts and Principles (Adapted from Dr. Osman Balci)

In this Lecture you will Learn: Design Patterns. Patterns vs. Frameworks. Patterns vs. Frameworks

Object-Oriented Programming in C++/Handout 01 Page 1 of 8

Chapter 7. Inheritance

Software Development. Modular Design and Algorithm Analysis

Chapter 5: Procedural abstraction. Function procedures. Function procedures. Proper procedures and function procedures

CSC207H: Software Design. Java + OOP. CSC207 Winter 2018

Java OOP (SE Tutorials: Learning the Java Language Trail : Object-Oriented Programming Concepts Lesson )

Programs as Models. Procedural Paradigm. Class Methods. CS256 Computer Science I Kevin Sahr, PhD. Lecture 11: Objects

1. Write two major differences between Object-oriented programming and procedural programming?

Unit - IV CHAPTER - 13 INTRODUCTION TO OOP WITH C++ Part 1 Choose the best answer

StackVsHeap SPL/2010 SPL/20


College Board. AP CS A Labs Magpie, Elevens, and Picture Lab. New York: College Entrance Examination Board, 2013.

Object Orientated Analysis and Design. Benjamin Kenwright

Lecture Chapter 2 Software Development

Java Software Solutions for AP Computer Science 3rd Edition, Lewis et al. 2011

Software Architecture

Inheritance and Polymorphism

Object-Oriented Programming

Object-oriented Compiler Construction

Overview of the Ruby Language. By Ron Haley

Object Oriented Technology

Introduction to Scientific Programming in C++

Introduction to Computers and Java

Defining Classes and Methods

OBJECT ORIENTED PROGRAMMING

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

COMP 202. More on OO. CONTENTS: static revisited this reference class dependencies method parameters variable scope method overloading

Introduction to Object- Oriented Programming

Lesson 10B Class Design. By John B. Owen All rights reserved 2011, revised 2014

From Module To Objects

Data Structures and Algorithms Design Goals Implementation Goals Design Principles Design Techniques. Version 03.s 2-1

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

Introduction to Computers and Java

Object-Oriented Programming (OOP) Fundamental Principles of OOP

Programming II (CS300)

Software Design. Levels in Design Process. Design Methodologies. Levels..

Introduction to Computers and Java

Introduction to Programming Using Java (98-388)

Software Design and Analysis for Engineers

Introduction to Computers and Java

Programming II (CS300)

Lecture 1. Abstraction

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

CS111: PROGRAMMING LANGUAGE II

Introduction to CS102

Topics. Modularity and Object-Oriented Programming. Dijkstra s Example (1969) Stepwise Refinement. Modular program development

Outline. Object Oriented Programming. Course goals. Staff. Course resources. Assignments. Course organization Introduction Java overview Autumn 2003

Advantages of Object Oriented Programming :- Features of Object Oriented Programming :- Advantages Of Object Oriented Programming :

What are the characteristics of Object Oriented programming language?

Microsoft Visual Basic 2005: Reloaded

Transcription:

CSCI 253 Object Oriented Design: Object Oriented Design and Programming in Java George Blankenship George Blankenship 1 Outline Background Rationale for the course Why object oriented programming? OOP principles Objects Object oriented design Java George Blankenship 2 Background Computer Science is not (just) programming Java is a tool to teach programming and problem solving concepts So if you know everything in Java you still need to stay awake Will be introducing many advanced topics along with the background material George Blankenship 3 George Blankenship 1

Rationale Programming is based up the use of a language just as any other human to exchange information between two intelligent entities The exchange must reflect an accurate intention of the source is a form that is intelligible and understandable by the recipient George Blankenship 4 Study of Grammar Man has learned that the grammar of a language must be studied as a separate discipline Man has also learned that selected constructs of a language convey information more effectively than other constructs These two observations are the basis of writing classes in any language George Blankenship 5 Problem Solving The key to designing a solution is breaking it down into manageable pieces When writing software, we design separate pieces that are responsible for certain parts of the solution An object-oriented approach lends itself to this kind of solution decomposition We will dissect our solutions into pieces called objects and classes George Blankenship 6 George Blankenship 2

Object-Oriented Programming Objects can be used effectively to represent realworld entities We try to define all our data as objects, and define programs to work on those objects For instance, an object might represent a particular employee in a company Each employee object handles the processing and data management related to that employee George Blankenship 7 Objects An object has: state - descriptive characteristics behaviors - what it can do (or what can be done to it) The state of a bank account includes its current balance The behaviors associated with a bank account include the ability to make deposits and withdrawals Note that the behavior of an object might change its state George Blankenship 8 Reusability Object oriented design encourages the design of reusable components Vehicle is a general definition Public class minivan { String manufacturer; String model; int year; Color color; } A base object defines common attributes and behaviors The definition is reused to define unique objects that have the common attributes and behaviors Mini-van as a more specific object George Blankenship 9 George Blankenship 3

Classes A class represents a concept, and an object represents the embodiment of that concept An object is defined by a class (blueprint) Multiple objects can be created from the same class Attributes define the state of the object Methods are the access point to effect the behavior of the object George Blankenship 10 Attributes Internal to the class Arguments for/against to make the attributes visible outside the class Define the state of an instantiation State changes are made when an instantiation receives a message If attributes are hidden, messages can only be received via externalized methods George Blankenship 11 Methods Define behavioral actions Action invoked by the receipt of a message The externalized methods of a class define the API of the class The parameters of an invocation are considered to be a message defining the details of the desired behavior. George Blankenship 12 George Blankenship 4

Instantiation Defined classes are used to create execution time object (instantiation of the class) The constructor method is responsible for initializing the object new creates an instance of the class The execution time name of the object is the handle to reference the object name.attribute is a reference to an attribute name. method(<message>) is an invocation of a method passing the message George Blankenship 13 Example Class Test methods: Test, behaviorone(parm1, parm2), behaviortwo(parm1,parm3) Instantiation of an object Test testing = new Test(); Referencing the object testing.behaviorone(7, testing ); testing.behaviortwo(37,59); George Blankenship 14 Inheritance One class can be used to derive another via inheritance Classes can be organized into hierarchies George Blankenship 15 George Blankenship 5

Encapsulation Attributes of the class are objects from other classes The methods of the class create a new API hiding the encapsulated objects API Class MainGUI encapsulates the complex AWT classes MainGUI API presents append(), addmenu(), addmenuitem(), message(), getclock() George Blankenship 16 Object Oriented Design Problem space broken into distinct components (classes) Each component solves a portion of the problem Communication protocol validation (SerialLink) AnswerConnection DialConnection EchoConnection ConfigurationPanel SerialConnection George Blankenship 17 Design Consideration Creation of objects A class that just creates the objects used in the solution Standardizes the creation of objects Structure of solution components Templates for the organization of the solution objects to simplify, clarify and standardize the organization Behavior of the solution components Templates for the behavioral properties of the solution objects to simplify, clarify and standardize the behavior George Blankenship 18 George Blankenship 6

Java Language A programming language specifies the words and symbols that we can use to write a program A programming language employs a set of rules that dictate how the words and symbols can be put together to form valid program statements The Java programming language was created by Sun Microsystems, Inc. and introduced in 1995. George Blankenship 19 Java Translation The Java compiler translates Java source code into a special representation called byte code Java byte code is not the machine language for any traditional CPU Another software tool, called an interpreter, translates Byte code into machine language and executes it Therefore the Java compiler is not tied to any particular machine Java is considered to be architecture-neutral George Blankenship 20 Java Code Basic unit of Java code is the object Software bundle of related state and behavior Programming problem is mapped into the interactions of objects Objectives Modularity Information-hiding Code re-use Pluggability and debugging ease Fundamental items of an object Attributes (properties, fields) object state Methods - modification of object state George Blankenship 21 George Blankenship 7

API Documents Unlike other languages, Java has many libraries bundled by default Application Programming Interface (API) docs, are the view given to the programmer Encouragement of code re-use Example: java.lang.string java.util.stringtokenizer George Blankenship 22 George Blankenship 8