Save
Computer science
unit 1.2part 2
Save
Share
Learn
Content
Leaderboard
Learn
Created by
NJ
Visit profile
Cards (149)
Programming
paradigm
An example of a
pattern
or way of doing things in
computing
Programming languages include various facilities like
variables
,
loops
, conditions, and arrays
Programming paradigm
Our way of doing things with programming
languages
Types of programming languages
Python
Visual Basic
C
#
Most programming languages are
Turing complete
, meaning they can
solve
all problems a computer can solve
Reason for different programming paradigms
Some problems are better suited to being
solved
using a
certain paradigm
than another
Categories of programming languages
Low-level
High-level
Machine code
Least abstracted, closest to what happens on a computer, written in
binary 1s
and
0s
Assembly language
Uses
short
code words called mnemonics, one-to-one relationship with
machine
code
High-level languages
Languages that can go further than machine code and assembly language, developed from the 1950s
Categories of
high-level languages
Imperative
Declarative
Imperative languages
Use statements that change a program's state, focus on
describing
how a program
operates
Declarative languages
Focus on
what
the
program should accomplish
Imperative programming paradigms
Procedural
programming
Object-oriented
programming
Procedural programming
A type of imperative programming paradigm where a program is built for one or more
subroutines
Object-oriented programming
A more modern extension of the imperative programming approach, focusing on a
modular
approach
The evolution of programming languages and paradigms has progressed from
low-level
to high-level, including
procedural
and object-oriented approaches
There are advantages and disadvantages to
machine code
versus
assembly language
Procedural programming
and object-oriented programming are two key
imperative
programming paradigms
Procedural languages
One of the most
common programming paradigms
in use
Procedural
languages are often referred to as
imperative
languages
Imperative
Literally means to give an
order
or an
instruction
Procedural languages
Focus on telling a computer exactly what to do by the way of step by step
instructions
Lay code out as a series of statements such as
sequence
,
selection
and iteration
Developed in a
modular
way, with blocks of code identifying set tasks that need to be completed
Make use of
procedures
and
functions
In the exam, you need to be able to read,
trace
, amend and
write procedural program code
using a variety of the constructs and systems available
Procedural languages
The
exam board
doesn't actually specify which specific
procedural languages
you should learn, that choice is most likely up to your teacher
Although the
syntax
of each procedural language is a little different, the
underlying concepts
are exactly the same
Assembly language
Substituted
the
binary codes
with simple sequences of letters known as mnemonics
Assembly language
Directly
translated
into binary machine code by a
translator
known as an assembler
Low
level language
Little Man Computer
(
LMC
)
A
conceptual
computer often used in education theory and exams to help students learn, test and understand the basics of assembly
language
LMC instruction set
11 simple instructions
on
mnemonics
Real instruction set and
assembly
code would contain many more instructions than the
LMC
There are many free
LMC
simulators on the web that allow you to practice
assembly code
Parts of the LMC interface
RAM
main memory with 100 locations
Arithmetic Logic
Unit
Accumulator
to store results
Program counter
to store address of next instruction
Instruction register
to hold op code
Address register
to hold operand
Input tray
for user input
Output area
for program output
Program counter
Holds 2 digits from
0
to
99
Accumulator
Can hold
3
digits and a sign, from
-999
to +999
Labels
Names assigned to addresses to help write programs more
easily
Running an LMC program
1.
Enter
program into
simulator
2.
Press submit
to convert to
intermediate output
3.
Press run
to
execute
program
LMC
computer can't tell whether
memory
contains instructions or data
Modern computers
can segment their
memory
Output of one program can become the
instructions
of another
See all 149 cards