©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.

Slides:



Advertisements
Similar presentations
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Advertisements

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall A.1.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
Introduction to Computer Science CS 21a: Introduction to Computing I Department of Information Systems and Computer Science Ateneo de Manila University.
Introduction To System Analysis and Design
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
Introduction to Computers and Java Recitation - 01/11/2008 CS 180 Department of Computer Science, Purdue University.
COMPSCI 125 Spring 2011 Section What is computer science? … the study of the theoretical foundations of information and computation and their implementation.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
CSCI 3 Introduction to Computer Science. CSCI 3 Course Description: –An overview of the fundamentals of computer science. Topics covered include number.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
Java Programming, 3e Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Object-oriented programming concepts An Introduction.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
Chapter Chapter 1 Introduction to Object-Oriented Programming and Software Development.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Copyright 2004 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Lecture 1 Introduction to Computers and Object-
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 0 Introduction to Computers and Programming.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 1 Introduction to Object-Oriented Programming.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Engineering Software Development Process.
Chapter 1 Introduction to Computers and C++ Programming.
Introduction To System Analysis and design
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
CS130 Introduction to Programming with VB 6.0 Fall 2001.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 0 - Introduction to Computers and Programming.
CS 21a: Intro to Computing I Department of Information Systems and Computer Science Ateneo de Manila University.
1 CSC 1401 S1 Computer Programming I Hamid Harroud School of Science and Engineering, Akhawayn University
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 1: Introduction to Object-Oriented Programming.
BCS 2143 Introduction to Object Oriented and Software Development.
1 CS 456 Software Engineering. 2 Contents 3 Chapter 1: Introduction.
CHAPTER ONE Problem Solving and the Object- Oriented Paradigm.
SE-1010 Dr. Mark L. Hornick 1 Introduction to Object-Oriented Programming (OOP) Part 1.
Copyright 2001 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix A Object-Oriented.
3rd Country Training, K.Subieta: System Engineering and Databases. Lecture 3, Slide 1 February 20, 2004 Lecture 3: Introduction to Software Analysis and.
Introduction To System Analysis and Design
Building Java Programs Chapter 1 Introduction to Java Programming Copyright (c) Pearson All rights reserved.
CSCI 161: Introduction to Programming 1
Object-oriented programming concepts An Introduction.
Visual C++ Programming: Concepts and Projects
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
BCS 2143 Object Oriented Design Using UML. Objectives Objects Interactions Finding Classes Relationship Between Classes Attribute and Operation Class.
© 2000 McGraw-Hill Modified by C.W.Pang with author's permission Intro to OOP with Java--Wu Chapter Chapter 1 Introduction to Object-oriented Programming.
CS 127 Introduction to Computer Science. What is a computer?  “A machine that stores and manipulates information under the control of a changeable program”
Chapter 1 : Overview of Computer and Programming By Suraya Alias
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Getting Started with Java: Object declaration and creation Primitive.
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,
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Appendix A Object-Oriented Analysis and Design A.1.
Systems Analysis & Programming 10.1 Systems Development 10.2 Programming: A Five-Step Procedure Generations of Programming Languages 10.4 Programming.
بسم الله الرحمن الرحيم CPCS203: Programming II. ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display., Modifications by Dr.
Introduction to Computers and Programming Languages CS 180 Department of Computer Science Purdue University.
Introduction to OOP with Java 4th Ed, C. Thomas Wu
CS 21a: Intro to Computing I
Computer Science I CSC 135.
Appendix A Object-Oriented Analysis and Design
CompSci 1: Principles of Computer Science Lecture 1 Course Overview
Appendix A Object-Oriented Analysis and Design
Appendix A Object-Oriented Analysis and Design
Intro to OOP with Java, C. Thomas Wu
Presentation transcript:

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 2 What is computer science? … the study of the theoretical foundations of information and computation and their implementation and application in computer systems From Wikipedia

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 3 Computer Science has many subfields Computer architecture Algorithms Programming languages and compilers Databases Operating systems Networking Computer security Software engineering Artificial intelligence Computer graphics Theory of computation

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 4 Fields that depend on computer science Scientific computing Bioinformatics Cryptography Simulation Weather modeling

Computer Science is a relatively new field First programmable electronic computer, ENIAC, was built around 1945 Technology has changed dramatically –First computers built using vacuum tubes –Transistors soon replaced vacuum tubes –Integrated circuits allowed computers to get small and inexpensive Early computers were isolated –Networks allow computers to talk to each other

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 6 Computer Architecture CPU Output Devices Output Devices Commu- nication Devices Commu- nication Devices Input Devices Input Devices RAM Storage Devices Storage Devices

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 7 Information Storage The devices used to store information in computers have two possible states –0 or OFF –1 or ON All information needs to be stored in binary format –base 2 numbers for integers –base 2 scientific notation for real numbers –integer code for characters –instructions that make up executable programs are binary words

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 8 Software Computer hardware, by itself, isn't very useful. Software is what we use to make the computer do what we want it to. A program is a sequence of instructions that will be executed by a computer. –The operating system is a special program that manages our interactions with the computer.

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 9 Software Development Process Describe what the program needs to do Analyze the problem and determine how to solve it Write the program Test the program Maintain the program

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 10 Programming To write a program, you need to learn a language that can be converted into a form that the computer can understand –Early languages were designed to make this conversion easy –Modern languages are designed for the convenience of the programmer Java is a high-level object-oriented language

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 11 Programming Languages Machine Language Machine language instructions (very low level) are sequences of 0s and 1s. Assembly Languages Assembly language is a mnemonic representation of machine language. An assembler translates assembly language into machine language. High-level Languages High-level languages provide a very high conceptual model of computing. A compiler translates high-level programs into machine language instructions.

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 12 Types of Languages Procedural languages approach programming as a sequence of operations on data Functional languages (LISP) consider a program to be a series of functions that map the input data to some desired output Object-oriented languages model the world as a collection of objects –every object has properties (data) that represent its state –objects have behavior (operations) associated with them

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 13 What you'll learn in this course Basic Computer Science concepts Problem solving –object-oriented approach How to program (software development) –Java programming language

Object-Oriented Programming One way to think of a program is as a sequence of operations on data. –a program is a collection of procedures that are executed in a particular order For large programs, this approach can be hard to manage An object-oriented program consists of a group of objects which interact with each other –provides modularity –allows for reuse –models the real world

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 15 Objects An object is a thing, (tangible or intangible). –Account –Vehicle –Employee Objects can have –Properties –Behavior

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 16 Classes To create an object inside the computer program, we must first provide a definition or template for that particular kind of object –how it behaves –what properties it has We call this definition a class Every object is an instance of some class. –Multiple objects can be created from a single class

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 17 Data and Methods Properties of an object are represented by data values Behavior of objects is implemented by the methods in a class –Send a message to an object by calling one of its methods Two types of data and methods –Class methods and data are shared by all objects –Instance data and methods are associated with a particular object

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 18 Classes and Objects A class is a template that defines what properties and behavior a particular type of object has –Class diagram An object is an instance of a class –You can have many instances of a class –Object diagram :

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 19 Unified Modeling Language A language for graphically describing classes, objects and programs We'll use a subset of this language in this class. –Object diagrams –Class diagrams State-of-memory diagrams use UML as well Tools on onyx –violet (a Java program) –dia (a Linux tool)

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 20 Graphical Representation of a Class The notation we used here is based on the industry standard notation called UML, which stands for Unified Modeling Language. We use a rectangle to represent a class with its name appearing inside the rectangle. Example: Account Motorcycle

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 21 Graphical Representation of an Object We use a rectangle to represent an object and place the underlined name of the object inside the rectangle. Examples: SV198 : This notation indicates the class which the object is an instance. SV198 : BankAccount

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 22 Sending a Message deposit Message deposit with the argument is sent to a BankAccount object SV198. SV198 : BankAccount To instruct an object to perform a task, we send a message to it. The class an object belongs to must possess a matching method to be able to handle the received message. A value we pass to an object when sending a message is called an argument.

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 23 Sending a Message and Getting an Answer current balance getCurrentBalance() Ask for the current balance of this particular account. SV198 : BankAccount The current balance of SV198 is returned.

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 24 Class and Instance Data Values An object is comprised of data values and methods. An instance data value is used to maintain information specific to individual instances. For example, each BankAccount object maintains its balance. A class data value is used to maintain information shared by all instances or aggregate information about all instances. For example, minimum balance is the information shared by all Account objects, whereas the average balance of all BankAccount objects is an aggregate information.

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 25 SV098 : BankAccountSV211 : BankAccountSV129 : BankAccount Data Values in Object Diagrams current balance All BankAccount objects possess the same instance data value current balance. The actual dollar amounts are, of course, different. Object Diagram with Class Data Value SV129 : BankAccount current balance minimum balance

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 26 Inheritance Inheritance is a mechanism in OOP to design two or more entities that are different but share many common features. –Features common to all classes are defined in the superclass. –The classes that inherit common features from the superclass are called subclasses. We also call the superclass an ancestor and the subclass a descendant.

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 27 A Sample Inheritance Here are the superclass Account and its subclasses Savings and Checking. Account Checking Savings

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 28 Inheritance Hierarchy An example of inheritance hierarchy among different types of students. Student Graduate Undergrad Commuting Law Resident Masters Doctoral