Skip to content

Instantly share code, notes, and snippets.

@AndersBillLinden
Last active October 15, 2017 20:39
Show Gist options
  • Save AndersBillLinden/7a40ce891ad4ef358cd2293617efd94a to your computer and use it in GitHub Desktop.
Save AndersBillLinden/7a40ce891ad4ef358cd2293617efd94a to your computer and use it in GitHub Desktop.
Antipatterns

Patterns/Antipatterns

Patterns

KISS "Keep it simple stupid"

KISS is a pattern and the anti pattern of KISS is

  • Using algorithms that are more complex than needed.
  • Adding extra unneeded layers/folders.
  • Doing something more general than needed, adding extra complexity as a cost. Maybe you think you will need to use a function later so the function needs to be that general. The right approach would be to adapt to that when needed or to split the function in two, one for each purpose.

YAGNI "You ain´t Gonna Need It"

YAGNI is a patter and the anti pattern of YAGNI is

  • The concept of saving code for later use. Could be code snippets that will never run. Or maybe the code is put inside a comment.
  • Code that is a result of over generalization, in the belief that you "some day" will use a function in an alternate way.

Anti patterns

APDNUR (Destroying Never Used Resources)

The concept of creating/initializing/opening a resource R, such as a dialog/file/other and if some condition C is met destroy/deinitialize/closing R without ever using it.

The alternative would be to check for C before creating R in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment