0% found this document useful (0 votes)
4 views

1 Programming Introduction

Uploaded by

kamirualex
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

1 Programming Introduction

Uploaded by

kamirualex
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Introduction to programming

 Programming Problem: - A task that requires a


program to be written
 Programming language: - It is a program with a
special role i.e. it enables us to come up with
other programs. It has instructions that enable us
to write programs
 It has features of a language
a.Vocabulary
b.Grammar: SYNTAX
c.Interpretation/ meaning: SEMANTICS
Introduction to programming…
High level languages
 Allow one to use statements similar to the English
words.
 E.g. VISUAL BASIC, PASCAL, C, JAVA
Low level languages
Assembly language
 Contain statements that are written using
mnemonic codes(codes suggesting their meaning
and hence can be easily remembered) to represent
operations and addresses that relate to the main
memory and storage registers of a computer.
 Each low level language has instructions which
correspond closely to the inbuilt operations of a
specific computer.
Introduction to programming…
Assembly language…
 Since different brands of computers use different
brands of computers use different low level
languages, a program written for one brand of
computer will not run in another brand.
 The following are example statements in assembly
language
LDA 5000
ADD 6000
STA 5000
Introduction to programming…
Assembly language…
 This can be interpreted as:
 load the value 5000 to the accumulator register
add 6000 to the value in the accumulator register
Store the value in the accumulator register to the
memory address 5000
 This is hard to remember and that’s why high-level
languages are preferred
Introduction to programming…
Low level languages
Machine Language
 Uses string of zeros and ones otherwise known as
binary patterns.
 They are much harder to remember and interpret
 They are normally written using one of the number
bases I.e. 2, 8 or 16
 Examples of machine code statements are shown below
11011101 1011011
01001100 1011100
11011100 1011011
 We would require the aid of a reference manual in order
to decipher the meaning of each code
Introduction to programming…
Software Resources
1. Text Editors
 Computer software that allow the user to create and
maintain ASCII texts.
 They are the most suitable means of writing
programs.
 Most programming environments will therefore have
their own text editors.
 Some editors have other features to help in the
writing of the program. These include:
 Auto-completion
Different color schemes for different components of
the program e.g. keywords, comments, strings,
variables etc.
Highlighting of suspected errors
Introduction to programming…
2. Word processors
 Computer software that allow users to create and
maintain highly formatted texts.
 These texts may also contain images and specially
shaped characters.
 If they are used to create a program source code
then the code must be save as plain text or ASCII
text.
Introduction to programming…
3. Interpreters
 These are development software that accept
source code but execute each line of code by
converting it to executable form, executing it,
discarding the executable code then moving to the
next line until all lines are executed.
 Examples include BASIC, APL.
 The development process is convenient as the
source code may be tested immediately but the
final program execution is slow.
Introduction to programming…
4. Compilers
 These are development software that checks the
sources code for errors and if there are none, coverts
the whole source code into object code.
 The compilation process produces the object code that
is then linked to produce the executable code. Object
code is usually in machine format but it cannot be
loaded for execution
5. Linker
 This is a program that joins several files of object code
to produce the executable code
 The function of the linker is to take the machine form
program and combine it with any necessary libraries
(already in machine form) to enable the program to
run.
 The libraries are pre-existing machine code used to
carry out regularly needed functionality e.g. input and
output
Introduction to programming…
6. Debuggers
 These are programs that are used to assist the process
of error correction in an environment where the
compiler is used.
 Debuggers behave like interpreters allowing the testing
of the program as it is being developed.
7. Integrated development environment
 This is a development environment in which Compilers,
debuggers and editors are available to the developer
from one central point, usually an opening window or
menu.
 The developer simply selects the software tool needed.
 Examples of integrated environments include Borland
or Microsoft Development environments.
Introduction to programming…
COMPUTER PROBLEM SOLVING
 Computer problem solving is the use of computers
to accomplish specific tasks.
 Most of the problems that the computers can solve
will involve collection, storage and manipulation of
information.
 To a developer, the problem is viewed from a
developmental perspective.
 The problem is to come up with a computer based
system or write a computer program.
 We will therefore concentrate on how computer
programs may be written.
Introduction to programming…
The general steps used in computer based
problem solving
1. Identify the problem – decide on what the program
should do.
2. Formulate and represent a procedure for solving the
problem without the use of a computer (algorithm).
3. Represent the algorithm using any acceptable convention
(flowcharts or pseudo codes).
4. Check that the algorithm works.
5. Write a computer program from the algorithm.
6. Test the computer code and complete its documentation
(written material explaining the code and the program).
7. Produce the final program.
8. Run or use the computer program.

You might also like