David Newton wrote:Depends, but either way, it's going to be in a class: where it fits best depends on the rest of the app. As long as it's grouped in a way that makes sense given the rest of your architecture it doesn't really matter *where* it is. To me it sounds like part of a user service.
David Newton wrote:You know there's no one right answer to questions like this, right? "Good" is subjective and depends on opinions as well as good practices.
Would *I* creates classes like those? Most likely not, but I might have an "EmailUtils" or "EmailValidatonUtils" and a similar class for passwords. But it depends: I could easily see some email validation stuff being required throughout an application, for example to validate the email in a "email this story to a friend" scenario.
It's less likely I'd ever need to do password stuff anywhere else but in user registration/modification flows, though. I might, however, have a need to implement different levels of password security, though: normal users might be able to get away with eight characters and a single digit, whereas an administrative/system user might require stronger passwords--having this functionality injectable in some way would allow for different implementations to be used under different circumstances.
I still get the feeling you're trying to get everything perfect the first time around: this almost never, ever happens.
David Newton wrote:There are a lot of good ways to see things. There are innumerable ways to tie things together.
You're in a very early stage of learning how to do things--who cares if you have to throw everything away? (And you wouldn't anyway--even the worst pile is usually a matter of re-structuring rather than wholesale destruction.)
Stop over-analyzing. Go make some mistakes.
(And there are all sorts of resources that discuss OOD--not sure why you can't find any. But I wouldn't worry much yet, either.)
Debbie Dawson wrote:I care, because I'd like to get things done before I'm 50...
David Newton wrote:You'll learn faster by doing, and making mistakes.
But unless you get in the trenches and actually *do* something, *make* some mistakes, and *learn* from them, all the book knowledge in the world isn't helpful.
Good luck.
Often the most important part of the news is what they didn't tell.
I found some pretty shells, some sea glass and this lovely tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|