There are a couple of good examples here! One thing that I donโt like about the enum is that it mixes two concerns:
Authentication Result (Success, Failure), there are really only those two
User State, might even allow more than one (FirstLogin, LockedOut) etc
I would probably use a type like a tuple that returns something like
{Success, [FirstTime]}
{Failure, [LockedOut]}
Just a quick scratch, but you might the idea.
I'm personally not a fan of this specific term (whereas I like the other conventions you've forgone ๐ฅ๐) because the term is judgy and opinionated.
โI microblog about my daily life in the IT department as a lateral entrant/student.โ
Jr. Front-End Developer | Computer Science student @digideation in Lucerne
hehe, I am a swift/iOS developer by preference, (web) fullstack developer by trade. Iโve spent a long time wishing j/typescript had a pretty way of doing guard statements, and widely adopted.
We're a place where coders share, stay up-to-date and grow their careers.
There are a couple of good examples here! One thing that I donโt like about the enum is that it mixes two concerns:
I would probably use a type like a tuple that returns something like
{Success, [FirstTime]}
{Failure, [LockedOut]}
Just a quick scratch, but you might the idea.
The canonical term you'll find in other documents including research papers is Primitive Obsession.
Smells usually don't tell us that something is wrong, but only indicate their might be something stinky. Overuse sounds very emotive to me.
Great article idea
Yes, I wanted the book to be a bit more approachable and less academic-like, so I took some liberties with the official terms for most code smells.
Thanks!
Ah. That makes sense to me!
I'm personally not a fan of this specific term (whereas I like the other conventions you've forgone ๐ฅ๐) because the term is judgy and opinionated.
Keep writing ๐ป
Any reason we wouldn't use switch/case with the strategy pattern?
You can. If there many different cases then I just find this technique cleaner.
Great post
Thanks Ben.
Hm... cool patterns! And thanks for sharing parts of your book for free. Definitely buying it ๐
Awesome!
As a student this is helpful because we donโt practice enough hands-on to develop smarter codings. Thanks for sharing!
hehe, I am a swift/iOS developer by preference, (web) fullstack developer by trade. Iโve spent a long time wishing j/typescript had a pretty way of doing guard statements, and widely adopted.