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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:41:07+00:00 2026-05-16T03:41:07+00:00

I quite often see the following naming convention used in java code. class SomeClass

  • 0

I quite often see the following naming convention used in java code.

class SomeClass {
    private final String name;

    public SomeClass(final String name) {
        this.name = name;
    }
}

This seems a little odd to me. First off if you happen to misspell the variable in the method signature it will still compile…

class SomeClass {
    private final String name;

    public SomeClass(final String nane) {
        this.name = name;
    }
}

Compiles fine. Possibly flags nane as unused variable but the assignment (which just becomes a self assignment) silently compiles.

I find myself wanting to use ‘m’ for member variables as such…

class SomeClass {
    private final String mName;

    public SomeClass(final String name) {
        mName = name;
    }
}

It is shorter than the .this variant and catches the odd misspelling error shown previously.

However a colleague of mine gave me all kinds of flack when I brought this up as a convention on our new project stating that “in java we don’t do that.”.

Just curious as to why?

  • 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-16T03:41:08+00:00Added an answer on May 16, 2026 at 3:41 am

    Personally I don’t like using prefixes – it makes the code harder to read, IMO. I believe different people read in different ways – I end up reading “aloud in my head” and the prefixes interrupt this process. Obviously you can get used to it, but I’d rather not have to.

    However, it would be a mistake to claim that no-one used prefixes like this. I’ve worked at various different companies using Java – some used prefixes, some didn’t.

    I’d also point out that most IDEs will give you a warning about a no-op assignment in your typo example. For example, in Eclipse I get:

    The assignment to variable name has no effect
    

    If you regularly ignore warnings, I’d say you have bigger problems 🙂

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

Sidebar

Related Questions

I quite often have rows of code like the following: UPDATE my_table SET name
I have a class (let's name it TheClass ) that is quite often used
I've see this sort of thing in Java code quite often... try { fileStream.close();
I see NSInteger is used quite often and the typedef for it on the
Quite often see in JavaScript libraries code like this: setTimeout(function() { ... }, 0);
Quite often I see source code where language's keyword are replaced with full type
Quite often I see people explicitly calling super() in a class that doesn't explicitly
Quite often in ANSI C code I can see parenthesis sorrounding a single return
It's quite often to see com.* package namespace. What does 'com' mean? Thanks.
It's quite often that we see two versions of an android app: a paid

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.