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

The Archive Base Latest Questions

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

I am writing a library, so, I want its functions to be named as

  • 0

I am writing a library, so, I want its functions to be named as clearly and cleverly as possible. Currently, I use the following principles:

  1. Self-explanatory names: a
    function getName() will tell the
    developer what it returns as well as
    setAddress(), isMale(), etc.
  2. Short: a function name must be as
    short as possible so that it’s
    simple to type as well as easy to
    remember. A function
    getNumberOfPagesInTheBook() is not
    good, something like
    getBookPageCount() is better.
  3. Use of prefixes: I always use
    prefixes in the functions such as
    getName(), setName(), hasHair(),
    isBlond(), etc.

I’m interested in knowing if there’s something I’m missing. Also, can you think of some other prefixes other than is, has, get and set?

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

    One of the more universal, yet simple rules is: Function names should be verbs if the function changes the state of the program, and nouns if they’re used to return a certain value.

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

Sidebar

Related Questions

I usually want to keep my code as generic as possible. I'm currently writing
I`m writing a web spider and want to use boost regex library instead of
I am writing a library which uses a few functions from the windows user32.dll
I found this open-source library that I want to use in my Java application.
I'm currently writing a little C# library to simplify implementing little physical simulations/experiments. The
I'm currently writing a script that processes batches of quicktimes, and its my first
I have been writing a library for my project (for now I am using
Ok I am writing a library that will be shard between unix and windows.
I'm writing a library for mobile devices. This library notifies the users when certain
I am writing a library that will provide a collection of public types to

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.