programming techniques?? Flashcards
Imperative programming
uses a series of instructions telling comp what to do w/ input in order to solve problem
Procedural programming
uses a sequence of
instructions which may be contained within procedures.
These instructions are carried out in a step-by-step manner
Structured programming
a kind of procedural programming which uses constructs: selection, sequence, iteration + recurssion rather than ‘go to’ stattements.
Modular techniques used to split large program intoo manageable chunks
Declarative programming
statements describe prolem to be solved.
language implementation then finds best way of solving it
used to create, amend + query databases
Logic programming
form of declarative programming.
is a paradigm expressing logic of computation w/o expressing control flow
consist of logical statements
code defines a set of facts and rules
What is an inportant feature of declarative programming
backtracking
whats used to find answers to problems in logic programming
queries
what uses procedural programming
python, basic, pascal, c#
what uses oop
java, c++, visual basic.NET, python
what uses declarative programming
sql, prolog
what uses functional programming
haskell, javascript, logo
define backtracking
going back to a previously found successful match
3 important things in declarative programming
facts and rules and goal
facts in declarative programming
a predicate which may have arguments + is something unconditionally true
rules in declarative programming
used to define a relationship b/w facts.
stored in the knowledge base.
true depending on given condition
goals in declarative programming
query to b solved
def instantiation
process of creating a new object from a class
advantages imperative programming
Very simple to implement
It contains loops, variables
disavantage imperative progrmaming
Complex problem cannot be solved
Less efficient and less productive
Parallel programming (parallel processing) is not possible
Imperative programming is divided into three broad categories which are?
Procedural, OOP and parallel processing
oop is
a collection of classes and object which are meant for communication.
The smallest and basic entity is object and all kind of computation is performed on the objects only.
More emphasis is on data rather procedure. ??
oop advantages
Data security
Inheritance
Code reusability
Flexible and abstraction is also present
declaative programming divided into?
logic, functional, database
what does the paradigm used depend on
problem to be solved
abstraction in declarative programming
how the data is obtained is abstracted from user
can procedural programming solve all problems
no
or is inefficient
is abstraction used in oop
ya
what is code in oop designed for
reusability + easy maintenance
how is oop reusable
templates are used to create instances of objects
what do classes in oop have
attributes and methods
how is oop easy to maintain
if an error in the methods, easy to locate where error is
what d objects have
data - attributes
operations on that data - methods
all processing in oop is used on
objects
def class
blueprint of an object
defines attributes + methods that capture common characteristics + behaviours of the object
whats a constructor
a special method creating an object based on the class
exist in every class
new(attributes)
encapsulation def
Is the process of data hiding by keeping an object’s attributes private so their
values can only be directly accessed and changed via public methods defined for the class and not
from outside the class. This means that objects only interact in the way intended and prevents
unexpected changes to attributes, maintaining data integrity
inheritance def
Is when a derived class inherits all the methods and attributes of its parent
class/superclass.
The inheriting class may override some of these methods and attributes and may also have additional extra methods and attributes of its own.
‘is a’ rule
is obj a an obj b
used to determine if inheritance appropritate
Polymorphism def
allows objects of different classes to be treated as objects of a common superclass or interface