CS 201 Problem Solving with Computers

Similar documents
CS 1124 Media Computation. Steve Harrison Lecture 1.2 (August 27, 2008)

8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics

Computer Basics 1/6/16. Computer Organization. Computer systems consist of hardware and software.

Chapter 1: Introduction to Computer Science and Media Computation

Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming

Computer Basics 1/24/13. Computer Organization. Computer systems consist of hardware and software.

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming

C H A P T E R 1. Introduction to Computers and Programming

Elements of Computers and Programming Dr. William C. Bulko. What is a Computer?

Week 2: Data and Output

COS 140: Foundations of Computer Science

An Overview of the Computer System. Kafui A. Prebbie 24

HARDWARE. There are a number of factors that effect the speed of the processor. Explain how these factors affect the speed of the computer s CPU.

SOEE1160: Computers and Programming in Geosciences Semester /08. Dr. Sebastian Rost

Jython. secondary. memory

Computer Principles and Components 1

CS101 Lecture 24: Thinking in Python: Input and Output Variables and Arithmetic. Aaron Stevens 28 March Overview/Questions

7/28/ Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc.

CSc 10200! Introduction to Computing. Lecture 1 Edgardo Molina Fall 2013 City College of New York

01 INTRODUCTION TO COURSE

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

EKT 120/4 Computer Programming KOLEJ UNIVERSITI KEJURUTERAAN UTARA MALAYSIA

ECS15, Lecture 10. Goals of this course 2/8/13. Mini-Review & Topic 3.2 Software. Today s agenda

CS102 Unit 2. Sets and Mathematical Formalism Programming Languages and Simple Program Execution

CMPSCI 201: Architecture and Assembly Language

Admin. ! Assignment 3. ! due Monday at 11:59pm! one small error in 5b (fast division) that s been fixed. ! Midterm next Thursday in-class (10/1)

Introduction to Python: Data types. HORT Lecture 8 Instructor: Kranthi Varala

CS 121 Intro to Programming:Java - Lecture 2. Professor Robert Moll (+ TAs) CS BLDG

Introduction to Computer Systems

Why Operating Systems? Topic 3. Operating Systems. Why Operating Systems? Why Operating Systems?

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

538 Lecture Notes Week 1

Chapter 11 Program Development and Programming Languages

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

CSC 101: Lab Manual#9 Machine Language and the CPU (largely based on the work of Prof. William Turkett) Lab due date: 5:00pm, day after lab session

Computer Architecture Review. ICS332 - Spring 2016 Operating Systems

CHAPTER 1 Introduction to Computers and Java

Programming with Python

CS 121 Intro to Programming:Java - Lecture 2. Professor Robert Moll (+ TAs) CS BLDG

CS61C : Machine Structures

Laboratory. Low-Level. Languages. Objective. References. Study simple machine language and assembly language programs.

Computer Organization & Assembly Language Programming (CSE 2312)

CS240: Programming in C

Lecture 1: What is a computer?

Chapter 2: Introduction to Programming

Introduction to Computer Systems

CPS122 Lecture: Course Intro; Introduction to Object-Orientation

Introduction to Computer Systems

Chapter 9: A Closer Look at System Hardware

Chapter 9: A Closer Look at System Hardware 4

CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007

Welcome to Computer Organization and Design Logic

Welcome to. Instructor Marc Pomplun CS 470/670. Introduction to Artificial Intelligence 1/26/2016. Spring Selectivity in Complex Scenes

CS Computer Architecture Spring Lecture 01: Introduction

COMP 102: Computers and Computing

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Machine Architecture and Number Systems CMSC104. Von Neumann Machine. Major Computer Components. Schematic Diagram of a Computer. First Computer?

Chapter 2: Introduction to Programming

Bits, bytes, binary numbers, and the representation of information

Survey. Motivation 29.5 / 40 class is required

LCC 6310 The Computer as an Expressive Medium. Lecture 1

Computing and compilers

Worksheet - Storing Data

Memory Addressing, Binary, and Hexadecimal Review

CPS122 Lecture: From Python to Java last revised January 4, Objectives:

Chapter 1: Introduction to Computers and Java

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

Digital Circuits ECS 371

Computer Programming for Engineering

CS 432 Fall Mike Lam, Professor. Compilers. Advanced Systems Elective

2/15/2008. Announcements. Programming. Instruction Execution Engines. Following Instructions. Instruction Execution Engines. Anatomy of a Computer

CSE 114, Computer Science 1 Course Information. Spring 2017 Stony Brook University Instructor: Dr. Paul Fodor

Welcome to COMPSCI111/111G!

Software Development. Integrated Software Environment

ETGG1801 Game Programming Foundations I Andrew Holbrook Fall Lecture 0 - Introduction to Computers 1

Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently.

Microcontrollers. What is a Microcontroller. Setting up. Sample First Programs ASCII. Characteristics Basic Stamp 2 the controller in the Boe Bot

Principles in Programming: Orientation & Lecture 1. SWE2004: Principles in Programming Spring 2015 Euiseong Seo

Chris Riesbeck, Fall Introduction to Computer Systems

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 4

Chapter 1. Hardware. Introduction to Computers and Programming. Chapter 1.2

Android System Architecture. Android Application Fundamentals. Applications in Android. Apps in the Android OS. Program Model 8/31/2015

CS Computer Architecture

Practical Programming, Third Edition

Lecture 1. Course Overview, Python Basics

Drawing Courses. Drawing Art. Visual Concept Design. Character Development for Graphic Novels

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2.

CS Prof J.P.Morrison

CPS122 Lecture: From Python to Java

Introduction to JES and Programming. Installation

Lecture 1. Course Overview, Python Basics

Lecture 20: Virtual Memory, Protection and Paging. Multi-Level Caches

MAKING TABLES WITH WORD BASIC INSTRUCTIONS. Setting the Page Orientation. Inserting the Basic Table. Daily Schedule

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction

Discussion. Why do we use Base 10?

Chapter 1 Introduction to Computers, Programs, and Java

Introducing the Haiku Operating System

Fig 1.1 A designer working on a personal computer

Introduction to Python

Introduction to Computer Systems

Transcription:

Welcome to CS 201 Problem Solving with Computers Dr., Dept. of Computer Science

Welcome Lectures on Mondays & Wednesdays Labs on Tuesdays & Thursdays Course website at http://www2.cs.siu.edu/~wainer/201f11/cs201f11outline.html e-mail wainer@cs.siu.edu Textbook is Introduction to Computing and Programming in Python: A Multimedia Approach by Mark J. Guzdial and Barbara Ericson

Introduction 1) What is Computer Science about? 2) Basics of Computers and programming 3) Media Computation 4) Computer Science for Everyone thinking about process, information and communication

Recipes? Text uses the analogy of recipes. Instructions on how to accomplish a task. Inputs (the ingredients) Outputs (the results created)

Recipes? Text uses the analogy of recipes. Instructions on how to accomplish a task. Inputs (the ingredients) Outputs (the results created) computer does the recipe

Studying Recipes Computer Science studies aspects of recipes How to construct appropriate recipes (software engineering, algorithms) Ingredients to use and how to organize them (information, data structures, databases) Adapting recipes for different types/systems of cooks (systems:mobile, cloud, parallel etc., theory) Considering how well the recipes satisfy the customers/users (UI Design)

Computer Science Many different specialties covered by a variety of conferences, journals, magazines, special interests groups, societies etc. Association for Computing Machinery SIGART SIGCHI SIGWEB SIGCSE SIGARCH SIGCHI SIGGRAPH SIGBioinformatics SIGMOBILE International Society for Computers and their Applications

Why Bother Learning to Program? As a user, you use software that already exists. It may not be what you really want. Programmers have the ability to create new (or customize existing) software to better match their needs. Programming is a challenging creative activity. It helps in understanding and communicating ideas of process. (including its limits and potential) Everyone should learn to program Alan Perlis

Programming Programming can range from very small code snippets which quickly do a tedious task up to constructing very large systems for very specific cases. Millions of lines of code are now used in aircraft and even luxury cars. (10s of millions in modern operating systems.) Many systems allow users/programmers to add custom features through programming. OpenSource projects have code which is freely available to examine and modify (you don't need to start from scratch).

How a Computer Works (recipe model) output input processing unit

How a Computer Works (simplified model) output CPU ( Central Processing Unit ) Main Memory input Disk

What Computers Understand CPU ( Central Processing Unit ) Main Memory All information is represented as 1s and 0s grouped together as chunks of data stored in memory. The CPU has a simple set of instructions to read/write data from memory, make comparisons, move to internal registers, do simple arithmetic (+,-,*,/) and obtain the next instruction. These operations are done FAST and we can build up more complex things from simple parts.

It's all 1s and 0s - Encodings Everything is memory is just 1s and 0s (bits). The CPU can fetch what bits are at a particular memory address. The sequence is interpreted according to an encoding. For instance, 8 bits (a byte) can be interpreted as a decimal number address in Main Memory 7 6 5 4 3 2 1 0 0 0 1 0 1 0 0 1 2 6 2 4 2 2 64 + 16 + 4 = 84

Encodings can be Layered What does the 84 mean? It depends upon its encoding. For instance to store letters in memory each letter is given a numerical code. In the commonly used ASCII system, 84 maps to the letter T. A string of characters could be represented by a sequence of ASCII codes. 7 6 5 4 3 2 1 0 0 0 1 0 1 0 0 1 2 6 2 4 2 2 64 + 16 + 4 = 84 ASCII T

Software Determines the Encodings Each program must know how to interpret the data properly. That same 84 might be used to represent: Part of a larger number (8 bits of 32 bits ) Part of a data record (model no. for part database etc.) Part of an instruction code (CPU instruct. also in mem.) Red component for a pixel within an image Width of an image media Sample for a sound signal } Some interpretations are lower level than others. It's up to the software to make the correct interpretation.

Examples A web browser interprets data as text, and the text as page layout instructions. <p>a <b>flowchart</b> is a type of <a href="/wiki/diagram" title="diagram">diagram</a> that represents an <a href="/wiki/algorithm" title="algorithm">algorithm</a> or <a href="/wiki/process_(science)" title="process (science)">process</a>, showing the steps as boxes of various kinds, and their order by connecting these with arrows. If we wrote our own card game program, we would have to develop an encoding too.??? playerid no. cards card.0 card.1...

Software is also encoded CPU ( Central Processing Unit ) OS Main Memory app Disk Operating System and Application software are loaded and encoded into memory. The CPU reads memory to find out what instructions to do next thus executing the programs. We use special development programs and the OS to create, load and execute our own code.

Assignments Read Chapter 1 and start on Chapter 2. Lab Preview: (Tue & Thur afternoons) We'll look at the ideas of encoding characters with ASCII. Different applications can interpret/display the same data differently and we can use this to our advantage to get the format most useful to us. We start to think about telling the computer what we want it to do. Introduce flow charting and the JES (python programming) curchar = 1st character of thestring is curchar valid? N End

UG CS Major Orientation Thursday, Aug 25 4-6 Eng. Bldg, Alumni Lounge A131 Questions? Call 536-2327 CS Main Office

Remember, software is also encoded Operating System and Application software are loaded and encoded into memory. CPU ( Central Processing Unit ) OS Main Memory app Disk The CPU reads memory to find out what instructions to do next thus executing the programs. CPUs only understand simple instructions: LDA, STA etc. Luckily the power of computers continues to increase!

Moore's Law Number of transistors which can be placed on a chip doubles every 2 years! Exponential improvement relates to speed & memory size as well.

Programming Languages Rather than programming for the very low level CPU, programs (recipes) are more often written in higher level programming languages. Programming Languages main() { main() {... } source code translate 0110011 0111100 1100001 1101010 machine code

Programming Languages Rather than programming for the very low level CPU, programs (recipes) are more often written in higher level programming languages. Programming Languages main() { main() {... } source code Another CPU, another machine language translate 0110011 0111100 1100001 1101010 1101001 1000010 1110010 0111101 010 0000100 1110010 1111010 1010000 machine code

Programming Languages Rather than programming for the very low level CPU, programs (recipes) are more often written in higher level programming languages. Programming Languages C Fortran Another CPU, another machine language main() { Cobol Basic source code translate 0110011 0111100 1100001 1101010 1101001 1000010 1110010 0111101 010 0000100 1110010 1111010 1010000 machine code

Programming Languages Sometimes, rather than targeting a specific machine, code is translated to another language instead. This can make it easier to port code across different platforms. Portability becomes a problem!!! Python Can write the translator for one language using an existing language Application C translate 0110011 0111100 1100001 1101010 1101001 1000010 1110010 0111101 010 0000100 1110010 1111010 1010000 machine code {Open Source}

Programming Languages Another approach uses a layer of software to wrap the real hardware/system with a virtual one. Languages can then be target to the virtual system. Virtual Machines can wrap actual hardware Python vm Can write the translator for one language using an existing language Jython Java C translate 00001001 11001011 11010101 0000 vm vm 0110011 0111100 1100001 1101010 1101001 1000010 1110010 0111101 010 machine code

Jython is Python Python is a general purpose high-level programming language (often used as a scripting language). design philosophy emphasizes code readability large standard library ( batteries included ) dynamically typed automatic memory management supports multiple programming styles (structured, OO..) uses indentation to form code blocks (not { } etc.) free open source reference implementation

JES Overview Program Area Command Area

Sample Code variable with dynamic typing for loop coding is about naming bring in another module import string letters = string.ascii_letters for letter in letters: print letter +, + str(ord(letter)) string indent display a readable representation functions Start assign letters letter = 1st character of letters Is letter valid? Y N End Y Print letter & code letter = next character of letters