Object Oriented Languages Flashcards

(52 cards)

1
Q

Purpose of OOLs

A

Current languages could not simulate real world entities properly, better cohesion and coupling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

OOL Influences

A

Procedural Languages, Lambda Calculus, Types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

class hierarchy

A

expresses relationship between classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

polymorphism

A

function is applicable to more than one type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

white box inheritance

A

sharing, but breaks encapsulation. Inherited class internals visible to subclass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

inheritance

A

reusing the definition of one type of object to define another type of object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

encapsulation

A

bundles slots and the methods that operate on those slots into a single unit, leads to loose coupling and strong cohesion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

black box inheritance

A

uses functionality of superclass without exposing the superclasses’ implementation details, doesn’t break encapsulation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

cohesion

A

how much code belongs together

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

weak cohesion

A

coincidental bundling, similar functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

medium cohesion

A

components provide similar services or functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

strong cohesion

A

each component contributes to software function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

coupling

A

how connected the code is

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

loose coupling

A

changes in A are unlikely to affect B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

tight coupling

A

changes in A are likely to affect B, puts change costs up

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

best type of coupling

A

loose

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

best type of cohesion

A

strong

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

strong cohesion and loose coupling

A

results in understandability, maintainability and adaptability

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

generic functions

A

a function that can run on multiple data types

fn <T>my_func(p: T) {} in rust, same as a polymorphic function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

generic functions features

A

classes, instances, methods, multi methods, slots, singe/multiple inheritance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

prototyping

A

simplest kind of OO, object = attributes + behaviours

22
Q

delegation

A

enables the sharing of behaviour, object = attributes + behaviours + parent

23
Q

traits

A

sharing behaviour (methods)

24
Q

maps

A

sharing structure (slots)

25
class
shares behaviour(methods) and structure(slots), object stored data and link to class
26
method dispatch
selecting which method implementaiton to use at runtime
27
single dispatch
search up the inheritance chain until method matching message is found
28
multiple dispatch
for some operations method selection depends on more than one item of information ## Footnote MI is classes having multiple parents, while multiple dispatch is choosing a method using multiple arguments
29
class precedence list
the linearised list of the superclasses of a class, defining the order of inheritance
30
single inheritance in CPL
a list of classes in proximity order, nearest first, between a class and the root of the hierarchy
31
multiple inheritance in CPL
same as SI expect for special rules are needed to handle duplications arising from join in the class hierarchy
32
method composition
methods in a class combine methods from composed classes
33
visual single inheritance
tree
34
visual multiple inheritance
directed acyclic graph
35
multiple inheritance benefits
* possibly better sharing and reuse of code * better fit with situation being modelled
36
an ontology
* reflects structure of the world * addressed concept relationships * physical representation is not relevant
37
an oo class structure
* relects structure of data and code * is usually about behaviour (methods) * physical representation is crucial
38
MI downsides
* hard to use a complex MI in practice * prededence list computation can be unpredicatable * more fragile with respect to changes (tight coupling)
39
single inheritance with single dispatch
if the class of the current object has a method defined, use it; else recurse to the parent class
40
linearisation
flattening a class hierarchy to make a CPL, many languages have a builtin linearisatoin algorithm
41
monotonic CPL
the CPL of a class is consistent with the CPL of its parents
42
C3 linearisation
* used by many languages * fairly easy to implement * its monotonic * used in python, perl, etc
43
dynamic lookup
when a message is sent to an object, the method to be executed is determined by the way that the object is implemented | the object “chooses” how to respond to a message, and different objects
44
abstraction
implementation details are hidden inside a program unit with a specific interface
45
subtyping
means that if some object a has all of the functionality of another object b, then we may use a in any context expecting b
46
C++ Multiple Inheritance
* everything is defined by the programmer * programmer controls base class replication through virtual inheritance * explicitly denote origin of inherited members
47
C++ Virtual Inheritance
in the case that a subclass is set to inherit two copies of a base class virtual inheritance ensures that only a single copy is inherited
48
Class Composition
alternative to MI, composed classes are variables in the object composing Istream and Ostream we write class IOStream: public: Istream i; Ostream o; method and slot lookup is done at coding time by the programmer (str.o.ptr or str.i.ptr)
49
Liskov Substitution
Suppose S is a subtype of T. Then whenever we need an instance of type T we can use an instance of type S, and our code should still operate correctly. | a subclass must honor the behavioural contract of its superclass
50
reflection
the transformation and insertion of data from the application into the processor of the application | a language can inspect and alter itself ## Footnote self-modifying programs are dangerous and hard to understand or control
51
metaobject programming
provides reflection through a framework which makes it safe to use
52
reification
the extraction and presentation of data from the processor of an application to the application | allows a program to examine its own structure of behaviour ## Footnote * debuggers reify and reflect * Java's class-loader reflects * eval in Lisp reflects