meljun cortes - intro. to computers programming language
TRANSCRIPT
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
1/46
1
IT 209IT 209
Introduction ToIntroduction To
Computers AndComputers AndProgramming LanguageProgramming Language
MELJUN CORTES,MBA,MPAMELJUN CORTES,MBA,MPA
MELJUN CORTES,MBA,MPAMELJUN CORTES,MBA,MPA
http://meljuncortes.blogspot.com
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
2/46
MELJUN CORTES,MBA,MPAMELJUN CORTES,MBA,MPAMELJUN CORTES,MBA,MPAMELJUN CORTES,MBA,MPA
LECTURE 1 2
In this chapter, you willIn this chapter, you will::Learn about different types of computersLearn about different types of computers
Explore the hardware and software componentsExplore the hardware and software componentsof a computer systemof a computer system
Learn about the language of a computerLearn about the language of a computer
Learn about the evolution of programmingLearn about the evolution of programming
languageslanguagesExamine high-level programming languagesExamine high-level programming languages
ObjectivesObjectives
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
3/46
LECTURE 1 3
Objectives (contObjectives (cont.(.(
Discover what a compiler is and what itDiscover what a compiler is and what it
doesdoes
Examine a C++ programExamine a C++ programExplore how a C++ program is processedExplore how a C++ program is processed
Become aware of Standard C++ andBecome aware of Standard C++ and
ANSI/ISO Standard CANSI/ISO Standard C++++
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
4/46
LECTURE 1 4
Why ProgramWhy Program??
ComputerComp
uter programmable machine designed to programmable machine designed to
follow instructionsfollow instructions
ProgramProg
ram instructions in computer memory to instructions in computer memory to
make it do somethingmake it do something
ProgrammerProgr
ammer person who writes instructions person who writes instructions
(programs) to make computer perform a task(programs) to make computer perform a task
SO, without programmers, no programs; withoutSO, without programmers, no programs; withoutprograms, a computer cannot do anythingprograms, a computer cannot do anything
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
5/46
LECTURE 1 5
Categories of ComputersCategories of Computers
Mainframe computersMainframe computers
Midsize computersMidsize computers
Micro computers (personalMicro computers (personal
computerscomputers((
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
6/46
LECTURE 1 6
Computer is an electronic device, with
two major components.
Computer
Hardware Software
Computer Components
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
7/46
LECTURE 1 7
Main HardwareMain Hardware
Component CategoriesComponent Categories::
1.1.Central Processing Unit (CPUCentral Processing Unit (CPU((
2.2.Main MemoryMain Memory
3.3.Secondary Memory / StorageSecondary Memory / Storage
4.4.Input DevicesInput Devices
5.5.Output DevicesOutput Devices
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
8/46
LECTURE 1 8
Main HardwareMain Hardware
Component CategoriesComponent Categories
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
9/46
LECTURE 1 9
Central Processing UnitCentral Processing Unit
(CPU(CPU((Comprised ofComprised of::
Control UnitControl Unit
Retrieves and decodes program instructionsRetrieves and decodes program instructionsCoordinates activities of all other parts ofCoordinates activities of all other parts of
computercomputer
Arithmetic & Logic UnitArithmetic & Logic Unit
Hardware optimized for high-speed numericHardware optimized for high-speed numericcalculationcalculation
Hardware designed for true/false, yes/noHardware designed for true/false, yes/nodecisionsdecisions
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
10/46
LECTURE 1 10
CPU OrganizationCPU Organization
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
11/46
LECTURE 1 11
Main MemoryMain Memory
It is volatile. Main memory is erased whenIt is volatile. Main memory is erased when
program terminates or computer is turned offprogram terminates or computer is turned off
Also called Random Access Memory (RAMAlso called Random Access Memory (RAM((
Organized as followsOrganized as follows::bit: smallest piece of memory. Has values 0 (off,bit: smallest piece of memory. Has values 0 (off,
false) or 1 (on, truefalse) or 1 (on, true((
byte: 8 consecutive bits. Bytes have addressesbyte: 8 consecutive bits. Bytes have addresses..
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
12/46
LECTURE 1 12
Main MemoryMain Memory
Addresses Each byte in memory isAddresses Each byte in memory is
identified by a unique number knownidentified by a unique number known
as anas an addressaddress..
The number 149 is stored in the byte with the address 16,
and the number 72 is stored at address 23.
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
13/46
LECTURE 1 13
Main memory with some data
Main Memory
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
14/46
LECTURE 1 14
Secondary StorageSecondary Storage
Non-volatile: data retained whenNon-volatile: data retained when
program is not running or computerprogram is not running or computer
is turned offis turned offComes in a variety of mediaComes in a variety of media::
magnetic: floppy disk, zip disk, hardmagnetic: floppy disk, zip disk, hard
drivedriveoptical: CD-ROMoptical: CD-ROM
Flash drives, connected to the USB portFlash drives, connected to the USB port
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
15/46
LECTURE 1 15
Input DevicesInput Devices
Devices that send information to theDevices that send information to the
computer from outsidecomputer from outside
Many devices can provide inputMany devices can provide input::Keyboard, mouse, scanner, digitalKeyboard, mouse, scanner, digital
camera, microphonecamera, microphone
Disk drives and CD-ROM (SecondaryDisk drives and CD-ROM (Secondarystoragestorage((
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
16/46
LECTURE 1 16
Output DevicesOutput Devices
Output is information sent from aOutput is information sent from a
computer program to the outside worldcomputer program to the outside world..
The output is sent to an output deviceThe output is sent to an output deviceMany devices can be used for outputMany devices can be used for output::
Computer monitor and printerComputer monitor and printer
Floppy, zip disk drives, writable CD drivesFloppy, zip disk drives, writable CD drives
(Secondary storage(Secondary storage((
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
17/46
LECTURE 1 17
Computer Software
Software: programs that do specific tasks.
Software is divided into 2 categories
Software
System Software Application Software
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
18/46
LECTURE 1 18
System Software
Related software that manages the systems resources
and control the operations of the hardware.
Normally supplied by the manufacturer of the computer.
Consists of utility programs and operating aids thatfacilitate the use and performance of the computer.
System programs take control of the computer, such as
an operating system.
Operating system are programs that manage the
computer hardware and the programs that run on them.
Examples: Windows, UNIX, Linux.
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
19/46
LECTURE 1 19
Application Software
Programs that provide services to the user. Designed to perform a specific task such as
course registration or banking( OR a general-purpose task such as word processing, eg. Ms
Word(. May be acquired by purchasing off-the-shelf or
by designing for own purpose custome made(.
Off-the-shelf : prewritten and ready to use.
Custom made : written by in-house, consulting
firm or software house.
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
20/46
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
21/46
LECTURE 1 21
Computing Environment
Personal Computing
Time-Sharing
Client / Server
Computing
Internet Computing
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
22/46
LECTURE 1 22
Personal computing environment
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
23/46
LECTURE 1 23
Time-sharing environment
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
24/46
LECTURE 1 24
The client/server environment
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
25/46
LECTURE 1 25
Digital signals are sequences of 0s and 1sDigital signals are sequences of 0s and 1sMachine languageMachine language: language of a computer: language of a computer
Binary digit (bitBinary digit (bit
((
::
The digit 0 or 1The digit 0 or 1
Binary codeBinary code::A sequence of 0s and 1sA sequence of 0s and 1s
ByteByte
::
A sequence of eight bitsA sequence of eight bits
The Language of aThe Language of a
ComputerComputer
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
26/46
LECTURE 1 26
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
27/46
LECTURE 1 27
Coding SchemesCoding Schemes
ASCII (American Standard Code forASCII (American Standard Code for
Information InterchangeInformation Interchange((128128characterscharactersA is encoded as 1000001 (66thA is encoded as 1000001 (66th
charactercharacter((
33is encoded as 0110011is encoded as 0110011
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
28/46
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
29/46
LECTURE 1 29
History Of Computer Languages
Computer language evolution
The only language understood by a computer is
machine language
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
30/46
LECTURE 1 30
1.Machine Language
Computer only understand this language.
Series of 1s and 0s binary numbers(, such as
1011010000000101
Difficult to write.
Low level language
History Of Computer Languages
cont.(
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
31/46
LECTURE 1 31
Early computers were programmed inEarly computers were programmed in
machine languagemachine language
To calculateTo calculate wages = rates * hourswages = rates * hours ininmachine languagemachine language::
100100100100010001010001////LoadLoad
100110100110010010010010////MultiplyMultiply100010100010010011010011////StoreStore
History Of ComputerHistory Of Computer
Languages (contLanguages (cont.(.(
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
32/46
LECTURE 1 32
22..Symbolic/Assembly LanguageSymbolic/Assembly LanguageUnique to particular computerUnique to particular computer..
Use mnemonics symbols. E.g. MUL MultiplyUse mnemonics symbols. E.g. MUL Multiply
Easier to understandEasier to understand..
History Of ComputerHistory Of Computer
Languages (contLanguages (cont.(.(
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
33/46
LECTURE 1 33
Using assembly language instructions,Using assembly language instructions,
wages = rates hourswages = rates hours
can be written ascan be written as::LOAD rateLOAD rate
MULTMULThourhour
STORSTORwageswages
History Of ComputerHistory Of Computer
Languages (contLanguages (cont.(.(
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
34/46
LECTURE 1 34
33..High-Level LanguageHigh-Level LanguagePortable to many different computersPortable to many different computers..Instruction are codedInstruction are coded
Eg. COBOL (Business), FORTRAN (Scientific), BASIC,Eg. COBOL (Business), FORTRAN (Scientific), BASIC,Pascal, C, C++, C#, Java etcPascal, C, C++, C#, Java etc..
Programmers use this to write programsProgrammers use this to write programs..CompilerCompiler: translates a program written in a high-level: translates a program written in a high-level
language machine languagelanguage machine language
The equationThe equation wages = rate x hourswages = rate x hours can be written in C+can be written in C++ as+ as::
wages = rate * hourswages = rate * hours;;
History Of ComputerHistory Of Computer
Languages (contLanguages (cont.(.(
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
35/46
LECTURE 1 35
4. Natural Language
Like our natural language such as English,French, or Chinese(
Its use is still quite limited.
History Of Computer Languages
cont.(
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
36/46
S W ll K Hi hS W ll K Hi h
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
37/46
LECTURE 1 37
Some Well-Known High-Some Well-Known High-
Level ProgrammingLevel Programming
LanguagesLanguages
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
38/46
LECTURE 1 38
##include
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
39/46
LECTURE 1 39
Program Development
A computer understands a program only ifthe program is coded in its machine
language.
Programmer have to write the program
and turn it into an executable machine
language( code.
Programmer have to understand the
problem -< break into actions-< execute bythe computer.
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
MELJUN CORTES,MBA,MPAMELJUN CORTES,MBA,MPA
MELJUN CORTES,MBA,MPAMELJUN CORTES,MBA,MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
40/46
LECTURE 1 40
From a High-level ProgramFrom a High-level Program
to an Executable Codeto an Executable CodeThere are 4 steps in the processThere are 4 steps in the process::
a)a)Create and edit file containing the program with a text editorCreate and edit file containing the program with a text editor..
b)b)RunRun preprocessorpreprocessor to process the preprocessor directives (begin withto process the preprocessor directives (begin with#(#(
c)c)RunRun compilercompiler toto::
Check that the program obeys the rulesCheck that the program obeys the rulesTranslate into machine language (object codeTranslate into machine language (object code((
d)d)RunRun linkerlinker to connect hardware-specific code to machine instructions,to connect hardware-specific code to machine instructions,producing an executable codeproducing an executable code..
Steps bd are often performed by a single command or button clickSteps bd are often performed by a single command or button click..Errors detected at any step will prevent execution of following stepsErrors detected at any step will prevent execution of following steps..
, ,, ,
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
41/46
LECTURE 1 41Executable Code
Code
Code
Programmer
From a High-level Program to an Executable Code
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
42/46
LECTURE 1 42
LoaderLoader::Loads executable code/program intoLoads executable code/program into
main memorymain memoryExecutionExecution::
The last step is to execute the programThe last step is to execute the program
Program DevelopmentProgram Development
(cont(cont.(.(
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
43/46
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
44/46
LECTURE 1 44
Integrated DevelopmentIntegrated Development
Environments (IDEsEnvironments (IDEs((An integrated development environment,An integrated development environment,
or IDE, combine all the tools needed toor IDE, combine all the tools needed towrite, compile, and debug a program intowrite, compile, and debug a program into
a single software applicationa single software application..
Examples are Microsoft Visual C++,Examples are Microsoft Visual C++,
Borland C++ Builder, CodeWarrior, etcBorland C++ Builder, CodeWarrior, etc..
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
45/46
LECTURE 1 45
Integrated DevelopmentIntegrated Development
Environments (IDEsEnvironments (IDEs((
MELJUN CORTES MBA MPAMELJUN CORTES MBA MPA
-
8/9/2019 MELJUN CORTES - Intro. to Computers Programming Language
46/46