Textbook Notes (280,000)
CA (160,000)
Ryerson (10,000)
ITM (900)
ITM 200 (20)
Chapter 1

Chapter 1


Department
Information Technology Management
Course Code
ITM 200
Professor
Vikraman Baskaran
Chapter
1

This preview shows pages 1-2. to view the full 8 pages of the document.
Chapter 1 – Solving problems with computers
1.1Computers and programming
What is a computer?
A computer is a general-purpose device that behaves according to the sets of instructions
and data it is provided with
oIt executes instructions to process data
oEach computer has a CPU
What is a computer program?
A machine code computer program consists of a sequence of these instructions which
might look like this
o1001010010010010
oThe instructions are sequences of 1s and 0s (binary bit patterns)
oThis program can be stored on a disk
oTo perform this program, it is loaded from the disk into the computer’s internal
memory then the instructions are obtained 1 by 1 by the CPU and executed
Before, programmer would write all the programs in the machine code of the processor, it
has few bad effects (on pg 2)
Assembler language
Assembler language was invented to overcome the problem of writing programs using
binary bit patterns
Data can be seen as decimal numbers instead of binary
oFor example, an instruction to load the number 5 into a CPU register might look
like
LD 5
oInstead of
0010010001001101
www.notesolution.com

Only pages 1-2 are available for preview. Some parts have been intentionally blurred.

A program cannot be executed by the processor
A program is required to translate an assembler language program into machine code, this
program is called an assembler
High-level languages and compilers
High-level languages was more problem-oriented instructions that captured common
patterns of instruction usage found in assembler languages (aka 3rd generation
programming language)
oA single instruction from a 3rd generation language might correspond to several
assembler language instructions, so that programs became shorter and more
concise
3rd generation language operates at a higher level of abstraction than the assembler
program
Examples of 3rd generation languages such as ALGOL, FORTRAN, COBOL, C++, JAVA
These problem-oriented languages made programming less error free and more
productive
But they had to be translated into the machine code for the processor to understand it
Compiler is used for this purpose, it checks the syntax (spelling and grammar) of the
high-level program and reports any errors
oIf there are no errors, it creates a machine code version of the high-level program
oThen when its done, the machine code program may be executed on the host
machine as many times as required
To run on a computer, a compiler must be written in machine code
oCompiler is a complex program and hard to write in a low-level language
oFirst compiler will be written in a high-level language (often the one which it is
designed to compile)
oThen we compile the compiler, for which we require a compiler written in
machine code
oSomeone writes a machine code version of the compiler
www.notesolution.com
You're Reading a Preview

Unlock to view full version

Only pages 1-2 are available for preview. Some parts have been intentionally blurred.

oOnce its done, it can be used to compile the high-level version of itself, to obtain
an optimized version
oThis entire process is called bootstrapping
Compilation of java programs
To run a compiled program on any computer, the Java program is compiled to something
called Java byte code
This is machine code, but it is machine code for a computer called the Java Virtual
Machine (JVM)
oJVM is actually a piece of software which simulates a computer
oByte code instructions are processed by JVM, aka run-time interpreter or run-
time engine
oThis interpreter takes each instruction in turn, converts it into the host machine
code and performs it
oThis extra level of processing makes Java programs somewhat slower than the
equivalent C++ program, but they are more portable
1.2Constructing and running java programs
Source code file is letters, numbers and symbols that Java programs has
Integrated development environments (IDEs) combine an editor with menus to invoke
Java compiler and run-time interpreter, example is JCreator or TextPad
Debugging is the process of finding out why a program does not work or does not work
as expected
Learning to program
The best way to learn is by doing it
You should not be afraid to try different things to see if they work
A faulty Java program will never damage the computer
Interactive development environments (IDEs)
IDEs combine the edit-compile-run stages
www.notesolution.com
You're Reading a Preview

Unlock to view full version