1 minute
Contact me

Name: Bridge

Type: Structural

Use when you want to:

Handle orthogonal ("Changing A does not change B") concerns separately. Think colors, shapes.

Variants

From Wikipedia:

The bridge pattern is a design pattern used in software engineering that is meant to "decouple an abstraction fro...

1 minute
Contact me

Name: Adapter

Type: Structural

Use when you want to:

Make interfaces compatable

Variants

From Wikipedia:

In software engineering, the adapter pattern is a software design pattern that allows the interface of an existing class to be used as another interface. It is often used to make...

0 minutes
Contact me

Name: Prototype

Type: Creational

Use when you want to:

Clone an object rather than create one

From Wikipedia:

The prototype pattern is a creational design pattern in software development. It is used when the type of objects to create is determined by a prototypical instance, which is clo...

1 minute
Contact me

Name: Singleton

Type: Creational

Use when you want to:

  • To manage a shared resource.
  • To read global state.

A quick note:

There aren't a ton of reasons to ever use a singleton. If however you want global information to flow into the singleton and not back into the app again, then it is a...

1 minute
Contact me

Name: Builder

Type: Creational

Use when you want to:

  • do lots of things to build an object
  • design classes whose constructors or static factories would have more than a handful of parameters.

From Wikipedia:

The builder pattern is an object creation software design pattern with the inten...

4 minutes
Contact me

Name: Factory

Type: Creational

Use when you want to:

  • Generate an instance for a client without exposing any instantiation logic to the client
  • Hide the dependencies of class instantiation from clients

Variants

Simple

From Wikipedia:

In object-oriented programming (OOP), a factory is...

2 minutes
Contact me

Starting 2019

It's that time of year when everyone starts to reflect on the previous year and set goals for the current one. In the spirit of jumping on bandwagons this is my note to self. I have been doing some thinking over the last few weeks and have tried to identify some things I would like t...

0 minutes
Contact me

The Sierpinski Triangle is rather beautiful. I thought might be interesting to try and create it in code. Luckily I was able to find many others who had attempted the same thing. I did a little reading on what was involved and the steps are pretty straight forward:

  1. Start with an equilateral triang...
3 minutes
Contact me
Gravitational Attraction

If you want to see the pull of gravity, drop whatever you're holding right now. If you had listened, you may have seen your phone drop to the ground and bounce.

It may even have a few scuffs, or that pen may have hit the desk. Whatever the scenario there is no denying gravity is something that we...

1 minute
Contact me
Recursion

Recursion

Recurions is one of those topics in programming that I have had an interest in. Partly because infinate recursion is well... so weird. It reminds of me of the Eternal Return Theory.

However in code we have control of the boundaries and can stop the recursive call at anypoint. This...