Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

Stop writing utility classes. Utility classes are a sign that you are writing procedural code. You should avoid them. Instead, write a real object model. For example, an email is not a String... It's an Email. Gautier - 🤘

19,509 Aufrufe • vor 1 Jahr •via X (Twitter)

11 Kommentare

Profilbild von Christian Findlay
Christian Findlayvor 1 Jahr

I don’t write utility classes I write utility functions 👌

Profilbild von PDF GPT
PDF GPTvor 2 Jahren

Everyone is getting ahead with AI. You should be too. Summarize documents, craft emails, and generate custom content instantly with this powerful tool. It's like having ChatGPT tailored for your job. Try it for free.

Profilbild von Rody Davis
Rody Davisvor 1 Jahr

Probably a good use of extension types for Email to implement String and also still provide validate methods.

Profilbild von Francesco Vallone
Francesco Vallonevor 1 Jahr

In my opinion another approach is to use a validation library like Acanthis that will still remove the need for a utility class, while providing validation and parsing of the object. Everything is just a line of code string().email()

Profilbild von Cillian Myles
Cillian Mylesvor 1 Jahr

You didn’t give a concrete reason why your approach is better? Same validation everywhere? I don’t think that’s guaranteed any more than that a user imports the same util class everywhere. 🤔

Profilbild von Nnaemeka Sidney
Nnaemeka Sidneyvor 1 Jahr

.isEmail

Profilbild von Dany | Mobile & Game Dev 🍉
Dany | Mobile & Game Dev 🍉vor 1 Jahr

Ohhh I like this

Profilbild von Gautier 💙
Gautier 💙vor 1 Jahr

🤘🏻

Profilbild von AbdulAzeez
AbdulAzeezvor 1 Jahr

Nice

Profilbild von jayson.kt
jayson.ktvor 1 Jahr

it's not an email until after it's validated. it's a wannabe

Profilbild von Pangz (pangz.vrsc@)
Pangz (pangz.vrsc@)vor 1 Jahr

It doesn't add any value modeling the email as a different class instead of just leaving it by default as a string. You're using unnecessary resources just to wrap a simple string to a class just to make it appear as an object. You only need to validate it and that's it.(just my 2 cents)

Ähnliche Videos