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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:18:53+00:00 2026-06-13T01:18:53+00:00

This is a general question about getters. Let’s assume I have a User class

  • 0

This is a general question about getters.

Let’s assume I have a User class with 2 native properties firstname and lastname and one dynamic computed property fullname.

What’s the best way of naming the getter for those?

I’m fine with:

user->get_firstname();
user->get_lastname();
// or
user->firstname;
user->lastname;

but I’m more concerned about:

user->get_fullname();
// or
user->fullname;

because we feel like it’s just another native property but it’s not. The fullname property can be read but not written, there’s no setter for it. We cannot manipulate it as if it’s a native property.

I would like to be able to make a difference between those properties (native vs computed dynamically), how should I do?

Examples from existing framework and how they deal with this is more than welcome.

  • 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-13T01:18:54+00:00Added an answer on June 13, 2026 at 1:18 am

    I would say it should be named the same as the other getters. Whether it’s a basic property or a calculated value comes down to implementaion specifics which I would want abstracted from the end user. Fullname might be a calculated value today but maybe in the future it won’t be. I want to have the freedom to change this in future in one place but keep the public interface the same.

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

Sidebar

Related Questions

this is a General Question about MVC .. I wrote a PHP Class that
This is a general question about writing web apps. I have an application that
I have a general question about this. When you have a gallery, sometimes people
I have general question about designated initializer. I have a some class and from
I have a general question about Hibernate that I'm batteling with. I have class
This is a general question about best practices. I have a JSP with a
I have a general question about data templates in WPF. Let's say I have
Yesterday I asked this general question about decimals and their internal precisions. Here is
This is a general question about MVC as a pattern, but in this case
This is a general question about character encoding when using MD5 libraries in various

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.