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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:21:54+00:00 2026-05-17T17:21:54+00:00

I was trying to make an API. I just wanna hide all details from

  • 0

I was trying to make an API. I just wanna hide all details from end programmer. I also want to provide them number of options to call a function.For example

I have 4 functions with same name but different signature (overloaded functions)

function1()
function1(arg1)
function1(arg1,arg2)
function1(arg1,arg2,arg3)

In above sequence 4th function ie function1(arg1,arg2,arg3) is having actual logic. rest functions are calling next function with some default values.

Now ,If a user calls 1st function in above sequence ie function1() then it is calling 2nd function ie function1(arg1) with some default values. and so on.

My question is, this sort of chaining is saving LOC(Line of Code) and increasing understanding. But whether it is good as per performance view?

Conditions with me

  1. I am using Java
  2. I am using JDK1.4. So variable number of arguments are supported.

Although you can suggest me performance in other languages as well, provided that you are not suggesting “variable number of arguments” feature.

  • 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-17T17:21:54+00:00Added an answer on May 17, 2026 at 5:21 pm

    Generally, calling a function will cause a memory jump, which regarding to performance is more costly than just running in sequence. When calling this just a couple of times, this is not a big issue, even with many levels of chaining. But if it is called within large loops, it could be noticeable performance issues.

    Note:
    To reduce the chaining to a minimum, you can call directly to the most detailed function (with all the parameters declared) from all the simplified functions.

    function1(){
      function1(null,null,null);
    }
    function1(arg1){
      function1(arg1,null,null);
    }
    function1(arg1,arg2){
      function1(arg1,arg2,null);
    }
    
    function1(arg1,arg2,arg3){
       // Actual logic here...
    }
    

    This way you only have one extra step.

    Note:
    The compiler might give you some advantages by optimizing the calls for you. It might even be that the compiler will replace the initial call to function1() with a call to function1(null,null,null) because this is all function1() does.

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

Sidebar

Related Questions

I'm trying to make an API for my rails application using JSON responses to
I'm trying to make Microsoft Translator API in my Java application. I registered in
I'm trying to make a RESTful API with rails. When I try http://localhost:3000/api/v1/projects.json?token=kS8xi7YzaUDEmbmi9XL6 I
I am trying to make a call to api which returns json object {
I'm trying to make this request to the RunKeeper API : GET /user HTTP/1.1
I'm trying to make an API library for our web services, and I'm wondering
i'm trying to make my own IAuthorizationFilter attribute class. Basically, each api call has
I'm trying to authenticate to the Flickr API for a demo application I want
GOOGLE MAPS API V3 is what i'm trying to use. I have all the
I'm trying to make Twitter's Bootstrap API (http://bootstrap.opalang.org/) work in Opa by trying some

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.