Statically typed vs dynamically typed - How to get 90% discount.

There are a lot of pros and cons of diffrent typing, yet on the one hand static typing wins - security. Yes both can be more or less secure buy static typing tells you a lot about your code and prevents from bugs, certain types of bugs. Do you want to buy a new flashy notebook with 90% discount? Everybody does :)

  1. find a victim. Website with on-line shop.
  2. Pick your laptop and start the order
  3. In this process fill out the amount textbox with value '.1' (dot and one)

Since most of the systems calculate the final value of bill :

ValueOfOneLaptop x AmountOfLaptops = TotalAmount

If there is no valiadtion upon floating point TotalAmout will be 10% of a laptop's value. How? .1 stands for 0.1 and therefore  0.1 gives you 90% discount :). Most likely shop engine is wirtten in PHP or Python so you have a lot of chance to get it pass through. A shop employee validates the order  and will not spot the little dot.

Brilliant isn't it?

Web Devs need to bare in mind this.

Static vs Dynamic 1:0.

Written on November 27, 2010