I recently read a discussion on validation of user inputs. The example used was of validating the Date of Birth a.k.a DOB field. The programmer was adventurous and wanted to put validation such as
- If DOB is more than 120 years ago, message: “You cannot be that old!!!”
- If DOB is in the future, message: “You must be kidding, you are not born yet!!!”
His basic question was on how far would you go in validating a user input?
My view is to put minimum validation at the field level. For this example the developer can check whether it is valid date or not but that’s it!!
One can always put all the necessary validation at the form level. By doing this, most of the business logic is at one place & not divided across various fields.
Also, avoid showing ugly error messages while the user is typing. If the validation is to be done at the field level then provide hints / suggestions to the user by showing text next to his input.
We always want correct and valid data in our databases but at the same time we should not act like a policeman slapping the user for every mistake he/she makes.
So, in your next project, how far would you go in validating user inputs?
Uno is a popular card game and I assume most of you would have played it at some point in your life. I too have this at home & have enjoyed playing it several times.
Few years back, I came across a new Uno game which is called Uno Spin.
This game caught my attention. I started thinking on how to create this game at home. I already had the game cards with me & the only thing missing was the spin part of it.
I used Excel as a tool to develop the spin logic. Actually it turned out to be quite easy. Basically, we just need a random function [like RAND() or RANDBETWEEN()] to randomly choose out of 9 valid options and display it on the screen. I also, added couple of buttons for better UI. Here is the screen shot.
We played several games & had great fun. I also, created a mobile version of the file which can be played from Mobile QuickOffice application. You can download the source files by clicking on the following links
So, have you developed any games in Excel??
Last week I saw a movie, 3 Idiots which I enjoyed a lot. In the movie, it is shown that the college students have affectionately named their dictatorial Professor Viru Sahastrabudhhe as Virus. This got me thinking into the title of my next blog post.
No, this blog is not about student and professor relationship. I am writing on actual computer virus. So, what is a Computer Virus? There are various definition available on the net but what I mean to ask is that has anybody seen a source code of a computer virus? No? OK… here it is…
This is the real source code of a virus. If you do not believe me then copy / paste the code in a text file and save it as a .com file on your PC… on second thoughts, please do not do it. Alarm bells will start ringing and your manager will catch my neck. 😉
These kinds of Virus source codes are published to provide a standardized process for testing anti-virus programs across different vendors. Basically, this virus does not harm your PC but is just flagged by the anti-virus program. If it does NOT then your anti-virus program is not so good and it is time for an upgrade!