Stop writing utility classes.
@mcflyDev10 тыс. подписчиков
19 626 просмотров
11 комментариев
Комментарии из оригинального поста в X (Twitter)

@CFDevelop
I don’t write utility classes I write utility functions 👌
5 отметок «Нравится»

@pdfgptsupport
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.
13 783 отметки «Нравится»

@rodydavis
Probably a good use of extension types for Email to implement String and also still provide validate methods.
4 отметки «Нравится»

@francescovll
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()
4 отметки «Нравится»

@IdiomaticBytes
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. 🤔
3 отметки «Нравится»

@sidswipe
.isEmail
2 отметки «Нравится»

@yasfdany
Ohhh I like this
1 отметка «Нравится»

@mcflyDev
🤘🏻

@dev_azeez
Nice
1 отметка «Нравится»

@idiomaticdev
it's not an email until after it's validated. it's a wannabe
1 отметка «Нравится»

@PangzLab
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)
1 отметка «Нравится»