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

Slides:



Advertisements
Similar presentations
Introduction to Computer Programming I CSE 113
Advertisements

Introduction To System Analysis and Design
Introduction to Computers and Java Recitation - 01/11/2008 CS 180 Department of Computer Science, Purdue University.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
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.
©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.
● Basic Computation Recitation – 09/(04,05)/2008 CS 180 Department of Computer Science, Purdue University.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Computing Components 01/26/11. Announcements & Reminders Programs 1 due Friday, 9/2/11 What is my late policy? Proxy Codes for Labs  You should be able.
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.
©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 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.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
Computer Programming-1 CSC 111 Chapter 1 : Introduction.
WEEK 1 CS 361: ADVANCED DATA STRUCTURES AND ALGORITHMS Dong Si Dept. of Computer Science 1.
Introduction To System Analysis and design
Lecture 1 Introduction to Java MIT- AITI 2004 What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
CS 0004 –Lecture 1 Wednesday, Jan 5 th, 2011 Roxana Gheorghiu.
©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.
Chapter 8 More Object Concepts
CSM-Java Programming-I Spring,2005 Objects and Classes Overview Lesson - 1.
OBJECT AND CLASES: THE BASIC CONCEPTS Pertemuan 8 Matakuliah: Konsep object-oriented Tahun: 2009.
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.
Lecture 1 Introduction to Java MIT-AITI Ethiopia 2004.
5 Systems Analysis and Design in a Changing World, Fourth Edition.
Introduction To System Analysis and Design
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
Object-oriented programming concepts An Introduction.
1 CSC204 – Programming I Lecture 2 Intro to OOP with Java.
Fundamental Programming: Fundamental Programming K.Chinnasarn, Ph.D.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
BCS 2143 Object Oriented Design Using UML. Objectives Objects Interactions Finding Classes Relationship Between Classes Attribute and Operation Class.
Programs and Classes A program is made up from classes Classes may be grouped into packages A class has two parts static parts exist independently Non-static.
© 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.
Chapter 4 Introduction to Classes, Objects, Methods and strings
CS451 - Lecture 2 1 CS451 Lecture 2: Introduction to Object Orientation Yugi Lee STB #555 (816) * Acknowledgement:
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,
Next Back MAP MAP F-1 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All.
©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.
بسم الله الرحمن الرحيم CPCS203: Programming II. ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display., Modifications by Dr.
5 Systems Analysis and Design in a Changing World, Fourth Edition.
Roberta Roth, Alan Dennis, and Barbara Haley Wixom
Topics Introduction Hardware and Software How Computers Store Data
Lecture 1: Introduction to JAVA
GC101 Introduction to computers and programs
Introduction to OOP with Java 4th Ed, C. Thomas Wu
CS 1308 Exam 2 Review.
CS190/295 Programming in Python for Life Sciences: Lecture 1
Topics Introduction Hardware and Software How Computers Store Data
Software Engineering System Modeling Chapter 5 (Part 1) Dr.Doaa Sami
Workshop for Programming And Systems Management Teachers
DON’T PANIC!! Lots of new notions coming in these slides
Intro to OOP with Java, C. Thomas Wu
Introduction to Computer Science and Object-Oriented Programming
Presentation transcript:

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

2 Reminders and Announcements Course webpage:   Syllabus  Lecture and recitation slides are available  Projects  Course policies (note the integrity policy)

Reminders and Announcements Class newsgroup:  purdue.class.cs180  Project information and answers to questions will be posted to the newsgroup; posts by grad TAs are official  You are responsible for knowing all information posted, including changes to assignments A newsgroup client such as Mozilla Thunderbird or Microsoft Outlook can access the class newsgroup.

4 Reminders and Announcements Discussion Groups/Mentoring  Facilitated by Debbie Perouli  Discussion of CS180 related material  When: Tue-Thur 5 to 7 in LWSN B116  Extra credit: 1/3 point (max of 5 total for the semester) for each session attended  More information to come later

5 Reminders and Announcements Recitations  A chance to ask questions  Examples  Review of/for exams  Introduction/solutions to assignments Plenty of help is available for this course. Make sure to take advantage of it if you need to.

6 Reminders and Announcements Projects  Generally 1 per week or equivalent.  Released on course web page  Each led by 1 TA  Consulting available in the lab, mon, tue and wed 7-10 pm.  Make sure your project compiles. If it doesnt, you will get a 0. Book  Read it, if something is unclear, ask.  You will be surprised how useful it can be.

7 Recall the Basics Hardware - physical devices (CPU, disks) Software - information stored in hardware  Instructions - executed by the CPU  Data - manipulated by CPU A program is a list of instructions for the CPU used to achieve a goal. Similar to:  recipes used to create some food  designs used to construct a model  driving instructions to reach a destination Input / Output

8 Recall the Basics Computer science is about analyzing problems and information.  In here, we do this through creating programs  We must properly express and model the problems that we analyze.

9 Recall the Basics To create programs, we use a programming language  Human readable format for computer instructions  Written in text files (source code) and converted (compiled) into a usable form (e.g. machine language) In this course we will work with the Java programming language  purely Object-Oriented. (Modeling!)  compiled to Byte Code.  interpreted by the JVM

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 10 Data All data in a high level language has a type.  What kind of thing does the data represent?  Numbers, Text, Cats, Dogs, Weevils Every piece of data is stored at some place in memory. An object is a collection of some data along with pieces of code that can manipulate that data. (Simplify program design)

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 11 Classes and Objects An object represents a discrete concept, such as a particular Student, Car, or ATM Similar objects share characteristics and behavior. They are grouped into a class.  (Professor Y and Professor Z are both professors) A class defines the data and behaviors of an object.  A class is a cookie cutter; an object is a cookie  The Platonic ideals and their instantiations! (Applied philosophy) An object is called an instance of a class.

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 12 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. 13 Graphical Representation of an Object We use a rectangle to represent an object and place the underlined name of the object inside the rectangle. Example: SV198 This is an object named SV198.

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 14 An Object with the Class Name : This notation indicates the class which the object is an instance of. This indicates that object SV198 is an instance of the BankAccount class. Example: SV198 : BankAccount

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 15 Messages and Methods To instruct a class or an object to perform a task (behavior), we send a message to it.  (Tell a car to drive forward) A class or an object must possess a matching method to be able to handle the received message.  (A car has no method to hover, so it cannot respond to a hover message) A value we pass to an object when sending a message is called an argument of the message.  (Tell a car to drive forward 3 miles)

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 16 Methods What is encapsulation, and how do methods and objects help provide it?

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 17 Sending a Message deposit (250.00) Message deposit with the argument is sent to a BankAccount object SV198. SV198 : BankAccount

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 18 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. 19 Calling a Class Method maximum speed MobileRobot getMaximumSpeed() Ask for the maximum possible speed for all MobileRobot objects. How do class and object methods differ?

20 Class and Instance Data Values An object comprises data values and methods. An instance data value is used to maintain information specific to individual instances  each BankAccount object maintains its own balance A class data value is used to maintain information shared by all instances or aggregate information about the instances  E.g. minimum balance  Reduces duplication, prevents errors

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 21 SV098 : BankAccountSV211 : BankAccountSV129 : BankAccount Sample Instance Data Value current balance All three BankAccount objects possess the same instance data value current balance. The actual dollar amounts are, of course, different.

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 22 Sample Class Data Value SV098 : BankAccountSV211 : BankAccountSV129 : BankAccount current balance BankAccount minimum balance There is one copy of minimum balance for the whole class and shared by all instances. This line is an instance-of relationship.

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 23 Object Icon with Class Data Value When the class icon is not shown, we include the class data value in the object icon itself. SV129 : BankAccount current balance minimum balance

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 24 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. 25 A Sample Inheritance Here are the superclass Account and its subclasses Savings and Checking. Account Checking Savings Superclass (Ancestor) Subclass (Descendent)

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 26 Inheritance (cont.) The account class may define  Owner’s Name(s)  Getbalance The Checking class may define  Minimum (checking) balance  ATM transactions The Savings class may define  Minimum (savings) balance  Interest rate  Pay interest

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

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 28 Software Engineering Much like building a skyscraper, we need a disciplined approach in developing complex software applications. Software engineering is the application of a systematic and disciplined approach to the development, testing, and maintenance of a program. In this class, we will learn how to apply sound software engineering principles when we develop sample programs.

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 29 Software Life Cycle The sequence of stages from conception to operation of a program is called the software life cycle. Five stages are  Analysis  Design  Coding  Testing  Operation and Maintenance Remember these during projects!

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 30 Quiz 1. In 6 lines or less, describe to a computer how to put on a belt. 2. If my program does not work as I expect it to, what should I do? a. Give up, its not worth the time. b. Blame my TA. c. Throw my computer out of the window and get my parents to buy me a new one. d. Take a deep breath, clear my head, and try to figure out what I did wrong.