1/31
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
characteristics of procedural programs
-instructions are executed in the order in which they appear
-subroutines can be called from anywhere in the program
-data is stored as variables and constants
-data structures can have a local or global scope
characteristics of the structured approach
-designed from the top down(elements are broken down into smaller tasks)
-keeps programs easy to understand and maintain as they are easier to navigate
-testing can be carried out on individual modules
-easier to develop collaboratively as each module can be assigned separately
charts representing the structure of a structured program
each procedure is diaplayed as a rectangle and connected to parent or child procedures with a line, with parent procedures above their children
object-oriented programming
programming paradigm where programs are formed from, and designed around, objects which contain their own properties and methods
OOP main principles
inheritance, encapsulation, abstraction and polymorphism
-programs have a clear structure which makes developing and testing easier, as well as splitting projects among teams
-the use of classes allows code to be reused throughout the program(and sometimes in other programs) improving readability and data efficiency
class
a blueprint for objects specifying their properties and methods
(a “type of thing”)
data and instructions in a class, respectively
can be public or private(accessible from anywhere in the program, or only from within the object and its inheritors)
instantiation
the creation of an instance of an object from a class using a constructor
a method in a class called to create and initialise an object from it, assigning a reference to a variable of the class type
constructors can be implicit(automatic, with default parameters) or explicit(eith user-defined parameters)
association
associated objects form part of their container object as a property, in a has-a relationship
OOP design principles
-encapsulate what varies
-favour composition over inheritance
-program to interfaces, not implementation
program to interfaces, not implementation
programming to depend on interfaces rather than implementations improves code flexibility, and allows unrelated classes to easily make use of similar methods
interface
a set of abstract procedures determining what methods an object should have, without providing the code for them
implementations
classes that fulfil the rules determined by interfaces and provide the code
class diagrams
used to visually represent the relationships that exist between classes
classes are represented by boxes with different connectors representing different kinds of relationship, can exhibit various levels of detail
inheritance diagrams
sshow inheritance relationships that exist between classes- unfilled arrows point from classes to their inheritees and always point upwards
association in class diagrams
association is shown in class diagrams using diamond headed arrows, unfilled and filled diamonds correspond to aggregation and composition respectively
association in UML
in unified modelling language, association between two classes is modelled using lines
a normal line represents bidirectional association while a line with an arrow represents one-way association where a class can call the one the arrow is pointing to but not vice versa
class diagrams with properties and methods
class boxes are split into three, containing the class's name, properties and methods from top to bottom respectively
plus and minus signs in front of properties and methods denote they are public and private respectively
hashtags indicate protected properties or methods