CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts What is computer...

53
CSC 1 CSC 1 Introduction to Introduction to Computer Science Computer Science Week 1 Week 1

Transcript of CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts What is computer...

Page 1: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

CSC 1CSC 1Introduction to Computer Science Introduction to Computer Science

Week 1 Week 1

Page 2: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Week 1: Fundamental Concepts Week 1: Fundamental Concepts

What is computer science?What is computer science?What is in a computer (What is in a computer (von Neumann machine von Neumann machine

architecturearchitecture)?)?Types of computer systems.Types of computer systems.Programming basics.Programming basics.

Page 3: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

What is Computer What is Computer Science?Science?

Page 4: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Computer Science Computer Science

Computer science studies information Computer science studies information processes both artificial and natural processes both artificial and natural [[P. J. P. J.

DenningDenning]. ].

Artificial: information processing systems and machines.Artificial: information processing systems and machines. Natural: information processes in: biology, medicine, Natural: information processes in: biology, medicine,

psychology, cognitive and behavior sciences, sociology, psychology, cognitive and behavior sciences, sociology, economics, chemistry, meteorology, neuroscience, economics, chemistry, meteorology, neuroscience, physics, forensics, linguistics, philosophy, ……… physics, forensics, linguistics, philosophy, ………

Page 5: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

E. DijkstraE. Dijkstra

Computer science is no more about Computer science is no more about computers than astronomy is about computers than astronomy is about telescopes. telescopes.

Page 6: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Natural Information ProcessesNatural Information Processes

Biology and medicine. Computer models and algorithms to Biology and medicine. Computer models and algorithms to diagnose and treat disease (diagnose and treat disease (MRI, fMRI, CTMRI, fMRI, CT). Computer models to ). Computer models to track mutations of viruses. String algorithms for DNA track mutations of viruses. String algorithms for DNA sequencing. sequencing.

Economics. Computer models to forecast economic Economics. Computer models to forecast economic conditions.conditions.

Forensics. Computer models and databases to identify Forensics. Computer models and databases to identify evidence and discover forensic data.evidence and discover forensic data.

Psychology, cognitive and behavior sciences. Computer Psychology, cognitive and behavior sciences. Computer models are used to shed light on human brains and nervous models are used to shed light on human brains and nervous systems.systems.

Page 7: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Natural Information Processes Natural Information Processes (2)(2)

Linguistics. Computer based speech recognition. Linguistics. Computer based speech recognition. Machine translation. Machine translation.

Philosophy. Artificial intelligence, machine learning, and Philosophy. Artificial intelligence, machine learning, and heuristic programming in knowledge representation heuristic programming in knowledge representation and reasoning. and reasoning.

Page 8: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Body of Knowledge for the Artificial Body of Knowledge for the Artificial [P. J. Denning][P. J. Denning]

Algorithmic processes that describe and transform Algorithmic processes that describe and transform information: their theory, analysis, design, efficiency, information: their theory, analysis, design, efficiency, implementation, and application. implementation, and application.

Coordination and communication (Internet).Coordination and communication (Internet).

Structure and operation of computer systems, Structure and operation of computer systems, principles underlying computer system design and principles underlying computer system design and programming, effective methods for using computers programming, effective methods for using computers for information processing tasks, and theoretical for information processing tasks, and theoretical characterizations of their properties and limitations. characterizations of their properties and limitations.

Page 9: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

System and Application System and Application [P. J. Denning][P. J. Denning]

Systems: structures, mechanisms and schemes for Systems: structures, mechanisms and schemes for processing information.processing information. Software systemsSoftware systems Hardware systems. Hardware systems.

Application: information processing tasks and their Application: information processing tasks and their related data representations.related data representations. Numerical applications: Numerical applications: weather forecast, global warming modeling, ……weather forecast, global warming modeling, ……

Non-numerical applications: Non-numerical applications: Second Life, robotics, social networks, protein Second Life, robotics, social networks, protein structure prediction, ……structure prediction, ……

Page 10: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Subareas Subareas [P. J. Denning][P. J. Denning]

Algorithms and data structures.Algorithms and data structures. Programming languages. Programming languages. Architecture.Architecture. Operating systems and networks.Operating systems and networks. Software engineering.Software engineering. Databases and information retrieval.Databases and information retrieval. Artificial intelligence and robotics.Artificial intelligence and robotics. Graphics.Graphics. Human computer interaction.Human computer interaction. Computational scienceComputational science Organizational informatics.Organizational informatics. Emerging areas such as bioinformatics.Emerging areas such as bioinformatics.

Page 11: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.
Page 12: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

What is in a What is in a Computer?Computer?

von Neumann Machine Architecturevon Neumann Machine Architecture

Page 13: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

von Neumann Machine Architecturevon Neumann Machine Architecture

http://www.software-engineer-training.com/category/computer-architecture-2/

John von Neumann, 1903-1957John von Neumann, 1903-1957

Page 14: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Salient FeaturesSalient Features

Stored program.Stored program.Separation of processing from storage.Separation of processing from storage.Predefined instruction set.Predefined instruction set.Instruction execution cycle.Instruction execution cycle.Shared buses.Shared buses.Sequential architecture.Sequential architecture.Control flow vs. data flow.Control flow vs. data flow.

Page 15: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.
Page 16: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Basic Functions of a Basic Functions of a ComputerComputer

• Input DataInput Data• Process DataProcess Data• Output DataOutput Data• Store DataStore Data

Page 17: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Input DataInput DataFeeding information into a computerFeeding information into a computer

Symbols – letters, words, numbers, etc. Symbols – letters, words, numbers, etc. Pictures (using a camera)Pictures (using a camera) Sounds (using a microphone)Sounds (using a microphone)

Common forms of Common forms of inputinput KeyboardKeyboard MouseMouse

Often involves converting Often involves converting analoganalog to to digitaldigital

Page 18: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Process DataProcess DataAnalyze data, or use it in a computation.Analyze data, or use it in a computation.Perform some action based on data.Perform some action based on data.Generate new data, or change existing data.Generate new data, or change existing data.Processing is done in the CPU.Processing is done in the CPU.Processing is managed by a computer program.Processing is managed by a computer program.

Basic Terms:Basic Terms: ProgramProgram – a sequence of instructions (with data) to – a sequence of instructions (with data) to

accomplish a certain taskaccomplish a certain task ProcessProcess – a program in execution – a program in execution ProcessorProcessor (CPU) - device where a program gets executed (CPU) - device where a program gets executed

Page 19: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Output DataOutput Data

Common forms of Common forms of outputoutput MonitorMonitor PrintersPrinters Speakers (music and Sound)Speakers (music and Sound)

Often involves converting digital signals to Often involves converting digital signals to analog signalsanalog signals

Page 20: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Store DataStore Data

• Save data on a device for later use.Save data on a device for later use.• Data is always stored in digital form.Data is always stored in digital form.• Common Forms:Common Forms:

MemoryMemory CD ROMCD ROM Hard DiskHard Disk Flash DiskFlash Disk Magnetic tapeMagnetic tape

Page 21: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Functions of a Functions of a ComputerComputer

Output Data

Input Data

Store Data

Process Data

Page 22: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Analog Digital

Functions of a Functions of a ComputerComputer

Page 23: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.
Page 24: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Computer Computer CategoriesCategories

Different Types of ComputersDifferent Types of Computers

Page 25: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Computer CategoriesComputer Categories

There used to be There used to be fourfour categories categories Personal computersPersonal computers Workstation computersWorkstation computers minicomputersminicomputers mainframe computersmainframe computers

Today, computers can be categorized byToday, computers can be categorized by functionfunction sizesize performanceperformance costcost

Page 26: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

TodayToday’’s Computer s Computer CategoriesCategories

Personal computersPersonal computersHandheld computersHandheld computersConsole ComputersConsole ComputersMainframesMainframesSupercomputersSupercomputersWorkstationsWorkstationsServersServers

Page 27: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Personal ComputersPersonal Computers

““MicrocomputerMicrocomputer”” Also known as a PC or Also known as a PC or ““Personal Personal

ComputerComputer

Designed for everyday usersDesigned for everyday users Desktop computersDesktop computers Notebook or netbook computersNotebook or netbook computers Tablet computersTablet computers

Page 28: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Handheld ComputersHandheld Computers

Designed to be used while being heldDesigned to be used while being heldCalled a Called a PDA PDA (Personal Digital Assistant)(Personal Digital Assistant)A few examples:A few examples:

Apple iPodsApple iPods Cell phonesCell phones Palm & Handspring PDAsPalm & Handspring PDAs Blackberry Blackberry

Page 29: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Console ComputersConsole Computers

My game system is a computer?My game system is a computer? Has processorsHas processors Input data from joysticksInput data from joysticks Output data (graphics and sound)Output data (graphics and sound) Has internet connectionHas internet connection

Examples include:Examples include: Microsoft XBox 360Microsoft XBox 360 Sony Playstation 3Sony Playstation 3 Nintendo WiiNintendo Wii

Page 30: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

NotebooksNotebooks

Similar to Personal ComputersSimilar to Personal Computers Hardware is differentHardware is different Functionality is often the sameFunctionality is often the same Slightly more expensiveSlightly more expensive

Also called a Also called a ““laptoplaptop””

““NetbookNetbook””:: Very smallVery small Minimal functionalityMinimal functionality Intended for web access while travelingIntended for web access while traveling

Page 31: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Mainframes & Mainframes & SupercomputersSupercomputers

Built for computing powerBuilt for computing power Can calculate complex data – fastCan calculate complex data – fast Excellent for complex simulationsExcellent for complex simulations

Used by federal research labs Used by federal research labs and large corporations (banks)and large corporations (banks)

Typically large – cabinet sizedTypically large – cabinet sizedExpensiveExpensive

Page 32: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Workstation ComputerWorkstation Computer

Computers designed for a Computers designed for a specific specific groupgroup of users of users ((Pixar StudioPixar Studio).).

The term The term ““workstationworkstation”” has two meaningshas two meanings Powerful desktop models Powerful desktop models Computer on a network Computer on a network

Page 33: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

ServersServers

A A serverserver sends data or offers services to other sends data or offers services to other computers on a networkcomputers on a network typically they have typically they have lotslots of storage (SAN) of storage (SAN) run unattended – no usersrun unattended – no users any computer can be server – although not idealany computer can be server – although not ideal eBay, Google, Facebook, Myspace, Twitter, Amazon, ……eBay, Google, Facebook, Myspace, Twitter, Amazon, ……

• A A clientclient receives data or (service) from a serverreceives data or (service) from a server• Go to Riverside Hall 2011 to see someGo to Riverside Hall 2011 to see some

Page 34: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.
Page 35: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Programming Programming BasicsBasics

Programs, Coding, Engineers & MorePrograms, Coding, Engineers & More

Page 36: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Programming LanguagesProgramming Languages

LanguageLanguage series of symbols & words that form a meaningful patternseries of symbols & words that form a meaningful pattern This is true of natural languages such as English, This is true of natural languages such as English,

Spanish, Hindi, Arabic, etc...Spanish, Hindi, Arabic, etc...

ProgrammingProgramming language used to write programs to be executed in language used to write programs to be executed in

computerscomputers there are many different programming languagesthere are many different programming languages

Page 37: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Popular Programming LanguagesPopular Programming Languages

C++C++C#C#JavaJavaFortranFortranVisual BasicVisual BasicCOBOLCOBOL……………………

Page 38: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

AlgorithmsAlgorithms

A sequence of steps for carrying out a taskA sequence of steps for carrying out a taskExamples:Examples:

tying your shoestying your shoes driving to Sac Statedriving to Sac State making a peanut butter and jelly sandwichmaking a peanut butter and jelly sandwich withdraw money at ATMwithdraw money at ATM

Capture Capture ““the essencethe essence”” in solving a problem in solving a problem can be implemented into a computer program using some can be implemented into a computer program using some

programming languageprogramming language

Page 39: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Procedural ProgrammingProcedural Programming

Traditional approach to programmingTraditional approach to programmingProgramsPrograms

a a sequencesequence of instructions (statements) of instructions (statements)statements run in order – from first to laststatements run in order – from first to lastrepetitionrepetition is performed with is performed with ““loopinglooping””decisionsdecisions are described as are described as ““if – then – elseif – then – else””

Page 40: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.
Page 41: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Flow ChartsFlow Charts

Graphically Representing AlgorithmsGraphically Representing Algorithms

Page 42: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Flow Chart OverviewFlow Chart Overview

Graphical representationGraphical representationeach step is a each step is a shape shape (box, circle, …)(box, circle, …)useful for conceptualizing an useful for conceptualizing an algorithmalgorithmeasy to understand and visualizeeasy to understand and visualize

Used to document how an algorithm was Used to document how an algorithm was designeddesigned

Page 43: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Read theKilometers

Calculate the Miles

Print theMiles

START

END

Input / Output

Process Data

Input / Output

Page 44: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Start / EndStart / End

Indicates the start and end of Indicates the start and end of an algorithman algorithm

Represented by a rectangle Represented by a rectangle with rounded sideswith rounded sides

There are typically two:There are typically two: one to start the flowchartone to start the flowchart one to end the flowchartone to end the flowchart

Page 45: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Input / OutputInput / Output

Indicates data being:Indicates data being:inputted into the computerinputted into the computeroutputted to the useroutputted to the user

Represented by a Represented by a parallelogramparallelogram

Flowcharts can have many Flowcharts can have many of this shapeof this shape

Page 46: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

ProcessesProcesses

Indicates data:Indicates data:being being processedprocessedalso called "calculations"also called "calculations"

Represented by a rectangleRepresented by a rectangleThe most common shape The most common shape

in a flowchartin a flowchart

Page 47: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

DecisionsDecisions

Indicates a conditional Indicates a conditional branchbranch describe a condition or a question describe a condition or a question Has more than one outgoing branch, Has more than one outgoing branch,

depending on the outcomes to the depending on the outcomes to the condition/questioncondition/question

Represented by a diamondRepresented by a diamond

Page 48: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Get distance Get distance ““dd””

d < 5 ?d < 5 ?

walkwalk drivedrive

yesyes nono

Page 49: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

PseudocodePseudocode

Describing an Algorithm with wordsDescribing an Algorithm with words

Page 50: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

What is Pseudocode?What is Pseudocode?

• Description of an algorithm's logic Description of an algorithm's logic simpler than spoken Englishsimpler than spoken English looks like a program, but easier to readlooks like a program, but easier to read

• It is often useful It is often useful to express some piece of the solutionto express some piece of the solution without having to worry about every detailwithout having to worry about every detail

Page 51: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Program: area of a circle

1.Get the value for the radius2.Calculate the area (pi x radius2)3.Output radius and area

Area of a CircleArea of a CirclePseudocodePseudocode

Page 52: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.

Program: decide between walk/drive

1. Compute distance to destination2. If distance is less than 5 then walk else drive

Distance program…Distance program…PseudocodePseudocode (compare with flowchart)(compare with flowchart)

Page 53: CSC 1 Introduction to Computer Science Week 1. Week 1: Fundamental Concepts  What is computer science?  What is in a computer ( von Neumann machine.