Tags for questions related to validating data.

learn more… | top users | synonyms

0
votes
1answer
60 views

Universal Form Handler

I'm building a API that gets called from web / mobile applications written using Ionic (web languages on mobile), which uses Angular.js. We want to be able to do server side validation of forms but ...
1
vote
1answer
66 views

Designing validation classes

This is a follow-up of this question. I decided to implement what the accepted answer suggests, however, I realized I also needed individual public methods for each member the entity to be validated ...
3
votes
2answers
146 views

Write unit tests for the libraries, or just the application?

Background I am fairly new to unit testing, and have been recently using the Visual Studio Test Manager to create my Unit Tests. The way that I have currently been doing things is as follows: ...
6
votes
2answers
208 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 ...
3
votes
4answers
243 views

In which layer should validation be located?

I'm creating a Rest API using Spring Boot and I am using Hibernate Validation to validate request inputs. But I also need other kinds of validation, for example when update data needs to checked, if ...
1
vote
1answer
51 views

Guidelines for returning None vs. raising Error for Python string-validating functions

Let's say we have a function that checks if a given pattern occurs in a string. The default behaviour is that if the pattern matches, then it returns the pattern. So far so good but what is the ...
4
votes
1answer
128 views

Writing a valid test case for validating XMLs

How would I write a unit test, say JUnit, for validating an XML file? I have an application that creates a document as an XML file. In order to validate this XML structure, do I need to create an XML ...
-1
votes
0answers
24 views

what to consider when validating a text area with jQuery?

I'm creating a contact form for my website and not sure what are the things I should check during validation for comment section other than empty text area. <div class="form-group note"> ...
1
vote
0answers
53 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 ...
1
vote
0answers
44 views

Is there any way to take advantage of portable ViewModels for ASP.Net?

Microsoft supports portability when taking advantage of the MVVM pattern: https://msdn.microsoft.com/en-us/library/hh563947(v=vs.110).aspx This means that I can create a ViewModel that is reusable in ...
0
votes
2answers
80 views

How can I test code that verifies data sanity?

I have a large data structure that gets read in from XML. I've been given a large list of constraints that should hold between data members. For example, one of the constraints might look like ...
40
votes
8answers
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 ...
0
votes
2answers
45 views

Handling delay in entry of OTP for log in validation

There's an application, which accepts a user id and password to login. Validation of the id and password is processed by another system. Now after password validation, the application generates a One ...
1
vote
3answers
153 views

How far should I validate user input in my own created API?

I got something here that bogs my mind a bit. Let's say I write me this API (in TS), check out some of these properties: export class MyAPI{ ...
3
votes
6answers
1k views

Domain Model, validation, and pushing errors to the model

Looking into DDD and something I noticed is that business logic should be in the model, otherwise you just have property bags. That said how do you handle pieces of validation that require a trip to ...
0
votes
0answers
30 views

Where should user input be validated? [duplicate]

I am working on a webbased user interface using AngularJS. As a database I am using MongoDB which can be accessed through an Python-eve-API. The API is able to validate the passed data as stated in ...
23
votes
4answers
3k views

Is client-side validation really all that important, always? [duplicate]

Through the years I've worked in web development it's been ingrained in me that client-side validation is absolutely and completely necessary in all web applications. Seems to me like all the people ...
9
votes
5answers
4k 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
2answers
87 views

How can a method handle validation and entity creation without output parameters?

I have 3 simple classes. A Reference, a Parent, and a Child. The Child knows the Reference and Parent instances it's associated with. Here they are, initialization and other data/methods omitted: ...
0
votes
0answers
24 views

Verify That Filters on a Dataset are Exclusive

Suppose I have a data table of, say, cars with a bunch of properties for each record. Example: |Vin|Year|Make|Model|Color|Mileage| I want to allow users to define (arbitrarily complex) filters which ...
3
votes
2answers
197 views

Should I add a layer to keep object always valid and immutable?

I am developing COM. A factory need to be initialized first by providing a ID. I can not pass arguments to IFactory instance via CoCreateInstance. So IFactory may need add a init method to be called ...
0
votes
1answer
42 views

Should formatter do validation?

Say I have a SSN field in a form. I want SSN to be in format of xxx-xx-xxx. I may just have a SSN formatter checking whether the input are all digits and adding dashes when necessary. Another ...
1
vote
0answers
83 views

ModelState Validation vs JQuery vs Remote

I was stuck with some validations for quite a while. I have been thoroughly searching the internet to find ways to apply the validations I require. I came across many methods for validations even ...
2
votes
2answers
281 views

Justifying programmatically ensuring frontend and backend validations are synchronised

Like many Javascript-based rich web apps these days, I have some complicated validation rules implemented on the front-end. The same rules are supposedly repeated exactly on the Java backend but I ...
24
votes
3answers
7k 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 { ...
3
votes
2answers
122 views

How do I prevent attackers from duplicating submissions?

I want to create a polling website. A client requests to answer the poll using POST, and the server responds with the candidates. The client then sends a POST with the candidate information and the ...
1
vote
1answer
72 views

Loading Aggregate Root from Database with Validations

Here is a similar question Where to validate domain model rules that depend on database content? I am asking this new question because I have more descriptions and I don't want to change the ...
2
votes
2answers
111 views

Why use a unique hashkey for form submissions?

I have multiple forms and use AJAX to submit them. I asked my boss if he needed any specific format for the form ID and he told me to generate a unique hash and keep it in session; check it whenever ...
1
vote
0answers
71 views

What's the right way to approach validations? [closed]

I'm a rails developer, and have noticed that while defining validations I find myself confused about the scope I'm trying to cover. For example, I have basic cases where a field of data (ex: name, ...
8
votes
2answers
2k 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 ...
0
votes
1answer
56 views

How to work with fail reason [duplicate]

Imagine that I have a method like User::validate($data), and mostly the developer expects only that is returns a boolean (true mean "ok, validated with success"). But, in some specific cases, he need ...
5
votes
2answers
212 views

Where should business logic go in a layered architecture?

First of all, i'm not talking about validation in the sense of the nullability or length of a field like in this and this questions where we can use isValid() methods in business classes or an ...
3
votes
3answers
2k views

Validating best practices, property vs dto, simple type vs object

Consider an application where adds an email address to his profile and submits it. We have some dispute in our team over how to validate this email address. Some developers (including me) believe ...
4
votes
3answers
776 views

Java & REST API: How do I check for duplicate before inserting record?

I am developing an application in Java to parse and upload records from a CSV to an online database, via a REST API. While I know for sure that there are no duplicate records in each CSV file, I ...
1
vote
1answer
144 views

Rails validation: Which method is preferred

In Ruby on Rails there are two ways to validate, for instance, the presence of input fields. Say I want to make sure the user has filled out my fields called value and name. I could put in my model ...
2
votes
0answers
166 views

What's the best pattern to validate a conditional entity? [duplicate]

I'm developing an ASP.NET MVC 5 website and I have a view with a grid. In this grid I have a column which represents an URL property. This url is a link to download some files, but this url should be ...
1
vote
3answers
1k views

How can I write complex validation and business logic that can be reused in both direct data model changes and pending dialog changes?

I was hoping for some advice: I need to design a software solution for a medium-sized java / Swing application. The application will have about 200 use cases requiring complex data validation and ...
2
votes
4answers
84 views

If I have a method that needs verification in order to proceed, do I call it inside the method or before? [duplicate]

This has been bothering me. This is more of a pragmatic problem than technical. Imagine I have a SaveOrderChanges method which, as its name implies, will save the order changes when the user submits ...
1
vote
1answer
106 views

File validation rules

I have an application that can accept CSV files to run some operations. The files look like: CREATE USER:username,last_name,first_name,age user1,Smith,John,23 user2,Poppins,Mary,257 There are a ...
1
vote
2answers
155 views

When writing a library or an API, when should and when shouldn't I validate or automatically correct errors in data provided by another developer?

I have a fairly good understanding of when data validation should and shouldn't exist when it comes when writing an application that is only dealt with by an end-user, and all the different tiers of ...
29
votes
7answers
4k views

Should I validate a method call's return value even if I know that the method can't return bad input?

I'm wondering if I should defend against a method call's return value by validating that they meet my expectations even if I know that the method I'm calling will meet such expectations. GIVEN User ...
4
votes
3answers
111 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 ...
1
vote
4answers
18k 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
2answers
488 views

Pattern for validating rules having different signatures

I have a class in charge of responding to an input event and maybe triggering another event. To decide, it has several rules to check. I'm trying to get away from a class looking like this: public ...
2
votes
1answer
94 views

Use of validators for simple validations

I've been working in Liferay code, and I've come across this construct a few times: List<?> list; ... if (Validator.isNotNull(list)) { //do stuff }} The source code for Validator.java ...
0
votes
1answer
264 views

Always set form input max length?

Background I'm looking to put together a single page web application with many form inputs. I've run into issues with other web pages where there is an ugly SQL error sent to the user if the ...
7
votes
2answers
598 views

What is best practice to handle whitespaces when letting the user edit the configuration, the name=value pairs?

For instance, you let the user define the notorious path variable. How do you interpret apppath = C:\Program Files\App? This looks like a programming language adopted practice to ignore the white ...
1
vote
0answers
113 views

How to consume inconsistent REST API with Mongo DB backend?

We are using a third party REST API and we are building one of the pages on our ASP.NET site around the data it delivers. We get results in JSON, and interact with it mostly using .NET MongoDB Driver. ...
1
vote
3answers
173 views

Coerce bad input or always crash early

The general consensus seems to favor the Crash Early approach, the most reputable source being the acclaimed Pragmatic Programmer book. And while I understand and agree with the advice in many ...
1
vote
2answers
448 views

Why all consider UAT a validation activity? It contradicts the original idea

Virtually any book dealing with software testing mentions that user acceptance testing (UAT) is an ultimate validation activity, often quoting Boehms informal definition: "Validation: Are building the ...