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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:39:09+00:00 2026-06-15T11:39:09+00:00

For the most part, the library I’m developing is going to be consumed internally

  • 0

For the most part, the library I’m developing is going to be consumed internally by one or more projects. With that in mind, should I add logic that performs type checking on all parameters for functions I write, on some parameters or none? To do selective type checking, I feel, would create an inconsitent feel to the API, to do it for all parameters would bloat the code, and to do it for none could lead to error messages that aren’t helpful. Any guidance as to why or why not would be appreciated.

  • 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-06-15T11:39:11+00:00Added an answer on June 15, 2026 at 11:39 am

    First of all, it is important that you document your API, even if it’s only for internal use. It comes in handy if you need your code some years later.

    In this documentation you can tell the user what type the parameters should be. An often used tool for documentation is doxygen:

    /**
    * \brief Converts a string into a DummyObject
    * \param str should be a valid string
    */
    function str_to_dummy(str) {
    
    }
    
    /**
    * \brief Converts an object into a DummyObject
    * \param jsobj should be an object which contains at least
    *        the following attibutes: 'height','length', 'size'
    * \example json_to_dummy({'height': 12,'length': 15,'size': 11});
    */
    function json_to_dummy(jsobj) {
    
    }
    

    Keep in mind that the user will experience an error message either way, either:

    Parameter 'o' must be an object with attribute 'height'

    or

    ReferenceError: o.height is undefined

    While it is nice to get a more verbose error, it often isn’t necessary if you document your API correctly.

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

Sidebar

Related Questions

TortoiseSVN is nice for the most part, but one thing that blows in a
I have created a VB.NET 2008 Class Library that has, for the most part,
Robot is part of the AWT library, but it seems quite different from most
I have renamed a python class that is part of a library. I am
I have for the most part successfully embedded firefox/xulrunner into our c# application, but
For the most part, when I want to display some HTML code to be
I believe I understand properties for the most part. My question is, if I
I'm a C# developer for the most part. Back in college I had classes
I have mastered for the most part taking my designs and coding them as
I've integrated twitter4j into an android app and for the most part it works

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.