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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:00:44+00:00 2026-05-18T07:00:44+00:00

I am looking for a good naming convention for methods (and variables to a

  • 0

I am looking for a good naming convention for methods (and variables to a lesser degree). Let’s say you have some factory class in a meta programming or reflection framework and the methods are related to java’s primitive types.

// dumb example
public class WrapperFactory {
    // create byte wrapper
    public MyWrapper byte(byte param) { ... }

    // create int wrapper
    public MyWrapper int(int param) { ... }
}

From a readability point, I’d like to have reasonably short method names. Unlike the example shown, method signatures for different types may be the same, so having just a create(…)-method with a bunch of overloads is impossible.

From the context of the methods (they are in a WrapperFactory after all) its clear that they will produce a Wrapper. So anything like byteWrapper() (or even more verbose createByteWrapper()) seems to be completely redundant.

Any suggestions for short and concise method names?


Edit: The general tendency seems to be that a method with overloads is most common, it would work for most of my factory methods, but there are currently four createXXXWrapper(…) with identical signatures that create wrappers of different behavior (but the same general type).
So to be consistent for all types, I currently favor the prefixXXX() naming suggestion. What prefix would be best (wrap is not one of my favorites, there are other factories which create different objects that are not functionally not wrappers). So I’d like to have generic prefix like newX(…), createX(…) or getX(…).

  • 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-18T07:00:45+00:00Added an answer on May 18, 2026 at 7:00 am

    In this case, I’d recommend wrapByte and wrapInt, or maybe just overloaded create methods.

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

Sidebar

Related Questions

Has anybody established a good naming convention for action in MVC? I was specifically
Are there any good articles on naming comprehensive naming conventions? I'm looking to clean
I've been looking for a good C/C++ GUI Toolkit for some time now, and
I have been googling for a while looking for good, flexible and easy to
Where can I find some good, proven guidelines or examples on writing extensible, modular,
I was wondering if anyone knows of some good community distributed custom DDL templates
The question is purely about the naming. Recently I was looking for a spinner
Im optimizing a Smarty template and things are looking good but the only thing
I need a good looking form for the home page to get users signed
I've just started looking at a project that has >20k unit tests written in

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.