Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6382519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:31:57+00:00 2026-05-25T02:31:57+00:00

I am asking this for Ruby, but I guess this principle can be applied

  • 0

I am asking this for Ruby, but I guess this principle can be applied to every project with multiple files. Say I have a main file e.g. application that requires some other modules model1 and model2. Both those modules need the common module. I’ve seen many Ruby projects that would require common in application and not in model1 and model2. While this works if you always use application directly, if you require one of the modules from elsewhere, you get a NameError. So maybe this impacts the modularity of the project? Should I always prefer requiring explicitly all the dependencies from every file? (By not making any assumption about where the file is required from)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:31:58+00:00Added an answer on May 25, 2026 at 2:31 am

    I would always require all dependecies if a module is designed to be loaded from different applications. If model1is only an application specific element, you don’t need to load already loaded modules.

    But it would take a look, what’s really needed.
    Does model1 and model2 need common or does require the mainfile.rb? (I don’t think, that’s the case in your specific case) Sometimes you don’t need to load all requirements, if one of your requirements (let’s call it main-requirment) already loads the other (sub-)requirements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this is a naïve question, but let's say I have a Ruby
I am asking this because I use Python, but it could apply to other
As a Rails developer I feel a bit stupid asking this question but hopefully
This seems a ridiculously simple question to be asking, but what's the shortest/most idiomatic
This might be a silly question, but still I am going ahead and asking
After asking this question I was advised not to check in binaries into subversion.
I'm asking this question purely from a usability standpoint ! Should a website expand/stretch
I'm really asking this by proxy, another team at work has had a change
I'm not asking this question because of the merits of garbage collection first of
I am asking this out of a curiosity. Basically my question is when you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.