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

  • Home
  • SEARCH
  • 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 978103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:00:34+00:00 2026-05-16T04:00:34+00:00

Imagine I am using a class to bring back items from a database, say

  • 0

Imagine I am using a class to bring back items from a database, say

class BankRecord {

public int id;
public int balance;

public void GetOverdraft() {
...
}
public void MakeBankrupt(){
...
}

}

Now, what would happen to the performance of using this if there were just 2 methods (as above) or 100 methods, maybe some of them very large.

Would instancing hundreds of these objects be worse if all the methods were on each object? This is for c#/java type languages, but it would be good to know for all languages.

Or is it good practice to have a seperate class, to perform all the actions on these objects, and leave the object as a pure data class?

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

    The runtime does not duplicate the code when creating an instance of a object. Only the member fields are allocated space in memory when an instance is created. For this reason, you shouldn’t be creating “data-only” classes unless you have some other design reason for doing so.

    That being said, there are other best-practices reasons why you might not want a class with a multitude of methods (e.g. the God object anti-pattern).

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

Sidebar

Related Questions

Using the Newtonsoft.Json library, imagine I have got public class Test { public Object
Imagine you are developing a Java EE app using Hibernate and JBoss. You have
I'm using Rails' asset pipeline to concatenate all my CSS/JS (although I imagine the
I am using Entity Framework and DevExpress 10.5 XtraGrid. Imagine that we have entities
imagine this html on a page <div id=hpl_content_wrap> <p class=foobar>this is one word and
Imagine the following template class (setter and getter for the member _t omitted): template<class
I'm using the Netty library (version 4 from GitHub). It works great in Scala,
I'm building an ASP.Net website. I have a cart class which stores the items
I'm using Spring 3 and want to inject some dependencies into a class that
I am using a Pagination class that I found on Codecanyon that works wonders

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.