mastaBlasta
Gawd
- Joined
- Jan 27, 2011
- Messages
- 605
-Also posted this on Ruby Forum
I'm working with Ruby on Rails, but any MVC framework i'm sure encounters this issue.
In our application we have a number controller actions that have gotten
very long and difficult to maintain. Usually #create and #update. A huge
reason for this is that the objects handled by the controllers have a
bucketload of associations that must be handled according to a complex
set of business requirements.
In short things have gotten complicated and I'm looking for a way to
break up the code in more manageable chunks. I know this is an endeavor
as old as programming itself, but I hope people can share some of their
experiences.
The code i'm dealing with in particular has a lot of error checking. If
this & this then fail. If this but not that then fail, and so forth. Of
course every conditional has various error messages that must be sent
back to client and else clauses and blah blah.
It would be interesting to have some kind of callback system, that
monitors different stages of the #create workflow for example, and when
an error is encountered it bombs out, finds the correct message to
display and returns to view.
I'm working with Ruby on Rails, but any MVC framework i'm sure encounters this issue.
In our application we have a number controller actions that have gotten
very long and difficult to maintain. Usually #create and #update. A huge
reason for this is that the objects handled by the controllers have a
bucketload of associations that must be handled according to a complex
set of business requirements.
In short things have gotten complicated and I'm looking for a way to
break up the code in more manageable chunks. I know this is an endeavor
as old as programming itself, but I hope people can share some of their
experiences.
The code i'm dealing with in particular has a lot of error checking. If
this & this then fail. If this but not that then fail, and so forth. Of
course every conditional has various error messages that must be sent
back to client and else clauses and blah blah.
It would be interesting to have some kind of callback system, that
monitors different stages of the #create workflow for example, and when
an error is encountered it bombs out, finds the correct message to
display and returns to view.