Skip to content
On this page

Patterns

Why? 🤔

Why do we care about patterns and why do we want to study them?

Universe

In the space and time there is matter and energy.

Universe: Diagram of the universe objects and classes

Senses

Inside that Universe there are living beings that have the ability to perceive external and internal physical stimulations through certain organs which are passed to our nervous system:

  • Sight
  • Hearing
  • Smell
  • Taste
  • Touch

Physical signals that can vary in their frequency, width, ... and transform in different color values decomposed into combinations of red, green and blue or different values of words decomposed into phonemes, a, ae, e, i, o , u, ... depending on the language.

Light spectrumLight spectrum

Measurement units

Basic units

PhysicsOther areas
International Unit SystemEconomic system, Educational System...
Time: secondMusic: pulse
Length: meterEducation: subject
Mass: kilogramMoney euro, dollar

Derived units

PhysicsOther areas
International Unit SystemEconomic system, Educational System...
Force: newton (mass*length/time2)Music: compass
...Maths: complex number, vector...

Names

PhysicsOther areas
International Unit SystemEconomic system, Educational System...
Multiples: kilometerMusic: salsa, trap...
Time: year, month, weekEducation: graduated
Distance: light yearComputer science: kilobyte, petabyte...

Relations

ValueRomanDecimalBinary
0Non existent00
next(0)I11
next( next(0))II210
............
next( next( next(0)))...XII121100
............

What? 🤓

What is a pattern?

Pattern, model that is used to get an equal thing

Pattern for an artisan and in industry:

Cloth pattern

Pattern in science:

Parabolic throw

Equality

Body/EntityIdentity
What it is, exists or can existSet of characteristics that differentiates something or someone from others
What makes something's essence beConscience that someone or a group have and that makes them be their own and not other
EqualContext
That has the same characteristics of another person or thing in some or all aspectsPrecision: necessary to provide the grade of precision when comparing equality
Of the same class or conditionIdentifier: people's names or nicknames, concepts, my first child...
Of the same value or preciousness

For what? 😲

For what do we need patterns?

To be able to, from the present, study the past and predict/imagine the future.

How? 🧐

How are patterns? How do we find them in our universe?

Pattern types

Recurrent

It will eventually repeat. Example of recurrent pattern would be the rain. You don't know when but it will eventually rain at some point.

Iterative

It repeats, the end of one iteration directly connects with the beginning of a new one. Example of an iterative pattern would be day and night.

Recursive

It repeats in itself. You can amplify or reduce its point of view and it will replicate the same structure.

Recursion everywhere

We can find examples of recursion in nature

CaracolaCaracola

BrocoliBrocoli

In our daily life

Family treeFamily tree

In art

Big waveKatsushika Hokusai

Simple Patterns

LineThree pointsCircle
LineTriangleCircle
SequenceAlternationCircularity
Line of timeWater molecule, mountainsCells, soap bubbles
Metro linePyramidsHurricanes
natural or artificial frontier, line of products...Social organizations, economy...Roundabouts, vicious and virtuous circles

Patterns in software 🖥

Graphical User Interface

LineThree pointsCircle
FormWindow with panelsNavigation map
SequenceTreeGraph

Data types

LineThree pointsCircle
Class, structure, registry, entity...Inheritance, composition, union, aggregation...Circular dependencies, circular relations...

Data structures

LineThree pointsCircle
ListTree, HierarchyGraph
SequenceTreeGraph

Flow control sentences

LineThree pointsCircle
Sequential sentenceAlternant sentenceIterative sentence
{
console.log("Title");
console.log("Subtitle");
...
}
if (x > 0) {
...
} else {
...
}

switch (x){
case 0:
...
break;
}
while (x > 0) {
...
}

do {
...
} while (x > 0);

Development methodologies

LineThree pointsCircle
WaterfallCrystal ClearIteratives
WaterfallCrystal clearXP

Domain model 👌🏼

The domain model describes the most important concepts (types of objects) of a context, things like objects from the domain and the relations between them.

  • Business objects that represent things that are manipulated by the business.
  • Real world objects and concepts which a system has to keep track of.
  • Events that will or have already occur.

With the objective of

  • Comprehend the structure and dynamics of the organization in which the system will be developed.
  • Comprehend the latest problems of the target organization.
  • Ensure that clients, final users and developers have a common comprehension of the target organization.
  • Obtain the requirements of the system to help the target organization.

DANGER

Never talk about the system's software! Don't mention words like view, validator, etc.

Unified Model Language

The usage of UML (Unified Model Language) is recommended to model the domain. RUP (Rational Unified Process) already does so.

Each symbol (lexical) related (syntax) in a diagram has a standard meaning (semantics). We avoid ambiguity and different people interpret the same from the same diagram, opposed to non standardized arrows and boxes.

Structural diagrams

Objects diagramClasses diagram
Picture (static) of entities from realityPicture (static) of classes of entities from reality
Objects diagramClasses diagram
Barely usedExtremely used

Behavioral diagrams

Activity diagramState diagram
Video (dynamic) with sequence of highlighted actionsVideo (dynamic) with sequence of NOT highlighted actions, highlighting in-between states
Objects diagramClasses diagram
Barely usedExtremely used
Sequence diagramCollaboration diagram
Video (dynamic) with sequence of actions between different collaboratorsPicture (static) without sequence of actions between different collaborators
Objects diagramClasses diagram
Barely usedExtremely used

Domain Model conclusions

  • Comprehend the context of a system with crucial knowledge about use cases.
  • Define a common vocabulary for users, clients, developers and others involved.
    • Glossary of keywords.
    • Consistent mix of all participants' language.
    • Suggest internal classes during analysis.