Just a Few Updates

by in CodeSOD on

Misha has a co-worker who has unusual ideas about how database performance works. This co-worker, Ted, has a vague understanding that a SQL query optimizer will attempt to find the best execution path for a given query. Unfortunately, Ted has just enough knowledge to be dangerous; he believes that the job of a developer is to write SQL queries that will "trick" the optimizer into doing an even better job, somehow.

This means that Ted loves subqueries.


National Exclamations

by in Representative Line on

Carlos and Claire found themselves supporting a 3rd party logistics package, called IniFreight. Like most "enterprise" software, it was expensive, unreliable, and incredibly complicated. It had also been owned by four different companies during the time Carlos had supported it, as its various owners underwent a series of acquisitions. It kept them busy, which is better than being bored.

One day, Claire asked Carlos, "In SQL, what does an exclamation point mean?"


Born Single

by in CodeSOD on

Alistair sends us a pretty big blob of code, but it's a blob which touches upon everyone's favorite design pattern: the singleton. It's a lot of Java code, so we're going to take this as chunks. Let's start with the two methods responsible for constructing the object.

The purpose of this code is to parse an XML file, and construct a mapping from a "name" field in the XML to a "batch descriptor".


Back Up for a Moment

by in CodeSOD on

James's team has a pretty complicated deployment process implemented as a series of bash scripts. The deployment is complicated, the scripts doing the deployment are complicated, and failures mid-deployment are common. That means they need to gracefully roll back, and they way they do that is by making backup copies of the modified files.

This is how they do that.


Another One Rides the Bus

by in Error'd on

"Toledo is on Earth, Adrian must be on Venus," remarks Russell M. , explaining "This one's from weather.gov. Note that Adrian is 28 million miles away from Toledo. Being raised in Toledo, Michigan did feel like another world sometimes, but this is something else." Even Toledo itself is a good bit distant from Toledo. Definitely a long walk.


The Middle(ware) Child

by in Feature Articles on

Once upon a time, there was a bank whose business relied on a mainframe. As the decades passed and the 21st century dawned, the bank's bigwigs realized they had to upgrade their frontline systems to applications built in Java and .NET, but—for myriad reasons that boiled down to cost, fear, and stubbornness—they didn't want to migrate away from the mainframe entirely. They also didn't want the new frontline systems to talk directly to the mainframe or vice-versa. So they tasked old-timer Edgar with writing some middleware. Edgar's brainchild was a Windows service that took care of receiving frontline requests, passing them to the mainframe, and sending the responses back.

Edgar's middleware worked well, so well that it was largely forgotten about. It outlasted Edgar himself, who, after another solid decade of service, moved on to another company.


The XML Dating Service

by in CodeSOD on

One of the endless struggles in writing reusable API endpoints is creating useful schemas to describe them. Each new serialization format comes up with new ways to express your constraints, each with their own quirks and footguns and absolute trainwrecks.

Maarten has the "pleasure" of consuming an XML-based API, provided by a third party. It comes with an XML schema, for validation. Now, the XML Schema Language has a large number of validators built in. For example, if you want to restrict a field to being a date, you can mark it's type as xsd:date. This will enforce a YYYY-MM-DD format on the data.


Off Color

by in CodeSOD on

Carolyn inherited a somewhat old project that had been initiated by a "rockstar" developer, and then passed to developer after developer over the years. They burned through rockstars faster than Spinal Tap goes through drummers. The result is gems like this:

private void init(){
	ResourceHelper rh = new ResourceHelper();
	for ( int i = 0; i < 12; i++) {
		months[i] = rh.getResource("calendar."+monthkeys[i]+".long");
		months_s[i] = rh.getResource("calendar."+monthkeys[i]+".short");
	}
	StaticData data = SomeService.current().getStaticData();
	this.bankHolidayList = data.getBankHolidayList();
	colors.put("#dddddd", "#dddddd");
	colors.put("#cccccc", "#cccccc");
	colors.put("#e6e6e6", "#e6e6e6");
	colors.put("#ff0000", "#ffcccc");
	colors.put("#ffff00", "#ffffcc");
	colors.put("#00ff00", "#ccffcc");
	colors.put("#5050ff", "#ccccff");
	colors.put("#aa0000", "#ff9999");
	colors.put("#ff8000", "#ffcc99");
	colors.put("#99ff99", "#ccffcc");
	colors.put("#ffcc99", "#ffffcc");
	colors.put("#ff9966", "#ffcc99");
	colors.put("#00c040", "#99cc99");
	colors.put("#aadddd", "#ccffff");
	colors.put("#e0e040", "#ffff99");
	colors.put("#6699ff", "#99ccff");
}

Archives