©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
Lecture 1: Overview of Computers & Programming
Advertisements

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall A.1.
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
Chapter 1: An Overview of Computers and Programming Languages J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program.
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. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
CS 104 Introduction to Computer Science and Graphics Problems Basic Organization & Concepts 09/09/2008 Yang Song (Prepared by Yang Song and Suresh Solaimuthu)
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.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
©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 Lecture 1 Introduction to Computers and Object-
Topic 1: Introduction to Computers and Programming
©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.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Engineering Software Development Process.
CS102 Introduction to Computer Programming
Introduction To System Analysis and 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.
Chapter 1 An Overview of Computers and Programming Languages.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
1 CSC 1401 S1 Computer Programming I Hamid Harroud School of Science and Engineering, Akhawayn University
Topics Introduction Hardware and Software How Computers Store Data
©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.
COP1220/CGS2423 Introduction to C++/ C for Engineers Professor: Dr. Miguel Alonso Jr. Fall 2008.
CHAPTER ONE Problem Solving and the Object- Oriented Paradigm.
Chapter 1 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
SE-1010 Dr. Mark L. Hornick 1 Introduction to Object-Oriented Programming (OOP) Part 1.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Introduction To System Analysis and Design
CSCI 161: Introduction to Programming 1
S2008Final_part1.ppt CS11 Introduction to Programming Final Exam Part 1 S A computer is a mechanical or electrical device which stores, retrieves,
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.
Computer organization Practical 1. Administrative Issues The course requirements are: –To be nice and open minded –To pass the exam (there is a boolean.
CS 127 Introduction to Computer Science. What is a computer?  “A machine that stores and manipulates information under the control of a changeable program”
Beginning Snapshots Chapter 0. C++ An Introduction to Computing, 3rd ed. 2 Objectives Give an overview of computer science Show its breadth Provide context.
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.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
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.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
©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.
Chapter 1 An Overview of Computers and Programming Languages.
بسم الله الرحمن الرحيم 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.
Overview of Computers and Programming Chapter 1
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
Introduction to OOP with Java 4th Ed, C. Thomas Wu
Principles of Programming Languages
Chapter 6 Programming the basic computer
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

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

©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 Computer Hardware The CPU (central processing unit) is the heart of the computer RAM (memory) stores both programs and data External storage devices (disks) provide permanent storage for programs and data

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 8 Central Processing Unit Consists of –Arithmetic Logic Unit which does the actual work –Registers for temporary storage of data and results –Instruction register to store the current instruction –program counter which stores location of next instruction Instructions are low-level operations like –transfering data between memory and registers –arithmetic operations –comparisons

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 9 Memory Memory consists of a large number of bits whose value can be either 0 or 1 Memory is divided into words (32 bits commonly) which can be addressed individually 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 10 What is Programming 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 11 What is 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 12 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 13 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 14 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 15 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 16 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 17 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 18 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 19 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 20 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 21 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 22 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 23 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 24 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 25 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 26 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 27 Inheritance Hierarchy An example of inheritance hierarchy among different types of students. Student Graduate Undergrad Commuting Law Resident Masters Doctoral