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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:23:21+00:00 2026-05-11T09:23:21+00:00

I use Delphi, but this is a question that I think is valid for

  • 0

I use Delphi, but this is a question that I think is valid for any object-oriented programming language.

When should I use records over objects. I used to think that you used records when you had some simple definition of a set of related data that you wanted to store together that didn’t need to be able to manipulate itself. However every time I decided that a piece of data should be placed along with other data into a record, I came up with reasons for why it should be a fully blown object.

  1. There is almost always a reason that a piece of data needs some properties or methods.
  2. Memory management (creation and destruction) is much, much simpler with Objects (at least in Delphi).
  3. Using objects is probably no more expensive in terms of speed and memory but much much more flexible.

In fact I have recently come to the conclusion that possibly the only time you should use records over objects in modern applications is if you are reading a binary file from disk that can be read directly into an array of records.

I inherited a 10 year old project that uses records extensively over objects for small pieces of data, and I wonder is it just me or should these concepts be consigned to the recycle bin of experience.

Discuss.

  • 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. 2026-05-11T09:23:22+00:00Added an answer on May 11, 2026 at 9:23 am
    1. When there are no methods to act upon your data, it is useless most of the time. So you are right here.

    2. One of the biggest differences between objects and records is the fact that records are default on the stack and objects on the heap. To get a record on the heap, you get all the hassle you were referring to, but when you can leave them on the stack it’s a whole lot easier then managing objects lifetime. But lets face reality, there is little use for short lived records.

    3. When objects are instantiated, something more than merely reserving memory happens, there is a VMT to be managed, something a record hasn’t. So it a little more expensive to allocate objects than records, but I suppose it is neglectable when your not talking about thousends of items.

    To make your choice you need to consider how you will be using these objects or records. If you are going to read large binary files, records are the way to go (reading an entire buffer into an array of records maybe converting them to objects to work with). If you are handling structured data our runtime generated data objects seems to be a lot easier to work with.

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

Sidebar

Ask A Question

Stats

  • Questions 246k
  • Answers 246k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer using the explain command in mysql will give a lot… May 13, 2026 at 8:24 am
  • Editorial Team
    Editorial Team added an answer or you could use use regular function syntax function do_on_blur(){… May 13, 2026 at 8:24 am
  • Editorial Team
    Editorial Team added an answer Isolated storage is linked to the logged in user and… May 13, 2026 at 8:24 am

Related Questions

I am using Delphi, but this is a simple and general problem: I'm doing
Can it be known in general whether or not placing a case within a
My application is based on modal forms. Main form opens one form with ShowModal,
In Delphi 2009 I'm finding that any time I use TThread.CurrentThread in an application,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.