Questions tagged [validation]
Tags for questions related to validating data.
36
questions
20
votes
4
answers
12k
views
Clean architecture validation in domain vs data persistence layer?
I'm studying up on clean and as a result am quite dramatically rethinking a great deal of how I design and write software.
I've thing I'm still wrestling with however, is for business rules like "on ...
30
votes
5
answers
10k
views
Data input validation - Where? How much? [closed]
Data input validation always was quite an internal struggle to me.
On the verge of adding a real security framework and code to our legacy application rewrite project (which so far pretty much keeps ...
53
votes
10
answers
33k
views
Should a method validate its parameters? [duplicate]
Say you are designing a Square root method sqrt. Do you prefer to validate the parameter passed is not a negative number or do you leave it up to the caller to make sure the param passed is valid. How ...
47
votes
4
answers
23k
views
Where we should put validation for domain model
I still looking best practice for domain model validation. Is that good to put the validation in constructor of domain model ? my domain model validation example as follows:
public class Order
{
...
10
votes
5
answers
10k
views
Do you use both Client-side and Server-side validation techniques?
Do you use both Client-side and Server-side validation techniques side by side when validating input from a user, e.g. via a contact form?
If so, is it really necessary? Are you over engineering?
2
votes
4
answers
723
views
JavaScript only validation on AJAX form submit
I've been mulling this question over for a few days in my head and I can't come to a solid answer.
We understand that client side validation for forms is not enough, because you can easily turn ...
39
votes
9
answers
44k
views
Constructor parameter validation in C# - Best practices
What is the best practice for constructor parameter validation?
Suppose a simple bit of C#:
public class MyClass
{
public MyClass(string text)
{
if (String.IsNullOrEmpty(text))
...
18
votes
9
answers
20k
views
When should pointers be checked for NULL in C?
Summary:
Should a function in C always check to make sure it is not dereferencing a NULL pointer? If not when is it appropriate to skip these checks?
Details:
I've been reading some books about ...
19
votes
2
answers
20k
views
Data validation: separated class or not?
When I have a lot of data that needs to be validated, should I create a new class for the sole purpose of validation or should I stick with in-method validation?
My particular example contemplates a ...
11
votes
2
answers
4k
views
Where to validate domain model rules that depend on database content?
I'm working on a system that allows Administrators to define Forms that contain Fields. The defined Forms are then used to enter data to the system. Sometimes the Forms are filled by a human via a GUI,...
6
votes
3
answers
5k
views
OOP: Behavior + Data, but what about 'validation' behaviors?
EDIT: Thanks for all the great answers! In reading these responses I realized that I'm approaching this from the wrong angle so I wrote a new question here.
I had this discussion with my superior ...
20
votes
9
answers
2k
views
Is an 'if password == XXXXXXX' enough for minimum security?
If I create a login for an app that has middle to low security risk (in other words, its not a banking app or anything), is it acceptable for me to verify a password entered by the user by just saying ...
44
votes
8
answers
4k
views
Should I throw an exception in case of a meaningful value outside of the range or handle it myself?
I have written a struct that represents latitude/longitude coordinates. Their values range from -180 to 180 for longtitudes and 90 to -90 for lattitudes.
If a user of that struct gives me a value ...
13
votes
3
answers
5k
views
Validation and authorization in layered architecture
I know you are thinking (or maybe yelling), "not another question asking where validation belongs in a layered architecture?!?" Well, yes, but hopefully this will be a little bit of a different take ...
10
votes
6
answers
4k
views
If the model is validating the data, shouldn't it throw exceptions on bad input?
Reading this SO question it seems that throwing exceptions for validating user input is frowned upon.
But who should validate this data? In my applications, all validations are done in the business ...
2
votes
5
answers
320
views
Verification of requirements question
Doing a lot of reading about V&V, I would need to clarify the following.
A lot of definitions (less formal ones found in books) define verification like that:
Verification: The software should ...
7
votes
8
answers
891
views
Do objects with validation logic in their domain really represent their real world counterparts?
I asked a question about whether validation behavior should be treated the same as other types of behavior in regard to the concept of OOP being "data + behavior". I got some good answers back that ...
1
vote
4
answers
630
views
Is it practical to have perfect validation score on HTML?
I was in a heated discussion the other day, about whether or not it's practical to have a perfect validation score on any HTML document. By practical I mean:
Does not take a ridiculous amount of time ...
108
votes
25
answers
36k
views
How far should one take e-mail address validation?
I'm wondering how far people should take the validation of e-mail address. My field is primarily web-development, but this applies anywhere.
I've seen a few approaches:
simply checking if there is ...
19
votes
4
answers
7k
views
Managing client-side and server-side validations in one place
I'm 100% on board with the case that one should definitely use both client-side and server-side data validations.
However, in the frameworks and environments I've worked in, the approaches I've seen ...
13
votes
6
answers
13k
views
How should I handle invalid user input?
I have been thinking about this issue for a while and I would be curious to have opinions from other developers.
I tend to have a very defensive style of programming. My typical block or method looks ...
11
votes
2
answers
6k
views
Has anyone successfully used Windows Workflow for a Business Rules/Validation engine?
I was wondering if anyone has successfully used Windows Workflow Foundation for a BusinessRules/Validation engine, or if you know of some sample code or articles about this.
If you have used it ...
12
votes
4
answers
1k
views
How defensive should we be?
We've been running Pex over some code, and it has been showing some good things (well bad things, but showing them before it gets to production!).
However, one of the nice things about Pex is that it ...
10
votes
2
answers
23k
views
Name validation best practices
I have a form and I was wondering about best practices when validating names (specifically throwing out characters which do not typically make up a name e.g. 123%^*$£ though theoretically could) and ...
8
votes
2
answers
887
views
How come verification does not include actual testing?
Having read a lot about this topic --- such as on this Software Testing Fundamentals site on verification and validation and Software Testing and Quality Assurance: Theory and Practice by Naik and ...
6
votes
2
answers
2k
views
Is server validation necessary with client-side validators?
I recently created a .net web app that used over 200 custom validators on one page. I wrote code for both ClientValidationFunction and OnServerValidate which results in a ton of repetitive code.
My ...
4
votes
2
answers
4k
views
What is the best practice for method parameter validation in a library? [closed]
I develop a game library in javascript, containing many classes. I hesitate on the behavior that I should follow concerning method parameter validation:
Should I check the validity of parameters ...
2
votes
4
answers
35k
views
How to apply verification and validation on the following example
I have been following verification and validation questions here with my colleagues, yet we are unable to see the slight differences, probably caused by language barrier in technical English.
An ...
1
vote
3
answers
1k
views
Best practice in synchronized form data validations (Web apps - Client-Server)
Here we go again with topic what was asked many times all over internet, but I not found any good enough answer:
What are best practices in making client and server side validations synced?
I was ...
5
votes
3
answers
2k
views
How to report multiple errors as a result of validation?
I have a class that transforms a complex model, for example an abstract syntax tree or intermediate model. The model can be either valid, invalid or partially invalid, i.e. it contains errors but some ...
4
votes
3
answers
156
views
How do I model this relationship so that it is valid by construction?
Imagine a device class that represents a physical real world mobile device, with fields like Enabled, Platform, Model IMEI, etc. Then, an operation class, which is something that needs to be done to a ...
4
votes
2
answers
262
views
When and how much should we validate input when working with (C)AP storage?
Herein, we consider a server-client architecture. Suppose we keep the details flexible, but there's more than one layer of servers supporting our hypothetical service. The general question is "When ...
3
votes
2
answers
916
views
Functional testing in the verification
Yesterday my question How come verification does not include actual testing? created a lot of controversy, yet did not reveal the answer for related and very important question: does black box ...
2
votes
3
answers
204
views
Does it make sense to validate data taken from the database?
This is intended to be a general language-agnostic question. It is written around a weird example simply because I could not find a better way to ask. Also, the "pseudocodes" provided look like a ...
1
vote
3
answers
1k
views
Where to validate user input - Constructor, Validation object, or Factory method?
Let's say your application takes in a user request and you don't trust the front-end validation (because you never trust the front-end validation). In your controller or other handler, you want to ...
1
vote
2
answers
2k
views
Class structure/pattern for validating several different Excel templates?
I'm trying to validate the contents of Excel sheets that follow several different templates. For each one, there are three possible validation actions for various cells:
Regex (e.g. "XYZ-123" fails ...