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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:09:55+00:00 2026-06-01T17:09:55+00:00

Suppose a have a controller (let’s call it main) and an associated model which

  • 0

Suppose a have a controller (let’s call it “main”) and an associated model which performs a bunch (10) of functions.

i’m wondering about the associated overhead in loading a 2nd model to do one function that doesn’t exist in the main model vs. just adding that function (duplicating the code) in the main model.

The pros in loading that 2nd model are less code/easier to maintain.

The cons are overhead of loading a 2nd model.

Are my fears of overhead valid? I’m a non CS person and just wondering what’s the best practice here.

thanks,
tim

  • 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-06-01T17:09:56+00:00Added an answer on June 1, 2026 at 5:09 pm

    Don’t Repeat Yourself. If you do you will only make your life a lot harder than it should have been when it comes to maintaining your code down the line. The principles of good OOP encourage you to create classes with a specific area of responsibility, and using that class to handle the situations it was built for. Duplicating functionality in class X into class Y violates this principle. If class Y needs to do something class X does, then this means that either class Y needs to talk to an instance of class X, or class Y should inherit from class X.

    It would also be a micro-optimization at best. The performance hit for loading the other class should be negligible, certainly nothing worth worrying about.

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

Sidebar

Related Questions

I have issues understanding scopes in javascript.Let's suppose i have the following code: Ext.define('MA.controller.user',{
Suppose you have the following controller action [HttpPost] public ActionResult Save( CustomerModel model )
Let's suppose I have a model with only two fields: name and street name
Let's suppose I have an interface named Controller. Several classes implement this interface and
Suppose, I have a controller named category with an action method, Index which takes
Suppose I have an events controller. If I request /events by GET it will
Suppose I have a list, in which no new nodes are added or deleted.
Suppose I have a method which changes the state of an object, and fires
Let's suppose that we have poor MVC framework without modules support. Our aim is
OK so I have two entities in my data model (let's say entityA and

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.