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

Jan 2014

But the Tests Prove it Works Correctly!

by in CodeSOD on

I. G. wrote about an incident that caused him to nearly give himself a concussion from a *headdesk* moment. A newly developed system was meticulously designed, coded and tested to obscene levels; all appeared well.

Unfortunately, upon deployment, it began acting erratically, returning incorrect results from numerous database queries. After many debugging sessions and code walkthroughs, it was discovered that the developers had used the following pattern for all the database DAO tests:


The Temporal Countdown Timer

by in CodeSOD on

Most modern languages have the concept of letting your code sleep for a specified period of time. This is useful when you want to perform a particular task at some point down the road. It's usually implemented such that your program requests to yield control for a certain number of milliseconds. The OS will usually guarantee that your code will remain in blissful slumber for at least that amount of time, plus whatever random delay is imposed by multitasking and OS overhead.

Some folks use sleep intervals to allow for periodic updating of some tally, or perhaps a clock. Of course, smart programmers check the actual time after being awakened so as not to allow the difference between requested and actual sleep time to skew things.


Security by Password

by in Feature Articles on

ISP's typically provide you a network login and password, and perhaps another pair for accessing the account management pages. After all, protecting access to your account, and potentially your data was, is and always should be important.

Phum S. patronized an ISP that took that security to the next level.


Throttling Throughput

by in CodeSOD on

The folks at Big Corp Inc. like to do things in very formal ways. All code is officially peer reviewed. Important code for key aspects of the system is reviewed by a manager. Only blessed tools may be used. The environment is to be pristine - regardless of cost. Following the rules takes precedence over efficiency.

David R. reported that in one particular system, the data was coming in way too fast. The message consumer was spawning a background thread for each inbound message. As volume rose, the number of threads that got spawned exceeded the capacity of the system, and NullPointerExceptions got thrown around like siding in a hurricane. The Master Architect decided that this problem was so important that he would fix it himself. Of course, since he was the apex predator, nobody would (could) review his code:


Web Services...The COBOL Way

by in Feature Articles on

In the beginning, you had to meticulously write out your assembly language computer program - instruction by instruction - and then flip switches to enter it into the computer. Fast forward a few years and FORTRAN made its entrance. It was highly useful, but not for business applications. A bit later, COBOL came along, and the business folks were off and running. With this miracle-language, they could design records that all looked alike so that they could be fed through a simple sieve and processed at the blazing speed of the day. The software wouldn't need to handle special cases because every record would be exactly the same.

Although many other languages came along in the 1970's and beyond, at Catastrophic Automation Inc., H. P. observed that everyone knew that COBOL was the only real choice for developing enterprise-class software.