Where is the best place in an app to do validation? Rules of thumb?

I am making a C# app for a class project. I want to ensure a string has one of three values. Normally, in a web app, I would do validation with javascript on the client side. However, this is currently a console app. I know that I should do the validation early, but what are some good rules of thumb for validation?


Each module should do its own validation and never trust what the calling code gives it. This typically means that validation should happen at each layer of your application. You especially do not want to trust any validation to occurs on the client side, because that can lead to security holes. Code that runs on the client has been known to change from time to time.

Need Your Help

Why is this GLSL shader so slow?

performance glsl shader raytracing

I am trying to do a raytrace on a grid in a fragment shader. I have written the shader below to do this (vertex shader just draws a screenquad).

How to create a relative path to video in Middleman / Padrino?

ruby padrino middleman

I am using set :relative_links, true for my Middleman project. This works for image_tag and link_to, but how can I create a relative link to a static asset like a video in a /videos directory?