Who is responsible for validating data
Geological Survey and U. Census Bureau collaborate on national roads and boundaries data It is a well-kept secret that the U. Source U. Using multiple SDKs from various vendors made the app too heavy and caused bugs, code conflicts and other issues. This flow requires app developers and media vendors to trust that the mobile measurement platform is doing a good job attributing installs generated by said media vendor. Or what if it is hacked and both the app developer — who is, in this case, the advertiser — and the media vendor are misled by reported conversions that never happened?
Taking the liability is risky. If you don't check it you at least have to handle the exceptions and react accordingly. The callee has the responsibility of checking that the data it receives is valid. Failure to perform this task will almost certainly result in unreliable software and exposes you to potential security issues. Having said that if you have control of the client caller code then you should also perform at least some validation there as well since it will result in a better over all experience.
As a general rule try to catch problems with data as early as possible, it results in far less trouble further down the line. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more.
Whose responsibility is it to check data validity? Ask Question. Asked 8 years, 4 months ago. Active 8 years, 4 months ago. Viewed 4k times. Improve this question. Geek Is your concern this kind of environment, or just code inside of a single application? See my comment regarding your thought below. This depends on the relationship.
Checking by the callee is optional. HotLicks: That's a good enough comment that if it were an answer, I'd upvote it.
Add a comment. Active Oldest Votes. Both consumer side client and provider side API validation. There are several levels of valid : All required fields present, correct formats.
This is what the client validates. Only the provider side can do 2 and 3. Improve this answer. I would say no, both are internal to the application. My answer would only change if the services were web-based and couldn't be certain about who their clients were. In that case, a web service should validate and bind incoming requests.
I can clearly see why 3 must be done server side, but 2 looks like it is doable client side. Obviously you also want to do it server side as well, but for user experience, can't you check such relationships before sending it across the network?
What am I missing? It's only doable on the client side within a single page. It can't know about message values that are set on other pages if it's a long-running sequence of pages, where the total message to be processed is built up as you navigate through the app.
If it's all on one page, then I agree. Not a good solution, but it's certainly possible. Show 1 more comment. For any client with IO overhead client should do basic validation as well Thihara Thihara 6, 2 2 gold badges 25 25 silver badges 54 54 bronze badges. I think this is the best answer; callee is in the best position to know what it needs and therefore whether the caller's passed parameters are "legal", and so it's usually the callee's job to do this.
However, the caller should check what it knows in cases where those checks are faster than simply letting the callee spit it back out, such as proxy calls — KeithS. Validation: Caller vs. The long version involves who, why, when, how, and what. Both Both should be ready to answer the question "can this data be operated on reliably? Called The called must validate the domain the set of inputs of the given context to which it will operate on.
Caller The caller is special. The caller has two situations in which it should validate data. When the data has no consistency checks, it is only safe to assume it is in an indeterminate state. That is not intermediate, but indeterminate. Know thyself. When you do not use a mechanism to validate internal consistency on state change, then the data is not reliable and that leads to problems in the second situation.
Do not make the call until you are ready. Year, DateTime. Month, DateTime. Add "ApartmentType", string. Validate model ; if errorsResult. AddModelError error. Key, error. Add model ; await db. Kategorie: Software Development.