Repetition often creeps into our views, and having a way to simplify them makes them easier to update. Enter Domain Specific Languages (DSL's); using a specific set of context-aware methods allows us to focus on the specifics of our domain. This becomes critical if our domain becomes large or complex. Even when this happens, we try to avoid having too many fields on any particular model. Sometimes, however, the simplest solution is to allow models to grow. At the same time it is important that your code remain manageable. In order to prevent our model's views from becoming unreadably large we're only going to display fields that aren't blank. We'll have to manage formatting requirements for dates and such, so our system needs to be flexible enough that we can customize the output. You'll probably have to be working with this code again at some point, so let's see how much better we can do. Eliminate verbose cluttered code so that your views are easy to work with.
- ← Previous
- Next →