My experience has proven otherwise, for over a decade. If I understand you correctly, you’re saying that if I accept an argument, I then validate that argument in every function that expects it? Why would you do that, when you can do that in one place, and one place only, using the value object pattern?
I also read the article, it’s front-end focused. To that point, I largely agree with the author, and it was a good read. However, we’re not talking about frontend, here - we’re talking about value objects on the backend. Perhaps I’m missing something, but let’s take the ID argument above - how would you handle that without a value object implementation in elixir?
IMHO, expecting a particular struct/value type solves the problem almost entirely. At the very least, when dealing with IDs from Ecto, you’ll never end up passing the wrong id to a function, say a relationship that expects that value.






















