Please enable JavaScript.
Coggle requires JavaScript to display documents.
Principles of Programming (Describe the role of an object-oriented…
Principles of Programming
Describe the differences between high-level and low-level languages/Identify and describe situations that require the use of a high/low-level language/Identify and justify which type of language would be best suited to develop a solution to a given problem
Low Level Languages
An example would be
Assembly
language - it's unique for each CPU type.
At a very 'low level' to the hardware.
Can be used for
device drivers; embedded systems; custom hardware.
Advantages
-
small
storage requirements;
fast
execution
speed
.
Disadvantage
- generates
one machine code
instruction per
1 assembly instruction.
High Level Languages
An example would be
Java
.
Uses
Human-like commands
(English) making it
easier
to
understand/learn/program.
Generates
many machine code
instructions
per 1 line of code.
Can be used for
general applications
e.g. Payroll.
Advantages
-
easier
to learn;
identifiers
can be
long
and
meaningful
; allow the use of
powerful in-built commands
that perform quite
complex
tasks; allows
creation of modules
that can be
re-used
and accessed by
other parts
of the program.
Disadvantage
- generates many machine code instructions per 1 line of code.
Levels of Languages
High Level
Similar to human language
, e.g. Java.
Low Level
Use mnemonics to create instructions
, e.g. assembly language.
Machine Level
Uses 1s and 0s to create instructions
, e.g. binary.
Describe the distinguishing features of different types of programming paradigms
Event-driven
High level
programming language.
Waits for a user interaction
, i.e. button click, keyboard press.
Particularly
suitable for developing
, e.g. GUI; games.
Programmers
must think of
events and triggers
- not a procedural program.
Visual
High level
programming language, e.g. Scratch (event-driven too).
Drag and drop
blocks
of code.
Easier
to learn -
more intuitive
because
visual
; very
good help systems.
However...
limited
screen space;
not
ideal for
larger programs
; takes
longer than typing
for
experienced
programmers.
Procedural
Based on algorithms
; step-by-step process for solving a problem.
Obey instructions
and
carries
out
actions
/
calculations
etc.
Allows
tight control
over the
operation
of hardware.
Used in programs where
similar operations
may be carried out at
varying stages
of the program
executions
.
Use
: Creating
general applications
, e.g. Payroll, Data Handling
Mark-up languages
Includes
HTML
and
XML
- Microsoft Word: .docx uses XML.
Used to
add meaning to text
(link, bold etc).
Changes the format
or display of the text.
HTML
(HyperText Markup Language) - commands such as <h1> or <href>. A
start
tag and
end
tag.
XML
(eXtensible Markup Language) - structuring and marking up data for
storage, not display
. Developer can
create own tags.
Often
combined
with languages such as
JavaScript
.
Describe the role of an object-oriented approach to programming and the relationship between object, class and method
Objects
Attributes
(Variables) e.g. size, shape, colour.
Behaviours
(Methods) e.g. changeSize(), changeShape(), changeColour().
Meaningful identifier
- a name used to identify a
class, variable or method
.
Object Oriented Programming
Class
: a
template defining new methods and attributes used to make objects.
Object
: an
instance of a class, containing data and associated routines.
Method
: an
action/behaviour that can be performed on an object.
An
object
includes
both the data and associated processing
- attributes and methods.
Inheritance (Advanced OOP)
Definition:
when a new (sub) class is created that is based on another class and it can take on the methods and attributes of the parent class.
Creates
groups
of classes.
Efficient
- no
repeated
code.
Superclass/
Subclass
Encapsulation (Advanced OOP)
Definition: the
process of keeping data within a class private and only allowing it to be accessed by public methods.
Subclasses
will not inherit
private attributes/methods.
Subclasses
will inherit
public or protected attributes/methods.
Polymorphism (Advanced OOP)
Allows methods to be adapted from inherited class.
Overriding
- subclass, same parameters.
Overloading
- subclass, different parameters.
Forms/GUIs (OOP)
Enables the
production of buttons
/icons which is
useful
in a
visual
environment.
Event-driven languages
- objective linked to buttons on forms, click a command button to start a sequence of code.