snoofle

After surviving 35 years, dozens of languages, hundreds of projects, thousands of meetings and millions of LOC, I now teach the basics to the computer-phobic

Jun 2013

Pot o' Gold

by in CodeSOD on

Since the first caveman first discovered the concept of this is more valuable than that, the science of alchemy has captured the imagination of many an enterprising soul. Unfortunately, to date, nobody has had any real success in transforming worthless metal into gold. That was, until the wonder that is PHP came along...

Generally, Brad M, doesn't care who wrote what bad code as long as it gets fixed. This little PHP snippet however, made him look up the responsible programmer on Linked In:


SQL Injection: What's That?

by in CodeSOD on

Jon C. was planning to outsource a very simple order tracking system. He interviewed many prospects, each more hopeful than the last. He viewed samples of the websites they had built, and picked the one he liked the best. Jon then commissioned the job for his order tracking system to a local developer.

Upon delivery, Jon discovered that the email notification function didn't work, so he glanced at the code to see if he could identify the problem. Before Jon got that far, he discovered this on the login page:


From Three Days to 15 Minutes

by in Feature Articles on

The Abstractor, as Greg and his team liked to call him, was a contractor at their company. The Abstractor had built a C# framework architecture (affectionately called Big Momma) that quickly went from being the company's framework, to being his personal baby. At the heart of Big Momma were abstract "Values" collections that wrapped the normal microsoft.net collections. This was so that any time The Abstractor decided that using arrays, XML or List<T> was bad, he could easily change "Values" to store data in some other data structure, and the code using it would be none-the-wiser. After all, enlightened developers use encapsulation, right?

While The Abstractor tended to stay away from any code that involved business logic due to his time being too valuable to be spent researching anything, he was eventually forced into creating a service that populated a database table for the new e-commerce website. The table would be used as a quick "real time" check for determining if a product was available at a location for in-store pickup. The records for each and every product needed to be updated every 30 minutes. Using Big Momma and armed with his "Values" collections, The Abstractor quickly had a solution in place. Unfortunately, it took 3 days to process 500,000 rows in the database - once. Greg was amazed that it could run that slowly. That was until Greg saw this error exception: