Home > Posts > Design Patterns

Design Patterns

by Alex Loret de Mola

 

I live my life by patterns;
rituals in code and conduct
that keep me safe, predictable.
{

A repository is a structure to access and modify data
in an organized manner:
a pattern you use in code to persist knowledge,
to retrieve it,
sometimes to suppress it.
{

Knowledge like, when you first told me I was your shelter
{
                          shelter, temporary housing in emergency situations;
}

it wasn’t an expression of love:
it was a foreshadowing.

}
A facade is when you take something complicated
and make it easier to digest.
{

{

Digest, to consume a thing,
strip it of its nutrients, and
excrete what remains

}
Love isn’t just safety,
and it’s something more than comfort,
but you can build a reasonable interface
that looks a lot like love with
these simple tools.

}

}

I conduct rituals
in code and pattern, to keep me focused
on something other than truth.
{

A memento is a bit of data
you can save to bring an object back
to its previous state.
{

I threw away all of our mementos;
they reminded me of you, but
never brought you back.

}

}

 

I live my life by rituals;
coded patterns and conduct
to keep me static.
{

A composite builds complex structures
from basic components.
{

Sometimes people say marriage
is a joining of two people, where
they become more
than what they were apart.
{

apart, the distance between us
when we slept

}

I’m not sure if I believe that anymore.

}

A proxy is a hollow shell that represents
another object.
{


It’s useful for when you can’t be bothered
to show up,
when I can’t be bothered to come home
from work.

}

}

I live my life by code,
conducting patterned rituals
that keep me obsessed.
{

A bridge separates an object’s interface
from its implementation.
{

You use it when you know an object
needs to change, when it needs
to keep functioning
but nothing that made it what it was exists anymore.

}

}

 

I code my life to ritual –
{

// where are you?  I can’t conduct
// these patterns alone.

}

 

Parting ways is a pattern you should only take
after deliberate consideration.
When the software has degraded
such that it is unusable –
when facades are all that’s left
of your interfaces
and you can’t query for happier times
in your repository
and every bridge you built is a proxy for love –
part ways with the codebase and start over.

 

 

They say you are what you eat; Alex Loret de Mola is therefore a semi-sentient amalgamation of bread sticks, pizza, gas station taquitos and too much coffee. He also writes poetry.