Do you all have this problem? Or is this something that only newbies suffer from? Is there an effective design pattern that helps you code without confusion?
Ask HN: How do you mentally manage all the Ruby on Rails code?
1–6 of 6 posts
Re: Ask HN: How do you mentally manage all the Ruby on Rails code?
#2Re: Ask HN: How do you mentally manage all the Ruby on Rails code?
#3I didn't find your issue to be something that confused me. There seems to be a lot out there about fat models, skinny views/controller, but it sounds like you should really just ingrain MVC as it pertains to rails in your brain. Rails guides are your best friend here. MVC in effect is the effective design pattern your looking for.
My two cents from a fellow rails beginner. Oh, and check out my app at http://www.uhpartments.com
Re: Ask HN: How do you mentally manage all the Ruby on Rails code?
#4I may typically go from a cucumber feature, to step definitions, to the config/routes.rb file to a controller spec, then a controller, then a model spec, then a model, then a view, and cycle through that a few times. The cucumber features help to maintain the mental model of the highest level of what I'm doing then the lowest level might be the implementation of a method in the model.
Each step you're going from the business requirements end right through the full stack of the application until you're at the lowest level of logic. And what you should be focusing on is guided by failing tests and making them pass. E.g. to pass the feature you need a certain action for a controller which then needs a certain method on a model.
Re: Ask HN: How do you mentally manage all the Ruby on Rails code?
#5Whenever I write code I first of all put down all the logic in pseudocode in comments.
Then I write the actual code underneath the logic comments.
Works for me.
Re: Ask HN: How do you mentally manage all the Ruby on Rails code?
#6Coming to Ruby from scratch though, wow, I can imagine it being pretty intimidating. Having good tools (i.e. your editor) helps.