Week1 - Introduction to Computers and Programming Languages...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Computers and Programming Languages CS 180 Sunil Prabhakar Department of Computer Science Purdue University 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Week 1 Objectives This week we will REVIEW: Computer systems and Java Simple Java programs Java data types Conditional statements: if and switch 2
Background image of page 2
3 Computer Architecture (simplified) CPU “brains” Keyboard Monitor Memory Storage Devices Mouse Printer Network Devices More in CS250 : Computer Architecture. 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Software Everything is in binary -- 0s and 1s Two types of information Instructions (programs) -- executed by the CPU Data -- manipulated by CPU These are stored in memory The software provides a means to access and control the hardware This is done through a very important piece of software called the Operating System The OS is always running. More in CS354 4
Background image of page 4
5 Machine Language A computer only runs programs that are specified in its own machine language (ML) Also called binary or executable code. The ML is specific to the CPU, e.g. Pentium, 386, PowerPC G3, G4, … A program written for one CPU will not run on another CPU -- i.e. it is not portable . 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Assembly language Machine language codes are not easy to remember Assembly language uses mnemonics and symbols to ease programming, e.g. JMP L2 A special program called an assembler must be used to convert the assembly code to machine code The assembly code is also hardware-specific . Eases programming but still requires one to think in terms of low-level steps taken by the CPU. Humans think at a higher level. 6
Background image of page 6
7 High-Level Languages Allow programmers to work with constructs that are closer to human language. E.g. Java, C, C++, Basic, Fortran, COBOL, Lisp, … Need a special purpose program to convert the high-level program to machine language. This program is called a compiler . Can write programs in many different HLLs for the same CPU. Need a compiler for each language and CPU (OS). Efficient conversion is still an issue. More in CS352 Compilers 7
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 High-Level Languages (cont.) Since the language is not specific to the hardware, HLL programs are more portable Some hardware, OS issues limit portability All we need is the program and a compiler for that language on the given hardware platform E.g. a C compiler for Mac OSX Thus we can write a program once in a HLL and compile it to run on various platforms, e.g. Netscape 8
Background image of page 8
9 Algorithms Humans tend to think of programs at a higher level than HLL -- more in terms of algorithms. An algorithm is a well-defined, finite set of steps that solves a given problem E.g. the rules for multiplying two numbers 9
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 HLL Paradigms Procedural A program is composed of packets of code called procedures, and variables. A procedure is at full liberty to operate on data that it can see. E.g. C, Pascal, COBOL, Fortran Object-Oriented Programs are composed of Objects, each of a specific class with well defined methods. Data and programs are tightly coupled -- better design. E.g. Java, C++,
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/26/2012 for the course STAT 350 taught by Professor Staff during the Spring '08 term at Purdue University-West Lafayette.

Page1 / 114

Week1 - Introduction to Computers and Programming Languages...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online