Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Interesting approach. It'd be a bit surprising in a Rails app, however, since models usually handle their own validation.

That said, the fact that GuestBookEntry doesn't have validation as a concern does make it simpler.

I might refactor to something like this if a particular model had extremely complicated validation logic, but wouldn't ever do this as a first pass.



I think in general models can handle their own validation (especially if you use AR), but I guess the difference is that these validations hit external "services", instead of like a :max_length validation.

I agree on the first pass comment - I imagine that the user stories went something like:

    * v1 - An anon user can post to the guestbook
    * v2 - Guestbook comments are checked for spam
    * v3 - Post guestbook comments to twitter for Web 2.0-ness
And this is the refactored version after v3




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: