Finding view logic in your application

by Julian Simpson on April 8, 2009

We all know that mixing business logic and presentation is just plain wrong. If you don’t believe me, go have a look at a classic ASP or JSP application of yesteryear. So the prevailing opinion is that we should seek to move business logic into the back end – in MVC applications, the controller (mmm – not always ideal) or the model (perfect).

My colleague Alan and I were discussing this issue – in particular how metric_fu doesn’t inspect our view logic. We have a solution. Here’s the alpha version of our new tool, metric_view_fu. It finds logic buried in HAML view code.

egrep -cir '\- if|\- else|\- while' app/views/* | sort -n -k 2 -t ':'

I think there’s room for improvement.


Share with the group:
  • Digg
  • del.icio.us
  • Facebook
  • DZone
  • LinkedIn
  • Slashdot
  • StumbleUpon

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

blog comments powered by Disqus

Previous post: The quest for a decent Ruby Continuous Integration tool

Next post: Every Continuous Integration server that supports Ruby + Git