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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:38:32+00:00 2026-05-15T09:38:32+00:00

If you have a chain of functions that operate on some data, is it

  • 0

If you have a chain of functions that operate on some data, is it better to have each function verify the data is valid before using it, or do that verification at the start of the chain and have every function in the chain just “trust” that it is valid?

  • 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-15T09:38:33+00:00Added an answer on May 15, 2026 at 9:38 am

    Depending on whether the lower functions on the chain are called by themselves will largely influence your decision. If you have a rigidly tiered system with certain classes only being called by other classes of your program, those inner classes can have much lighter data checking and “trust” the data.

    From “Code Complete 2” by Steve McConnell:

    “One way to barricade for defensive programming purposes is to designate certain interfaces as boundaries to ‘safe’ areas. Check data crossing the boundaries of a safe area for validity and respond sensibly if the data isn’t valid.

    The same approach can be used at the class level. The class’s public methods assume the data is unsafe…Once the data has been accepted by the class’s public methods, the class’s private methods can assume the data is safe.”

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

Sidebar

Related Questions

Javascript functions are objects and they have scope chain associated with them. If some
I have a callback function that I'm using to validate a submitted video URL
I have a function with a chain of filters in jQuery. I am trying
I have the following jQuery calls chain: $(someSelector).nextUntil(.specialClass).addClass(classBasedSomeSelectorObject) I need to addClass that's value
I have a few simple scripts that are intended to daisy chain together to
So I have the following XML chain: $xml->assessment->outcomes_processing->outcomes->decvar->attributes()->cutvalue XML example In Some XML-files $xml->assessment->outcomes_processing->outcomes->...
I have multiple animations that have to run as a chain. The way I've
Here is my scenario. I have a working login form that functions correctly. I
I have a JsTree that gets populated based on the JSON Data that I
I have a few functions that return a 1 if an error is encountered.

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.