Question about length of ActionDispatch::Routing::Mapper class file

44 views
Skip to first unread message

George Mendoza

unread,
Sep 8, 2015, 2:00:11 AM9/8/15
to Ruby on Rails: Talk
Hello Rails team,

I'm not sure whether to post this question here or in the Rails core list. Please redirect me to the right forum if applicable.

Our team lead and I recently discussed the pros and cons of breaking up a long source file into multiple source files. I tend to prefer one class per file, because I find the individual files easier to read and easier to find (with ctrl-p in Sublime). On the other hand, our team lead doesn't have issues with long source files. He argues that they are quite common in open-source projects. As an example, he pointed to the ActionDispatch::Routing::Mapper class in Rails as a case of a long file with multiple inline classes.

I'm curious to learn the intent behind keeping all the contents of Mapper class within a single file. What were the advantages of taking this approach?

Thanks,

George Mendoza
Philippines

botp

unread,
Sep 8, 2015, 2:28:37 AM9/8/15
to rubyonra...@googlegroups.com
On Tue, Sep 8, 2015 at 7:38 AM, George Mendoza <gsme...@gmail.com> wrote:
> Our team lead and I recently discussed the pros and cons of breaking up a
> long source file into multiple source files. I tend to prefer one class per
> file, because I find the individual files easier to read and easier to find
> (with ctrl-p in Sublime).

on my case, my reason is simple. i edit a single responsibility. easy
for my brain and easy for my tests.

> On the other hand, our team lead doesn't have
> issues with long source files. He argues that they are quite common in
> open-source projects. As an example, he pointed to the
> ActionDispatch::Routing::Mapper class in Rails as a case of a long file with
> multiple inline classes.


i dont buy that argument (it has no argument really); the rails source
is not a god : )

choose what you think is easy for you, why you think it's easy, then
justify, demonstrate it to the group.

kind regards
--botp

George Mendoza

unread,
Sep 16, 2015, 1:55:56 AM9/16/15
to Ruby on Rails: Talk
Hello,

Thanks for the reply. Definitely good to know :)

George
Reply all
Reply to author
Forward
0 new messages