Week 1 - Wednesday CS 121.

Slides:



Advertisements
Similar presentations
Hardware Lesson 3 Inside your computer.
Advertisements

Computer Organization. The Nature of Data Spreadsheets give us a way to create processes that manipulate data We can think of a piece of data as a quantity.
Week 1 - Wednesday.  What did we talk about last time?  Syllabus  Computers.
Lecture 1: Intro to Computers Yoni Fridman 6/28/01 6/28/01.
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.
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
Computer Systems CS208. Major Components of a Computer System Processor (CPU) Runs program instructions Main Memory Storage for running programs and current.
Introduction to Computer Terminology
Introduction to Computers Essential Understanding of Computers and Computer Operations.
CS 0008 Day 2 1. Today Hardware and Software How computers store data How a program works Operators, types, input Print function Running the debugger.
Chapter 1 - Introduction. Ch 1Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
COMP Computer Basics Yi Hong May 13, 2015.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
The Study of Computer Science Chapter 0 Intro to Computer Science CS1510, Section 2.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
The Computer Systems By : Prabir Nandi Computer Instructor KV Lumding.
What is a Computer ? Computers are Electronic Machines that process (performs calculation and manipulation) Data under the control of Set of Instructions.
1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to.
COMP 110 Spring Announcements Computers in class on Friday: Lab Office Hours: Monday 12-2 New students see me after class Administrative Changes.
COMP 110: Introduction to Programming Tyler Johnson January 14, 2009 MWF 11:00AM-12:15PM Sitterson 014.
The Study of Computer Science Chapter 0 Intro to Computer Science CS1510.
Introduction to Computers
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
Computer Parts. Two Basic Parts Hardware & Software.
Week 1 - Friday.  What did we talk about last time?  Our first Java program.
Intro to Computers Computer Applications. What is a Computer? Initially the term computer referred to an individual whose job it was to perform mathematical.
© 2006 Pearson Education Chapter 1: Computer Systems.
1 WELCOME TO CIS 1068! Instructor: Alexander Yates.
Beginning Snapshots Chapter 0. C++ An Introduction to Computing, 3rd ed. 2 Objectives Give an overview of computer science Show its breadth Provide context.
The Computer System CS 103: Computers and Application Software.
CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software.
Computer Systems. Bits Computers represent information as patterns of bits A bit (binary digit) is either 0 or 1 –binary  “two states” true and false,
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
1. COMPUTERS AND PROGRAMS Rocky K. C. Chang September 6, 2015 (Adapted from John Zelle’s slides)
CS 177 Recitation Week 1 – Intro to Java. Questions?
Introduction To Computer Programming – 1A Computer Parts, Words, and Definition Herriman High School.
Programming with Java. Chapter 1 Focuses on: –components of a computer –how those components interact –how computers store and manipulate information.
Introduction to Programming. Key terms  CPU  I/O Devices  Main memory  Secondary memory  Operating system  User interface  Application  GUI 
The Study of Computer Science Chapter 0
An Overview of the Computer System
Week 2 - Monday CS 113.
UNDERSTANDING YOUR COMPUTER
Topics Introduction Hardware and Software How Computers Store Data
UNIT 9 Computer architecture
Computer Hardware and Software
Computer System and Programming
The Study of Computer Science Chapter 0
Java programming lecture one
IB Computer Science Topic 2.1.1
Introduction to Computers
Looking Inside the machine (Types of hardware, CPU, Memory)
An Overview of the Computer System
CS190/295 Programming in Python for Life Sciences: Lecture 1
The Study of Computer Science
Computer Science I CSC 135.
Introduction to Computers
Topics Introduction Hardware and Software How Computers Store Data
Computer Hardware.
From Problems to Algorithms to Programs
The Study of Computer Science
Focus of the Course Object-Oriented Software Development
Computer Programming-1 CSC 111
The Study of Computer Science Chapter 0
ICS103 Programming in C 1: Overview of Computers And Programming
Week 1 - Friday COMP 1600.
How to Run a Java Program
Presentation transcript:

Week 1 - Wednesday CS 121

Last time What did we talk about last time? Syllabus Computers

Questions?

Back to computers

Hardware vs. software Hardware refers to physical parts of the computer Processor Memory Hard disk Monitor Software refers to the programs and data that run on it Operating system (Windows, Mac OS, Linux, Unix) Web browser (Internet Explorer, Safari, Firefox, Chrome) Business applications (Word, PowerPoint) Games

Von Neumann Architecture Basic layout of all modern computers Memory Central Processing Unit (CPU) Input/Output (I/O)

CPU The “brains” of the computer Fetches instructions and data from memory Performs computations on the data based on the instructions Can send results to I/O A modern CPU is made of electronic circuitry embedded in a small silicon chip

Speed of computers How fast are computers? I typed this PowerPoint on a computer running at 2.6 GHz That’s 2,600,000,000 cycles per second Each cycle, your computer can do something like: Add Subtract Multiply (Usually not divide)

Moore’s Law “The density of transistors on a CPU doubles every 18 months” Historically, this has meant that CPU speeds have doubled every 18 months We can’t make things much faster because of heat and power We can still put more “stuff” into a CPU What do we do with that extra stuff?

Multicore Modern laptops and desktops are now almost all multicore Multicore means that each CPU actually has several independent processors called cores inside A CPU with 4 cores can actually be computing 4 different things at the same time Parallel processing

Parallel processing Works well for problems like washing loads of laundry in a laundromat But, if you have 3 loads of clothes, there is no way to wash them faster with 4 washers 1 2 3

Parallel limitations Parallel processing works very poorly when different processors have to work on the same data and conflicts can happen Brain surgery with 100 surgeons is not 20 times faster than brain surgery with 5 It’s not safer, either

Memory Storage for all the data and instructions on your computer Modern computers store everything as binary digits (bits) which have a value of 0 or 1. 1 byte = 8 bits 1 kilobyte (kb) = 210 bytes 1 megabyte (mb) = 220 bytes 1 gigabyte (gb) = 230 bytes 1 terabyte (tb) = 240 bytes

Memory Cache RAM Flash Drive Hard Drive Optical Drive Actually on the CPU Fast and expensive RAM Primary memory for a desktop computer Pretty fast and relatively expensive Flash Drive Faster than hard drives Seen on USB drives but SSDs are becoming common too Hard Drive Secondary memory for a desktop computer Slow and cheap Optical Drive Secondary memory that can usually only be written once Very slow and very cheap

Input/Output Monitor Speakers Mouse Keyboard Common visual output device Speakers Common audio output device Mouse Common input device Keyboard

Computer Science

What is computer science? Now that we’ve (sort of) defined computers, what is computer science? The study of information, computation, and solving problems with programs Subfields: Theoretical computer science Programming languages and compilers Operating systems and networking Graphics Numerical computing Information storage, retrieval, and security Architecture and hardware Artificial intelligence and machine learning

What is programming? Computers are stupid, but fast Programming is the process of giving them very detailed instructions about what to do Usually, programming is done in a rigid, formalized language, like Java English is insufficient: E.g., “Computer! Solve my relationship problems!” Writing a program to solve your relationship problems in Java would require you to be more detailed and explicit

Layers Computer science is built out of layers (like a burrito) No one can understand everything People tend to focus on a particular level

Layers of Abstraction We will program here User Application Operating System Hardware We will program here

Writing a Java Program

Writing the program Usually, this step takes the majority of the time A Java program is stored as an ordinary text file You can write a Java program using any text editor Notepad jEdit UltraEdit Notepad++ We'll be editing, compiling, and executing all with Eclipse

Java Syntax Every language has syntax Syntax is the set of rules that govern how you can make meaningful statements In English, the basic syntax for a sentence says that you must have: Subject Predicate Just like English, Java has many, many different rules you will need to learn

Classes In Java, one of the most basic rules of syntax is that everything must be inside a class For now, just think of a class as a way to organize things We are going to create a Java program called Hello We must create a file called Hello.java and put a class called Hello inside of it

Hello.java public class Hello { } Ignore the keyword public for now The keyword class announces that a new class is about to be named Hello is the name of the class The braces mark the beginning and end of the contents of class Hello public class Hello { }

Hello.java The previous empty class will compile, but it will not run We need to give our class a starting point The starting point for any Java program is a main() method public class Hello { public static void main(String[] args) { }

Hello.java The previous program will run, but it won’t do anything Now, we add a print statement to our main() public class Hello { public static void main(String[] args) { System.out.println("Hello, world!"); }

Recap The full Hello World program Remember that everything is in a class The class name must match the file name (Hello.java) The main()method is where the program starts The print statement outputs information on the screen public class Hello { public static void main(String[] args) { System.out.println("Hello, world!"); }

Output Statements Basic output is done with System.out.println() You put what you want to print out inside the parentheses You can print: Any text enclosed in quotes: System.out.println("43 eggplants"); Any number: System.out.println(3.14159); You can use System.out.print() instead if you don’t want a newline

Eclipse Tutorial

More Java Syntax

Semicolons In Java, like C, C++, and many other languages, we separate different statements with a semicolon ( ; ) If we want to do a number of statements, we just type them in order, with a semicolon after each one

Sequencing For example, instead of one print statement, we can have several: Each statement is an instruction to the computer They are printed in order, one by one System.out.println("Hello, world!"); System.out.println("Hello, galaxy!"); System.out.println("Goodbye, world!");

Case Sensitivity Java is a case sensitive language Class is not the same as class System.out.println("Word!"); prints correctly system.Out.Println("Word!"); does not compile

Whitespace Java generally ignores whitespace (tabs, newlines, and spaces) is the same as: You should use whitespace effectively to make your code readable System.out.println("Hello, world!"); System.out. println( "Hello, world!");

Comments Programs can be confusing Sometimes you want to leave notes for yourself or anyone else who is reading your code The standard way to do this is by using comments Although comments appear in the code, they do not affect the final program

Comments There are two kinds of comments (actually 3) Single line comments use // Multi-line comments start with a /* and end with a */ System.out.println("Hi!"); // this is a comment System.out.println("Hi!"); /* this is a multi-line comment */

What we know Java is a large, complex language Even so, there are only a few tasks that you can ask it to do You have already learned: Sequencing Basic output

Where we are headed There are not that many other things you can tell Java to do Storing numbers and text Basic mathematical operations Choosing between several options Doing a task repetitively Storing lists of things More complicated input and output Naming a task so that you can use it over and over again That’s basically it

Upcoming

Next time… We will finish talking about computers and software development Lab 1

Reminders Read Chapter 2 of the textbook