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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:45:48+00:00 2026-05-13T19:45:48+00:00

Suppose we have classes Gallery and Image. There can be many images in one

  • 0

Suppose we have classes Gallery and Image. There can be many images in one gallery.

Gallery should have some method which returns number of nested images. My suggestions:

int getImagesCount ();

int countImages ();

int imagesCount ();

I saw examples of each of these 3 suggestions in different APIs (of course with another noun or even without it, like method size () in Collections API).

What would you prefer and why? (One of my thoughts against countImages () is that this name can make user think that this method does some complex calculations.)

  • 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-13T19:45:48+00:00Added an answer on May 13, 2026 at 7:45 pm

    My suggestion:

    public interface Gallery {
    
        int getNumberOfImages();
    
        //...
    }
    

    I agree, that countXX() leads to the impression, that calling this method triggers some sort of calculation. So I wouldn’t use it here as well.

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

Sidebar

Related Questions

Suppose I have a class A which depends on 3 other classes X, Y
Suppose, I have a lot of classes, which are constructed using Java reflection (for
Suppose we have 2 classes, Child, and the class from which it inherits, Parent.
Suppose I have two classes (one a parent and one a subclass). How do
Suppose I have three classes. It is valid to instantiate A, but there are
Suppose I have the classes/models Projects (has many lists) Lists I want to allow
Suppose I have two classes. In the first one I declare this in Class1.h
I was wondering if someone could help me. Suppose I have some classes as
Suppose I have a List<IMyInterface> ... I have three classes which implement IMyInterface :
Suppose I have an existing assembly, and some of the classes have overloaded methods,

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.