I’m a bit stuck with where to put some method calls (separation of
responsibility) and although I’m trying to do it just simply now in the
models, I think my problem raises a bigger question about Fat Models.
that’s another subject for another day.
Right now, I have …
has an a invitation_expiry date field.
My problem is when an invitation is made, I want to check if the
has expired. I have thought of the following …
- include a method call in the Invitation model
Check if the meeting (event’s invitation) has expired (should it be
Should the invitation know anything about the Event class?
def meeting_expired? ## event_invitation_expired?
meeting.invitation_expired? ## meeting.event.invitation_expired?
- include an event_id foreign key in the invitations table so I can
the same method as in the Meeting model
I’m happy with either one but am open to other ideas or what you would
The BIGGER question is, what exactly should go in the models?!! We talk
about Fat models, but for me, that doesn’t fit nice with OO programming.
me, it’s quite clear that the we are not doing OO programming by
our models with everything related to that model. There needs to be
level of abstraction to keep everything clean and have the separation of
I’m a self taught OO programmer and I come from a functional programming
background, so maybe I’m talking out of my hat. But while writing tests
my app, to me, there are just too many code smells.
I look forward to your thought