Programming paradigms Flashcards
What is a programming language
A formally defined language comprising a set of instructions intended to control the operation of a computer
What is a programming paradigm
A way to classify programming languages based on their features. Most languages can be classified into multiple paradigms.
What is functional programming
A way of writing software applications using only pure functions and immutable values.
Key features of low level languages
Opcodes (Mnemonics), Operands, Registers, Memory Modes
What are low level languages good for
Device drivers, OS development
(particularly embedded systems),
ultra high performance code
What are low level languages bad for
Portability, abstraction, rapid development
Key features of procedural languages
Sequence, Selection (a.k.a. Branching), Iteration, Recursion
Linear execution of instructions.
What are procedural languages good for
Writing code with lots of algorithms.
Anything where you want fine control
and high performance but want more
portability than assembly language.
What are procedural languages bad for
Brevity (other paradigms provide more concise alternatives).
key features of OOP
Encapsulation, Instantiation, Inheritance, Polymorphism
What is OOP good for
Abstraction when dealing with real
world objects. Modularity.
Key features of functional languages
First Class, Higher Order and Pure Functions. Immutability and reusing these functions
What is OOP bad for
Efficient code for limited resource
environments, transparent (easy to
trace) code, concurrent programming
What are functional languages good for
Robust, predictable and reliable code.
Efficient and highly optimisable code.
Concurrency safe processing
What are functional languages bad for
Beginners as hard to learn and program in
Key features of declaritive languages
Queries, C.R.U.D., Facts and Rules, Relationships
What are declarative languages good for
Databases, Expert systems, Artificial Intelligence
What are declaritive languages bad for
Control over what the computer is actually doing
Which are imperitive
Procedural and oop
WhIch are declaritive
functional and logic
What are imperitive languages
Use code that clearly specifies the actions to be performed
What does oop focus on
Easy to re use and update and maintain
What does declaritive focus on
Stating the desired result rather than instructions to get that result which is why it is used for AI
example of functional languages
java and c#
Procedural langauges positive
Easy to implement
Procedural languages negative
brevity and not suitable for all solutions
What are procedural languages
Procedural languages use traditional data types such as integers and strings which are
built into the language and also provide data structures like dictionaries and arrays.
What is structured programming
Structured programming is a popular subsection of procedural programming in which the
control flow is given by four main programming structures:
Advantages of OOP classes
- Classes can also be used across multiple projects.
www.pmt.education
Advantages of oop reusability
- OOP allows for a high level of reusability, which makes it useful for projects where
there are multiple components with similar properties. The properties of inheritance
and polymorphism within OOP allow for this.
Advantages of OOP planning
- OOP requires advance planning to determine how the problem will be broken down
into classes and how these will link to each other. A thorough design can produce a
higher-quality piece of software with fewer vulnerabilities.
Advantages of OOP abstraction
There is a high level of abstraction and it is not necessary for programmers to know
details about how code is implemented. Once classes have been created and
tested, they can be reused as a black box which saves time and effort.
Advantages of OOP encapsulation
- Encapsulation is a key reason for choosing OOP as it makes the code more reliable
by protecting attributes from being directly accessed. Code for different classes can
also be produced independently of others.
Why is OOP easy to update and maintain
Because of its modularity
Disadvantages of OOP
This is a different style of programming and so requires an alternative style of
thinking. This can be difficult for programmers accustomed to other paradigms to
pick up.
- OOP is not suited to all types of problems. Where few components are reused,.
- Generally unsuitable for smaller problems
Procedural
uses sequence of instructions that an be contained in procedure
Advantages of oop inheritence
inheritance can be used to extend upon existing classes
Advantages of oop debugging
Can be easier as encapsulation limits how attributes are changed
OOp teamwork
Better for coding as a part of a team as classes can be distributed between teams