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 7060781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:23:38+00:00 2026-05-28T04:23:38+00:00

Just a quick question: In an OOP MVC application, one key principle is the

  • 0

Just a quick question: In an OOP MVC application, one key principle is the seperation of responsibilities. I therefor think that a model and the object that fetches the model from a database, file, xml, webservice, etc. should be seperated from the model itself. This can for example be done by implementing a datamapper.

However, what do I do when I have a model that can be loaded from different sources? Should the model be in charge of the datasource, or is this the responsibility of the controller?

An simple example could be a config class that can be loaded from a database or a file. Should the controller instruct the datasource, or should the model know when to load the config info from a database or a file?

  • 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-28T04:23:38+00:00Added an answer on May 28, 2026 at 4:23 am

    have used frameworks were the datasource is informed by the controller MachII, Model-Glue (Coldfusion frameworks) and also from the model layer (ColdSpring) – like Spring in Java.

    I think the key thing is to use what makes more sense to you, keep the coupling to a minimum and be consistent, meaning don’t put datasource or object dependencies in multiple places.

    You could also consider using a service type object to abstract the datasource and have it serve either who it likes.

    That IOC file could look like this:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <beans>
    
      <bean id="chartShareObj" class="model.charts.ChartShared" autowire="byType" />
      <bean id="trendChartObj" class="model.charts.TrendChart" autowire="byType" />
    
      <bean id="adminRightsDA0" class="org.datamentor.institution.RightsDAO">
        <constructor-arg name="dsn">
          <value>${dsn_dm}</value>
        </constructor-arg>
      </bean>
    
      <bean id="assessmentManager" class="model.assessment.Manager">
        <constructor-arg name="dsn">
          <value>${dsn_au}</value>
        </constructor-arg>
      </bean>
    
    </beans>
    

    You can see the different datasources specified by args via args defined in a controller.

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

Sidebar

Related Questions

Just a quick question about best practice in MVC development. Let's say that I've
Just a quick question. I'm making a web application where C++ communicates with a
Just a quick question: I'm working on revamping a script that serves vehicle inventory
New to OOP with Perl, and just had a quick question. I have this
Just a quick question (hopefully). I want to slide one div in front of
Just a quick question. I understand that Singleton patterns can be extended and that
Hey all, just a quick question (should be an easy fix I think). In
Just a quick question. I have an NSArray that is generated in my applicationDidFinishLaunching
Just a quick question, that I cannot fathom out, hope you guys and girls
just a quick question. First of all, let me verify that I have the

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.