• No results found

Deel 2: Nominaal Programmeren Het principe van

N/A
N/A
Protected

Academic year: 2021

Share "Deel 2: Nominaal Programmeren Het principe van"

Copied!
2
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

1

Deel 2: Nominaal Programmeren

Het principe van nominaal programmeren met je eigen woorden kunnen uitleggen.

Nominal methods only guarantee their effect under stated conditions. For that purpose, specifications of nominal methods include so-called preconditions imposing restrictions under which clients can invoke them.

Het concept class invariant en de semantiek ervan kunnen uitleggen.

A class invariant is a condition that must hold at all steady times.

Class invariants that apply to class properties have semantics that is slightly different from the semantics of class invariants that apply to object properties. Broadly speaking, invariants that apply to class properties must be satisfied at all times. Invariants that apply to object properties must only be satisfied at steady times.

Class invariants that apply to class properties must be satisfied at all times. More in particular, such invariants must be satisfied from the very moment their class becomes involved in the application. Each time we inspect a class property, we may thus assume that its value satisfies all restrictions imposed on it.

Class invariants that apply object properties do not need to be satisfied by all objects of their class at all times. We allow temporary violations of invariants imposed on object properties for two reasons.

First, the initialization of a new object with several properties involves successive steps.

Upon entry to a constructor, the newly created object typically does not satisfy all of the class invariants imposed on its properties. Only when we move towards the end of the constructor, and we have initialized most of the properties of the newly created object, that object will satisfy all its invariants.

Secondly, changing the state of some objects can lead to intermediate stages in which some of them temporaritly violate their class invariants. This can be the case if a single method must change the state of several objects at the same time.

Het concept class preconditions en de semantiek ervan kunnen uitleggen.

Formal argument types impose restrictions on the clients of a class. Types are often not powerful enough to express all the restrictions that apply to the arguments involved in a method. That’s why preconditions become handy; they impose additional restrictions on arguments involved in a method. It offers an instrument to inform clients of class to not invoke methods under exceptional circumstances. So we deal with illegal values with the help from preconditions.

Example

The specification of the class of bank accounts will include a class invariant stating that the balance of each bank account may not go beyond the credit limit.

hjh

(2)

2

Preconditions must hold upon entry to their method. Preconditions imply duties for the clients of class. We can also substitute invocations of mutators and constructors in effect clauses by their preconditions, so we can obtain preconditions imposed on the specified method.

De specificatie van post-condities, effect-clauses en return kunnen uitleggen.

Triviaal.

Referenties

GERELATEERDE DOCUMENTEN

• Move both the theorem and the proof completely in appendix • Easily change the defaults, and create your own styles/environments • Include sketch of proof in the main text, and

“That is considered an impertinent question in Sky Island,” he answered, “but I will say that every Boolooroo is elected to reign three hundred years, and I’ve reigned not

With other variables held constant, efficient pipeline utilization was positively related to average daily flow, increasing by 5,820 for every single million cubic feet

My findings contradict this view and suggest that: (1) both markets and banks show strong signs of convergence, after controlling for country-level institutions

Class variables are also known as static member variables and there's only one copy of that variable that is shared with all instances of that class.. Value semantics en

The most promising forecasting strategy is a Delphi panel expert forecasting session followed by allocation of the forecasted sales levels to the available production capacity via

Day of the Triffids (1951), I Am Legend (1954) and On the Beach (1957) and recent film adaptations (2000; 2007; 2009) of these novels, and in what ways, if any,

56 The UNEP suggests that the issue of liability vis-à-vis geoengineering must be discussed but is pessimistic on the prospects for any international governance or