cdegroot

cdegroot

Scrutinizing the role and use of design patterns

Just watched the videos - interesting stuff and I do think there’s a higher level language lurking in Elixir. These experiments hopefully help guide extracting the right one.

I am surprised though that @pragdave states “design patterns are crap”. As a card-carrying Hillside Group member such a blanket statement probably has to offend me ;-).

(If he meant - the original GoF design patterns are crap because written for a crap language - for a fun read, pick up the Design Patterns Smalltalk Companion - I’m ok with that, of course)

Most Liked

peerreynders

peerreynders

Patterns Manifesto:

We are uncovering better ways of developing software by seeing how others have already done it.
Kevlin Henney

Patterns are an aggressive disregard of originality.
Brian Foote

IMO too many “pattern consumers” have very selective memories. Each pattern catalog entry has multiple sections:

  • Intent
  • Also Known As
  • Motivation
  • Applicabitity
  • Structure
  • Participants
  • Colloaboration
  • Consequences
  • Implementation
  • Known Uses
  • Related Patterns

Before applying a pattern it is crucial to understand the full implications of the “Applicability” and “Consequences” sections as use case constraints could easily turn a pattern into an anti-pattern.

Patterns aren’t gold standards. They merely record “this approach has worked for us when we faced this particular problem within our specific context”.

pragdave

pragdave

Author of Programming Elixir

Design Patterns are not crap. They just shouldn’t be used by people in the way they are.

They are treated by most developers as recipes: “I need a to implement a xxx pattern”.

But they aren’t. Instead, they are a naming system. Once you’ve written code, you can say “oh, look, that’s like a strategy pattern.” You could then refer to it as such as a short cut when talking with other developers.

Next time you meet an architect, ask them about Christopher Alexander or A Pattern Language. I’ve never met one you knows what I’m talking about…

StefanHoutzager

StefanHoutzager

If you get rid of implementation inheritance and subtype polymorphism when you work with an oo language you will need less pattern implementations. For example “The factory method pattern relies on inheritance” (Factory method pattern - Wikipedia).
3 key differences between Elixir and Ruby? - #5 by StefanHoutzager Complexity breeds complexity.

Where Next?

Popular in Discussions Top

cvkmohan
The upcoming Phoenix 1.6 release looks very interesting. Became a habit to watch the commits - and - what they are bringing in. phx.gen...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
ricklove
I was just introduced to Elixir and Phoenix. I was told about the 2 million websocket test that was done 2 years ago. From my research, t...
New
nburkley
AWS re:Invent is on at the moment with some interesting announcements. One new feature in particular is the Lambda Runtime API for AWS La...
New
AstonJ
Are there any Elixir or Erlang libraries that help with this? I’ve been thinking how streaming services like twitch have exploded recentl...
New
PragTob
Hey everyone, this has been brewing in my head some time and it came up again while reading Adopting Elixir. GenServers, supervisors et...
New
New
eteeselink
Hi all, In the last days, two things happened: A blog post titled “They might never tell you it’s broken” made the rounds. It’s about ...
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
tomekowal
Hey guys! I want to create a toy project that shows a chart of temperature over time and updates every 5 seconds. I feel LiveView is per...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement