Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Great post. I do a lot of these same things whenever I join a new app or am evaluating a project to take on. There's definitely some doozies of Rails apps out there.

I also like to pry open the ApplicationController pretty quickly. You'll usually find all sorts of interesting logic and tight coupling in there.

In the example app you used, the models actually look pretty light on lines of code. I'm willing to bet the Views were full of conditionals, which is another thing I keep an eye out for.

A search tool like ack or grep are also incredibly useful to follow a trail of any interesting scent you might pick up.



>>In the example app you used, the models actually look pretty light on lines of code. I'm willing to bet the Views were full of conditionals, which is another thing I keep an eye out for.

I'm a Rails newbie so please excuse my ignorance... What is the connection between models being light on code and views being full of conditionals? What I assume you mean is that your models should also have view logic so that your templates aren't full of if-then statements. But isn't that what decorators are for?


No, the models shouldn't have view logic such as formatting, that belongs in Presenters. What I was implying is that the views likely have boolean logic/conditionals that are checking various states of the model and then rendering partials/HTML content based on that.

Of course, there could also be model logic in the controllers and helpers as well.


Most of the code was from a personal project, so the reason the models were light is because they weren't a 1:1 representation of the database.

I try to practice good OOP and stay with Sandi Metz' rules: http://robots.thoughtbot.com/sandi-metz-rules-for-developers


Well, you sure fooled me. I guess I didn't ask if you had app/services|presenters|etc directories. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: