Wednesday, September 23, 2009

Why your recently bought software is crappy?

 
      You just cobble something together to sell, it may not be any good . As long as you can fool people into buying it, you can also make better versions later. So, then you get these version numbers ... even with decimals, version 2.6 or 2.7 . That nonsense ... while version 1 should have been the finished product.
(Edsger W. Dijkstra)


      Since Dijkstra made the cited comment above, programming languages and compilers reached new levels. They can prevent the programmers from doing mistakes by limiting their actions and by automatically generating critical parts of the code(memory management, hardware interference etc). Modern languages like C# or Java can be used with poor programing or mathematical knowledge with almost the same efficiency for most practical purposes.
But it seems that most software is still full of bugs or works slow even on powerful machines. If you are wondering how can this be, let's take a closer look at what is really happening.




                         Raj and the software industry
        
      It's 10:00 AM and the office is quite empty today. Raj is one of the few employees that came to work. It's not that he wasn't scared, but his behavior should make an example to all his team, so he took this as one of the ugly things that must sometimes be done in order to stay above the pile.
This time the bomb was 5 miles away from their “high security” software park. The bastards got bored waiting for the Starcraft 2 release and started blasting their own brothers in the real world. Isn't there someone to tell them “GG, you won, go home” or are we all waiting for the American Battlecruisers to arrive ?
His meditation on the subject is abruptly ended by the ringing phone. On the other side the American CEO is not happy, their clients seems to be complaining. They are talking about some promised feature that is not working and they must fix it in 2 days. But why they have to make such a big deal out of it ? ... fucking rednecks ...This couldn't come in a more inappropriate time, when half of the development team is not there and all it's members are new. Almost all the experienced programmers have quited in order to work in the US and they made the decision to hire only students or unskilled developers and train them on specific tasks. This may seem a bad decision since the salary for a experienced programmer is by a few degrees smaller than in a civilized part of the world, but greed is known as the main characteristic of the human nature and here it makes no exception.


 "Treason!" shouted his Majesty King Pest the First.
"Treason!" said the little man with the gout.
"Treason!" screamed the Arch Duchess Ana-Pest.
"Treason!" muttered the gentleman with his jaws tied up.
"Treason!" growled he of the coffin.

                                                   (King Pest -- Edgar Allan Poe)


      The deadline is quickly arriving and Raj knows there is no time to think about these decisions now. He gathers the whole team in a conference in order to solve the problem. Even if they are quite new, they know by now that this situation requires a lot of overtime. They are not computer scientists, their knowledge being limited at “For Dummies” series. Names like  Tanenbaum or Knuth are thought as the Christmas tree, or the name of a polar bear, so the only thing left to do is praying to the Google god for help.
 Raj is not a born leader, he became manager after 5 years of hard working as a programmer, almost at the same time he got his bachelor degree in computer science at the local university. But in this kind of business experience is more important and he manages to keep the situation under control by breaking the task in smaller parts and assigning one to every member (he sure doesn't need studies for this).
      After the lunch break the internet connection runs very slow, making everyone nervous. They blame the old servers , which may give new meaning to the word primitive, but after a quick inspection a torrent is found on one of the main servers. It was downloading some pirated movies.
      -A torrent !?!? Who started it ? Asks Raj hardly breathing. A more thorough investigation must be made.
 A few minutes passed and the responsible programmer is found. He receives a mail to come in one of the meeting rooms so Raj can force a certain amount of wisdom upon him.



Tuesday, September 8, 2009

A simple warm-up routine in set theory

     Since time usually flows only in one direction and this is my first post, I will tackle some aspects from the foundations of mathematics: set theory. Actually this post is trying to solve(hopefully is solving) an interesting problem that I found in The Art and Craft of Problem Solving by Paul Zeitz.

Putnam 1995:

Let S be a set of real numbers that is closed under multiplication(that is, if a and b are in S, then so is ab). Let T and U be disjoint subsets of S whose union is S. Given that the product of any three (not necessarily distinct) elements of T is in T and that the product of any three elements of U is in U, show that at least one of the two subsets T, U is closed under multiplication.

     You may want to consider trying to solve this yourself before reading any further. Also I have to mention that this is not it's standard proof, it is just a proof that I thought of, there may be other, similar or totally different, proofs. If you've found a different solution or you found a leach in mine please let me know.

      Solution:

 ∀ a, b, c in T we have abc ∈ T

∀ a', b', c' in U we have a'b'c' ∈ U

T ∪ U = S and T ∩ U = ∅

I'm going to use proof by contradiction to show that T or U is closed under multiplication.

So lets assume T and U are not closed under multiplication. This means that there exists two elements a, b in T such that ab is not in T. But if ab is not in T, then it must be in U because S is closed under multiplication.  The same goes for two elements a' and b' in U : their product is not in U because we supposed U is not closed under multiplication, so it must be in T. If we multiply all of them we get aba'b'  which must be an element of T since a, b, a'b' are three elements of T and their product must be in T. By the same reasoning aba'b' is an element of U since ab, a', b' are three elements of U.

So abba'b' is in  T ∩ U, but T ∩ U is empty and we reached a contradiction which means that the assumption that both T and U are not closed under multiplication is false.

     I have chosen this problem because despite it's simplicity it displays some important ideas:

-proof by contradiction

-symmetry

-reducing the problem by ignoring less important information(like the fact that the elements of S are real numbers)