Week 1 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.

Slides:



Advertisements
Similar presentations
Chapter 1 These slides for CSE 110 Sections are based in part on the textbook-authors’ slides, which are copyright by the authors. The authors state that.
Advertisements

Using Computers CS French Chapter 1.
16/13/2015 3:30 AM6/13/2015 3:30 AM6/13/2015 3:30 AMIntroduction to Software Development What is a computer? A computer system contains: Central Processing.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
How do we make our HelloTester.java program do something? The java in our HelloTester.java file won’t do anything by itself. We need to tell the computer.
CHAPTER 1 INTRODUCTION GOALS  To understand the activity of programming  To learn about the architecture of computers  To learn about machine code and.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
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.
Chapter 1 - Introduction. Ch 1Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
Microsoft Visual Basic 2012 CHAPTER ONE Introduction to Visual Basic 2012 Programming.
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
CS102 Introduction to Computer Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Section 2.1 Identify hardware Describe processing components Compare and contrast input and output devices Compare and contrast storage devices Section.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Topics Introduction Hardware and Software How Computers Store Data
Week 1 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Introduction to Computer Science.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Copyright © 2012 Pearson Education, Inc. Chapter 1 Introduction to Computing and Programming.
What is a Computer? An, electrical machine, that can be programmed to accept data (input), process it into useful information (output) and store it away.
Computer Hardware Introduction. Computer Hardware Introduction The basic form of a computer is this: PROCESSING MEMORY INPUTOUTPUT But let’s look inside.
Computer Hardware and Software Introduction Mr. Smith AP Computer Science A.
Big Java by Cay Horstmann Copyright © 2008 by John Wiley & Sons. All rights reserved. Chapter One: Introduction.
©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 1: Introduction 1 Chapter 1 Introduction.
Chapter 1 Introduction. Goal to learn about computers and programming to compile and run your first Java program to recognize compile-time and run-time.
Computer Hardware and Software Introduction Mr. Smith AP Computer Science A.
Chapter 1 CSIS-120: Java Intro. What is Programming?  A: It is what makes computer so useful.  The flexibility of a computer is amazing  Write a term.
Section 2 Section 2.1 Identify hardware Describe processing components Compare and contrast input and output devices Compare and contrast storage devices.
Big Java by Cay Horstmann Copyright © 2009 by John Wiley & Sons. All rights reserved. Chapter 1 – Introduction.
Introduction to Computer Systems and the Java Programming Language.
ICOM 4015: Advanced Programming Lecture 1 Big Java by Cay Horstmann Copyright © 2009 by John Wiley & Sons. All rights reserved. Reading: Chapter One: Introduction.
Big Java by Cay Horstmann Copyright © 2008 by John Wiley & Sons. All rights reserved. Chapter One: Introduction.
Big Java by Cay Horstmann Copyright © 2009 by John Wiley & Sons. All rights reserved. Chapter 1 – Introduction ( ปรับปรุง )
Copyright © 2014 by John Wiley & Sons. All rights reserved.1 Chapter 1 - Introduction.
The Mechanics Of Computers The Operating System (OS) & Hardware.
CHAPTER 1 INTRODUCTION. CHAPTER GOALS To understand the activity of programming To understand the activity of programming To learn about the architecture.
Mrs. Ulshafer August, 2013 Java Programming Chapter 1.
Fall 2006Slides adapted from Java Concepts companion slides1 Introduction Advanced Programming ICOM 4015 Lecture 1 Reading: Java Concepts Chapter 1.
Lesson 3 — How a Computer Processes Data Unit 1 — Computer Basics.
Jens Dalsgaard Nielsen Jan Dimon Bendtsen Dept. of Electronic Systems Basic Programming INS-basis GF, PDP and HST.
School of Computer Science & Information Technology G6DICP Introduction to Computer Programming Milena Radenkovic.
Multimedia and Computers Introduction to Computers.
1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to.
1 Software. 2 What is software ► Software is the term that we use for all the programs and data on a computer system. ► Two types of software ► Program.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Chapter 1 Introduction. Chapter Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
Chapter 1 09/04/13. Change Your Password  The command is: passwd In the lab first do : ssh -Y onyx  You will have to see me to change it, if you forget.
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
CHAPTER 1 INTRODUCTION. CHAPTER GOALS To understand the activity of programming To learn about the architecture of computers To learn about machine code.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
Week1: Introduction to Computer Networks. Copyright © 2012 Cengage Learning. All rights reserved.2 Objectives 2 Describe basic computer components and.
Chapter 1 - Introduction. Announcements Info Sheet Web Site: Lab Hours NotecardsPictures.
Microsoft Visual Basic 2015 CHAPTER ONE Introduction to Visual Basic 2015 Programming.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Introduction to Visual Basic 2008 Programming
Introduction
Chapter 1 – Introduction
Java programming lecture one
Goals To learn about computers and programming
Introduction CSC 111.
Computer Programming-1 CSC 111
Presentation transcript:

Week 1 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham

Week 1 Topics What is Programming? The Anatomy of a Computer Translating Human-Readable Programs to Machine Code The Java Programming Language Becoming Familiar with Your Computer Compiling a Simple Program Errors The Compilation Process

1.1.1 What is Programming? A computer must be programmed to perform tasks. Different tasks require different programs. A computer executes a sequence of very basic operations in rapid succession A program can balance a checkbook; process words; play a game A sophisticated program is composed of extremely primitive operations

1.1.1 What is Programming Cont. A typical primitive operation may be: –Put a red dot onto this screen position –Send the letter A to the printer –Get a number from this location in memory –Add up two numbers –If this value is negative, continue the program at that instruction The creation of a sophisticated program may require a team of many highly skilled programmers, graphic artists, and other professionals

1.1.2 The Anatomy of a Computer At the heart of a computer lies the central processing unit (CPU). It consists of a single chip (integrated circuit) or a small number of chips. The computer keeps data and programs in storage. There are two kinds of storage. Primary storage, also called random-access memory (RAM) or simply memory, is fast and expensive and is made from memory chips. It loses all its data when the power is turned off.

1.1.2 The Anatomy of a Computer Cont. Secondary storage, usually a hard disk, provides less expensive storage and persists without electricity. Some computers are self-contained units, whereas others are interconnected through networks. Home computers are usually connected to the internet via a dialup or broadband connection. Most computers have removable storage devices that can access data or programs such as floppy disks, flash drives, tapes or compact discs (CDs)

1.1.2 The Anatomy of a Computer Cont. The CPU, the RAM and the electronics controlling the hard disk and other devices are interconnected through a set of electrical lines called a bus A motherboard contains the CPU, the RAM and connectors to peripheral devices (monitor, speakers, printer, mouse, keyboard, etc.) The CPU reads machine instructions from memory which direct it to communicate with memory, secondary storage and peripheral devices

1.1.3 Translating Human-Readable Programs to Machine Code A CPU executes machine instructions Machine instructions are very simple, are encoded as numbers and stored in memory, and can be executed very quickly Because machine instructions are encoded as numbers, it is difficult to write programs in machine code High-level programming languages such as Java allow you to describe tasks at a higher conceptual level than machine code

1.1.3 Translating Human-Readable Programs to Machine Code Cont. These machine instructions: –Load the contents of memory location 40 –Load the value 100 –If the first value is greater than the second value, continue with the instructions that is stored in memory location 240 might be encoded something like this:

1.1.3 Translating Human-Readable Programs to Machine Code Cont. This Java code (high-level instructions): if (intRate > 100) System.out.println(“Interest rate error”); might be compiled and translated into A compiler is a sophisticated program that translates programs written in a high-level language into machine code

1.1.4 The Java Programming Language Java was originally designed for programming consumer devices, but it was first successfully used to write internet applets Java was designed to be safe and portable, benefiting both internet users and students Java has a very large library There are packages in the Java library for graphics, user interface design, cryptography, networking, sound, database storage, and many other purposes.

1.1.4 The Java Programming Language Cont. Even expert Java programmers cannot hope to know the contents of all of the packages Focus on learning those parts of the library that you need for your programming projects Although you will learn a good deal about the Java language and the most important library packages, keep in mind that the central goal of this course is not to make you memorize Java minutiae, but to teach you how to think about programming.

1.1.5 Becoming Familiar with Your Computer Learn how to log in Learn how to use a Java Integrated Development Environment (IDE) Understand how to work with files and file folders (directories) Begin by writing a simple Java program Save your work frequently and make back- up copies of your important files

1.1.6 Compiling a Simple Program File HelloTester.java: public class HelloTester { public static void main(String[] args) { // Display a greeting to the console window System.out.println(“Hello World!”); } Output: Hello, World!

1.1.6 Compiling a Simple Program Cont. Java is case sensitive. You must be careful about distinguishing between upper and lowercase letters. Lay out your programs so that they are easy to read Classes are the fundamental building blocks of Java programs Almost every Java application contains a class with a main method. When the application starts, the instructions in the main method are executed.

1.1.6 Compiling a Simple Program Cont. Each class contains definitions of methods Each method contains a sequence of instructions Use comments to help human readers understand your program A method is called by specifying an object, the method name, and the method parameters A string is a sequence of characters enclosed in quotation marks

1.1.6 Compiling a Simple Program Cont. Calling a Method: System.out.println(“Hello, World!”); Object MethodParameters

1.1.7 Errors A syntax error is a violation of the rules of the programming language. The compiler detects syntax errors. System.ouch.println(“Hello, World!”); A logic error causes a program to take an action that the programmer did not intend. You must test your programs to find logic errors. System.out.println(“Hello, Word!”);

1.1.8 The Compilation Process You use an editor to write your Java program statements When you save your program statements, it becomes source code and will have a.java extension, for example HelloTester.java A successful compile of your source code will create virtual machine instructions called class files and will have a.class extension, for example HelloTester.class

1.1.8 The Compilation Process Cont. From Source Code to Running Program Editor Source File Compiler Class files and Library files Virtual Machine Running Program

Reference: Big Java 2 nd Edition by Cay Horstmann What is Programming? (section 1.1 in Big Java) The Anatomy of a Computer (section 1.2 in Big Java) Translating Human-Readable Programs to Machine Code (section 1.3 in Big Java) The Java Programming Language (section 1.4 in Big Java) Becoming Familiar with Your Computer (section 1.5 in Big Java) Compiling a Simple Program (section 1.6 in Big Java) Errors (section 1.7 in Big Java) The Compilation Process (section 1.8 in Big Java) PC Block Diagram from: pagers.com/computer/pc-block-diagram.htm