Computer Science II 810:062 Section 01. How is CS I different from CS II? When you teach Java there are a series of decisions that have to be made…

Slides:



Advertisements
Similar presentations
AP Computer Science A – Healdsburg High School 1 Unit 3 - Classes and Objects - Example.
Advertisements

Chapter 10 THINKING IN OBJECTS 1 Object Oriented programming Instructor: Dr. Essam H. Houssein.
Lab#1 (14/3/1431h) Introduction To java programming cs425
Introduction to Object-Oriented Programming CS 21a: Introduction to Computing I First Semester,
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
Introduction To System Analysis and Design
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Road Map Introduction to object oriented programming. Classes
1 Classes Overview l Classes as Types l Declaring Instance Variables l Implementing Methods l Constructors l Accessor and Mutator Methods.
Object Oriented System Development with VB .NET
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Introduction to Java Programming, 4E
Evan Korth New York University Computer Science I Classes and Objects Professor: Evan Korth New York University.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
1 Basic Object Oriented Concepts Overview l What is Object-Orientation about? l What is an Object? l What is a Class? l Constructing Objects from Classes.
1 Programming Languages Translation  Lecture Objectives:  Be able to list and explain five features of the Java programming language.  Be able to explain.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
1 A Student Guide to Object- Orientated Development Chapter 9 Design.
Chapter 1 - Introduction. Ch 1Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
Options for User Input Options for getting information from the user –Write event-driven code Con: requires a significant amount of new code to set-up.
Introduction To System Analysis and design
TCU CoSc Introduction to Programming (with Java) Getting to Know Java.
Object Oriented Software Development
S.W. Ma/CIM/LWL41211/2 Prog. IIA Page 1 HKIVE (Lee Wai Lee Campus) Department of CIM Course : Year 2 Module : Programming IIA Textbook : Introduction.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Computer Science II 810:062 Section 01 Session 2 - Objects and Responsibilities.
Writing Classes (Chapter 4)
CS212: Object Oriented Analysis and Design Lecture 1: Introduction.
Introduction to Object-Oriented Programming
Week 3 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
Week 4 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Introduction To System Analysis and Design
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
Introduction to Java Programming with Forte Y. Daniel Liang.
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
Systems Analysis and Design in a Changing World, 3rd Edition
Introduction To JAVA By Ihtesham Ul Haq. Course Objectives Upon completing the course, you will understand Upon completing the course, you will understand.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
Week 4 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
CSSE501 Object-Oriented Development. Chapter 4: Classes and Methods  Chapters 4 and 5 present two sides of OOP: Chapter 4 discusses the static, compile.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Chapter 10 Defining Classes. The Internal Structure of Classes and Objects Object – collection of data and operations, in which the data can be accessed.
Object-oriented Design and Programming CS 2210: SW Development Methods Reading: Chapter 2 of MSD text – Section on UML: look at class diagrams but.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Objective You will be able to define the basic concepts of object-oriented programming with emphasis on objects and classes by taking notes, seeing examples,
Computer Science II 810:062 Section 01 Session 2 - Objects and Responsibilities.
CSIS 4850: CS Senior Project – Spring 2009 CSIS 4850: Senior Project Spring 2009 Object-Oriented Design.
Chapter 20 Concepts for Object-Oriented Databases Copyright © 2004 Pearson Education, Inc.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
5.1 Basics of defining and using classes A review of class and object definitions A class is a template or blueprint for an object A class defines.
OOP Basics Classes & Methods (c) IDMS/SQL News
Kyung Hee University Class Diagramming Notation OOSD 담당조교 석사과정 이정환.
1 Sections 6.4 – 6.5 Methods and Variables Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Object-Oriented Design
Java Software Solutions
Intro To Classes Review
Chapter 4: Writing Classes
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Review CSE116 2/21/2019 B.Ramamurthy.
Dr. R Z Khan Handout-3 Classes
Java Software Solutions
Introduction to Computer Science and Object-Oriented Programming
Presentation transcript:

Computer Science II 810:062 Section 01

How is CS I different from CS II? When you teach Java there are a series of decisions that have to be made…

How is CS I different from CS II? When you teach Java there are a series of decisions that have to be made… Applet or Applications Core Java or Textbook package IDE or command line Object Oriented or “structured” Event-driven or “Non-event driven”

When you teach Java there are a series of decisions that have to be made… Applet or Applications Core Java or Textbook package IDE or command line Object Oriented or “structured” Event-driven or “Non-event driven” How is CS I different from CS II?

When you teach Java there are a series of decisions that have to be made… Applet or Applications Core Java or Textbook package IDE or command line Object Oriented or “structured” Event-driven or “Non-event driven”

How is CS I different from CS II? CS I focuses on learning to program in the first place. CS II focuses on learning how to program well using the paradigm of Object Oriented Programming.

So what is OO programming? Object-oriented programming changes the way software developers think about the problem by redefining the problem. Object-oriented programming encourages us to think about the computer as a simulator of the world. Thus, a program is a map of the world we want to imitate.

So what is OO programming? Instead of asking –How can I write a program that is structured like the machine on which it runs? We ask –How can I write a program that is structured like the part of the world it describes?

So what is OO programming?

The anatomy of an OO program The world consists of objects that interact to solve a problem.

So what is OO programming? “In Java, the main thing you do is write class definitions.” (R. Morelli) A class definition encapsulates two (three actually) things: –Data (instance variables) –Actions (constructors and methods).

So what is OO programming? But a class on its own is nearly worthless. The purpose of a class is to serve as a template for creating individual objects, or instances, of the class.

The anatomy of an OO program An object is an instance of a class MemoPad p = new MemoPad(); While a class describes a set of objects that behave similarly, each instance of a class is distinct and has its own state. MemoPad p = new MemoPad(); MemoPad q = new MemoPad();

So what is OO programming? an object-oriented program is a set of objects that collaborate to achieve a goal objects interact by sending each other messages (invoking an object’s method).

Let’s consider a MemoPad example Allows for the storage of a collection of memos that are associated with keys

For example, you can insert an memo:

Identify the objects needed in the MemoPadApp example List the objects and their behaviors

What came first the chicken or the egg? Since objects create other objects dynamically as needed, where does the first object come from?

The anatomy of an OO program The world is a class that contains the main() function. main() is the “big bang” that creates one or more objects. public class MemoPadApp { public static void main( String [] args ) { MemoPad p = new MemoPad(); p.show(); } // end main } // end class MemoPadApp

So what is OO programming? Notice that “main” is a static method. We will discuss what static means in more detail later this semester, but for now you can think of this modifier as saying that main is associated with the class memoPadApp, and not with any instance of the class. “main” is a class method.

So what is OO programming? an object-oriented program is a set of objects that collaborate to achieve a goal objects interact by sending each other messages (invoking an object’s method).

So how do objects collaborate? They send one another messages. In response to a message, an object executes the method associated with the message that it receives, both names and arguments. A big part of designing an object-oriented system is deciding what messages each object should respond to. The set of messages to which an object responds is called its interface.

Designed an interface for the memo database class the memo database class is used to hold the actual memos being stored its interface is the set of messages to which it should respond

Think about: What is the behavior of a memo database? What should it do in order to contribute to the world of objects that implements the behavior of a memo pad?

Interface for the memo database public interface MemoDatabase { } // end interface MemoDatabase

Interface for the memo database public interface MemoDatabase { public String find ( String key ); } // end interface MemoDatabase

Interface for the memo database public interface MemoDatabase { public String find ( String key ); public boolean remove ( String key ); public boolean insert (MemoAssociation m); public boolean containsKey( String key ); } // end interface MemoDatabase

For next class Read chapter 1. Identify any concepts or terms that are new to you so we can discuss them. Re-acquaint yourself with the Java tools available at home or in the lab. Download the MemoPad code from the course Java page, and play with it.