pablobm left a comment (openstreetmap/openstreetmap-website#6549)
That's fair, I wonder about that sometimes. This specific example is very
simple and could have been done with modules and functions.
I stick to this practice because, when things grow a bit, I end up wanting a
bit more. To hold a bit more of state, or to have the ability to inject options
or a dependency for a test or reuse. Things like that, which are a bit easier
with classes, avoiding a method with too many arguments. Also Ruby does nudge
you in the direction of using classes and I let myself be nudged.
By the way, I'm realising that there's something I normally do that I didn't do
here: I like putting all this stuff in `app/models/`! I'm of the opinion that
`lib/` should be used sparingly and all business logic should go in
`app/models/`. But I can live with this for now.
(I'm also of the opinion that all ORM classes should be confined to a separate
`app/records/` with names like `UserRecord`, `NodeRecord`, etc, but I won't go
that far here, and it's not conventional anyway).
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6549#issuecomment-3588854637
You are receiving this because you are subscribed to this thread.
Message ID:
<openstreetmap/openstreetmap-website/pull/6549/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev