36 terms

Programming Paradigm

STUDY
PLAY
Speed of Code Generation
- no. lines written
- suitable paradigm
- efficiency, elegance
- modularity
- CASE tools
Approach to Testing
- OOP: modular - simpler to test small portions of code
- logic: human-like, less code
- imperative: control structures
Effect on Maintenance
- ability to meet changed requirements
- detailed documentation
- modularity: only the appropriate module needs to be modified
- companies select only widely understood languages
Efficiency of Solution Once Coded
- measured in terms of speed e.g. response time
- imperative: communicates closely with CPU operations
- logic/OOP: less hardware dependent, less efficient performance
- modern hardware capable of handling high level languages, therefore performance issues are not usually a concern
Learning Curve (Training Required)
- programming languages take time to master
- expertise grows over time
- learning a new language is much simpler after learning another
- can be difficult learning a new paradigm
- shift in market towards OOP e.g. C++, Java
- 'obtuse' lagnuages are generally dealt with by specialise groups e.g. Prolog, Lisp, APL
Paradigm
A philosophical or theoretical framework to refer to a type of programming language.
Sequential
- definite beginning and a single end point
- designated sequence
- relies heavily on variable and control statements
Event-driven
- not a linear sequential structure
- listen for an event to occur and then carries out an instruction
Procedural
- programmer must define in detail all steps in exact order
- specify exact nature of inputs, processes and outputs
Quantum Computing
- atomic particles represent the values 0 and 1
- one particle can exist in many states
- increased processing speed
- need for greater levels of encryption
Neural Networks (Artificial Intelligence)
- computer recognises patterns
- processes data similar to the human brain
- involves a large number of processors connect to a local memory
- each processor is responsible for its own particular data
Machine Lanuage
e.g. Binary
- no need for translation
- directly understoof by computer
- hardware dependent
- binary digits grouped into operation codes (op-codes) and memory addresses
- corresponds to actions in the fetch-execute cycle (Fetch > Decode > Execute > Store)
Assembly Language
- removes programmer from technical aspects of implementation so the programmer can focus on solving the problem
- converted to object code by an assembler
- op-codes replaced by mnemonics
- less susceptible to transcription errors than machine language
Third Generation Language (3GL)
e.g. C++, Java, C, BASIC
- i.e. high level language
- focus on the problem
- no worry of low-level details of how the hardware will carry out the instruction
- more English-like
- must be translated to machine code before execution
- hardware independent
Fourth Generation Language (4GL)
- query and retrieval
- similar to human way of thinking and speaking
- easier to understand
- non-procedural
- concentration on what is required, instead of how it will be achieved
- incorporated into may relational database packages
- errors easier to detect; easier to examine logic; not distracted by syntax
- less efficient than lower level languages
Fifth Generation Languages (5GL)
e.g. Prolog
- natural languages - knowledge based
- very similar to spoken English
- cope with poor spelling and incorrect grammar
- increases programmer productivity
- used for AI
Logic Paradigm
- facts, rules and goals
- problems solved by specifying inputs or facts
- relationship between facts form rules for evaluating a query
- aim is to determine if a goal is true or false (yes or no)
Goal
A query that can result in either being fulfilled (Yes) or not being fulfilled (No).
Knowledge base
A database containing all the facts and rules.
Inference engine
The process the program uses to query the database to come up with a conclusion.
Backward Chaining
Assume the theory is true and then ask questions to systematically verify the necessary rules are present.
Forward Chaining
Start from the beginning of the facts and rules and ask questions to determine which path to follow next to arrive at a conclusion. Forward chaining can result in more than one conclusion.
Expert System
- performs functions normally performed by a human expert in that field
- built by knowledge engineers who specialise in understanding human reasoning
Heuristics
Criteria or principles which result from one or more possible solutions is to determine which is most probable.
Von Neumann Architecture
- design model for stored-program digital computer
- composed of an ALU, Control unit, Memory and Input/Output
- programs and data are held in the same memory
- processor and memory are separated and data moves between the two
- lead to the development of the imperative paradigm
Fetch-Execute Cycle
Instructions are fetched from RAM and decoded by the control unit. They are then executed by the ALU and the result is stored in a memory location.
Object-Oriented Paradigm
- objects are self-contained modules
- contain attributes (data) and methods
- fast becoming the most popular languages
- reusability of code makes the excellent for a wide variety of solutions
Methods
The instructions contained within an object used to process data and communicate with another object.
Classes
The declaration of an object which forms an abstract data type. The class of an object determines its structure and behaviour of a set of other objects that are called instances. A class can inherit features from other classes which are called superclasses.
Inheritance
The ability of objects to take on characteristics of their parent class or classes. Inheritance encourages modularity ad robust code.
Polymorphism
Allows many different objects to use a particular behaviour or method. At runtime a method can process data differently depending on the circumstances.
Encapsulation
The process of including all the attributes an methods that an object needs within itself and hiding them from its external environment.
Abstraction
The process of designing classes so they are reduced to their necessary attributes and methods.
Overloading
Methods which have the same name but accept a different number of parameters or parameters of different types.
Overriding
Methods (or properties) which replace an inherited method (or property).
Imperative Paradigm
- variables and control structures
- fetch-execute cycle
- data and processing are seperated
- programs have a distinct beginning and an end
- predefined data types (e.g. integer, float or real, character, string, array and record)
- requires the developer to understand all details of the problem and solve it completely
- a function can only accept data as its inputs and return data as its output
- programs only designed to solve a particular problem
- programs must be modified to solve related problems
- relies heavily on mathematics
- human brains connects data and processing, imperative seperates them
- doesn't simulated the human brain accurately
YOU MIGHT ALSO LIKE...