Recent Articles

Nov 2016

Trimming the Fat

by in CodeSOD on

There are certain developers who don’t understand types. Frustrated, they fall back on the one data-type they understand- strings. Dates are hard, so put them in strings. Numbers aren’t hard, but they often exist in text boxes, so make them strings. Booleans? Well, we’ve come this far- strings it is.

Tyisha has the displeasure of working with one such developer, but with a twist- they didn’t really understand strings, either. Tyisha only supplied a small example:


Awful On Purpose

by in Feature Articles on

ExpoSYFY - Charlie and the Chocolate Factory (8521128271)

Studying his new work contract, Stewart felt like he'd found a golden ticket. After 2 long and tedious years in the local university's IT department, he was happy for any opportunity to escape that hellhole. TLA Technologies looked like the Garden of Eden by comparison. Instead of being the only person responsible for anything vaguely computer-related—from putting up websites to plugging in power strips—he'd now be working with a "dynamic team of programmers" in a "rapidly growing company tapping into the web development market". Instead of dealing with tools and languages forgotten by history itself, he'd be using "modern, cutting-edge solutions" under "agile and customer-oriented methodologies". And instead of reporting to a pointy-haired supervisor who couldn't tell a computer from a toaster, he'd be working directly under Dave.


Indentured

by in CodeSOD on

Speaking with developers, I’m always surprised to find a surprising percentage are surprised and baffled by the “Fluent API”. This object-oriented convention is based on the Builder Pattern, and involves call chaining to construct a configured object. So, for example, if you needed to configure a SystemHandler object to have a series of LinkHandler objects, you might have something like this:

    Handlers = SystemHandler.builder()
        .AddLinkHandler(…)
        .AddLinkHandler(…)
        .AddLinkHandler(…)
        .SetConfiguration(…)
        .ConfigureOtherParam(…)
        .build();

Classic WTF: Illicit Process Improvement

by in Feature Articles on
In celebration of Black Friday, also known as "Retail Hellscape", let's look at a retail-oriented classic WTF, which originally ran way back in 2007. We'll resume our regularly scheduled WTFs next week.--Remy

Christian R. was in trouble. Despite his experience across hardware and software, desktops and server clusters, thumb drives and SANs, he hadn't found any freelance work in weeks. It was clear that he'd have to figure something out to pay the bills.

In August, Christian applied at Drab's PCs, a large retail chain focused on computer hardware and software. He'd shopped there for years and had an impressive level of knowledge about their products, so he accepted a position in Technical Sales.


Classic WTF: Injection Proof'd

by in CodeSOD on
It's Thanksgiving, in the US. Be thankful you're not supporting this block of code. --Remy


“When a ‘customer’ of ours needs custom-developed software to suit their business requirements,” Kelly Adams writes, “they can either ‘buy’ the development services from the IT department, or go to an outside vendor. In the latter case, then we’re supposed to approve that the software meets corporate security guidelines.”

“Most of the time, our ‘approval’ is treated as a recommendation, and we end up having to install the application anyway. But recently, they actually listened to us and told the vendor to fix the ‘blatant SQL-injection vulnerabilities’ that we discovered. A few weeks later, when it came time for our second review, we noticed the following as their ‘fix’.”


Actually, My Father was a Folding Chair

by in Error'd on
It's a holiday week this week, so today is our Friday. Enjoy an Errord. - Remy

"I have to wonder what on earth posessed those parents to add that suffix to their kid's name," writes Mack C.


Unpythonic

by in Feature Articles on

From: Kirby McCloy [email protected]
Subject: Concerns about SMERPS
The SMERPS project seems to be going down the wrong path. I thought our quarterly goal was for IT modernization.

The email carried no specific call to action. It barely had a point, and was little more than bad-natured griping. It also came from Kirby, the CTO. The email triggered a four-alarm underpants fire as every manager on the SMERPS project tried to guess what Kirby might possibly mean.


The Rule of Ten

by in CodeSOD on

Florian’s office has a “rule of ten”. Well, they don’t, but one of Florian’s co-workers seems to think so. This co-worker has lots of thoughts. For example, they wrote this block, which is supposed to replace certain characters with some other characters.

sbyte sbCount = 0;
// set value of new field content to old value
sNewFieldContent = sFieldContent;
while (rFieldIdentifierRegex.Match(sNewFieldContent).Success) {

        // for security reasons
        if (++sbCount > 10)
                break;

        // get identifier and name
        string sActFieldSymbol = rFieldIdentifierRegex.Match(sNewFieldContent).Groups[1].Value;
        string sActFieldName = rFieldIdentifierRegex.Match(sNewFieldContent).Groups[2].Value;
        string sActFieldIdentifier = sActFieldSymbol + sActFieldName;

        // default value for unknown fields is an empty string
        string sValue = "";

        [... calculate actual replacement value ...]

        // replace value for placeholder in new field content
        sNewFieldContent = sNewFieldContent.Replace(sActFieldIdentifier, sValue);
}

Does Anyone Here Speak CSS?

by in Error'd on

"If you ask me, it's not just English speakers that GSMArena is in need of," wrote Aankhen.


The 10x Developer

by in Feature Articles on

“You’re going to learn quite a bit from Burt,” Burt said. “He’s one of the best.”

Davide blinked. He wondered if his new boss spoke about himself in the third person as a matter of course. Cautiously, he said, “Well… I hope so?”

Alberta Highway 10X (1970s)

Coldly Fused

by in CodeSOD on

In 1989, a pair of physicists claimed to have achieved the fusion of hydrogen at room temperatures. This came as quite a shock to other physicists, since fusion was only known to happen inside of stars. Within a few months, their claims were roundly rejected. Cold fusion became synonymous with junk science.

Fast forward to 1995. when a small company wanted to make its own set of generous claims about its web application framework. Allaire, Inc (eventually bought out by Macromedia, which itself was eaten by Adobe), claimed that its Cold Fusion could solve all your web development problems. All of your web development challenges could be solved through the judicious application of CFML.


The Logic Barrier

by in Feature Articles on

Brad was brought in as a new hire to work on improvements for a big-name ERP system. His supposed role would be that of the "input guy" for a new I/O module where engineers would enter some numbers, they would be crunched, and it would output a wireframe design of what they needed to build. While he got started, the development manager Cindy assured him they'd have an "output guy" soon enough.

A bottle of Monopolowa Vodka


Just In Case

by in CodeSOD on

Brandon’s company had a lot of work to do, and not enough staff to do it, so they hired on some freelancers. They were careful about it, and felt like they’d hired some good people. One developer, in particular, was the kind of developer who not only understands the low-level Windows API, but actually knows how to use some of the undocumented corners of it to get things done.

Most of the module was pretty good, but when Brandon double checked on the method for escaping disallowed characters from a URL, he found some problems.


Let's Eat

by in Error'd on

"Apparently, only a small part of my dinner qualifies as food," writes Alex F.


Exceptional Handling

by in Feature Articles on

Sonic 2006

Enterprise Resource Planning software, or ERP for short, is crucial to the operation of many large businesses. Several popular ERP systems have plugin-friendly architecture, the better to sell upgrades their customers will never want or use. This software is primarily aimed at businesses with too many complex process flows to manage by hand—making it the perfect domain for a small, lean startup with 3 developers and 1 customer.


Repeat Delete

by in CodeSOD on

Kneaded eraser

Once upon a time, a client contacted Trick R. and asked him to figure out why files were disappearing from their website.


A SNOBOL's Chance

by in Feature Articles on

We’ve all inherited legacy systems. You know the sort; 20 years old, more than 50,000 lines of code, poorly designed - even for its time, completely undocumented externally and useless code comments within, mangled beyond recognition due to countless developers making myriad ad-hoc changes upon changes and so-on. Now imagine such a system written in a tool that’s been around for nearly half a century, but rarely used for the intended purpose of the application.

A group of people rolling a snowball taller than any of them

Reg worked for a firm that built space-rocket related applications; specifically an Ada compiler, written in SNOBOL, for a 15+ years obsolete legacy processor used in the rocket. The system itself consisted of more than 100 SPITBOL (a speedier compiler of SNOBOL) programs, most of which were written by one guy nearly four decades ago, Barry. Barry was a former sixties hippie-turned-coder. Though long since retired, he had been called back to active duty to try and help decipher what this thing does.


A Type of Test

by in CodeSOD on

Unit tests are a wonderful tool for proving that your code works. Ideally, when you’re using other code, like say, the .NET Framework, you don’t write tests that test the framework itself. After all, didn’t Microsoft already do that?

David T’s co-worker laughs at your naïveté. Why would you trust Microsoft? You need to make sure the framework works as advertised. Which is why their unit tests are mostly made up of code like this:


"X" Marks the Spot

by in Error'd on

Dan writes, "This happened when selecting 'see more' under my (Your) recommendations. Maybe there's buried treasure somewhere?"


The World Tree

by in Feature Articles on

When Nate was wrapping up his senior year of college, he hunted around for a job that would hire an undergrad on flexible hours. He knew that the kinds of companies that tended to hire on those terms could often have… creative practices, but college wasn’t about to pay for itself.

He found a small shop that needed an extra hand. Extremely small- there was only one other developer, Gordon. Nate was prepared to enter a tiny shop with no real practices or procedures, because with only one developer, you don’t expect a lot of rules and bureaucracy.

Tangled tree roots Neroberg

Dollar Dollar Dollar Dollar Underscore

by in CodeSOD on

Dollar symbol

An Anonymous source sends us some Java code they found in source control, with really special variable naming conventions. I can only assume this came from a plucky startup hoping to attract venture capital.


No Account for You

by in Feature Articles on

Ed wasn’t excited about his job. He worked for a large automotive manufacturer. This is the kind of industry that might invest heavily into robots and research and development, but when it comes to managing their supply chain and accounts receivable, their IT infrastructure was frozen in amber circa 1974.

Elaine getting her revenge on the Soup Nazi from Seinfeld

The pay was fine, but the work was frustrating. Things like “Code reviews” and “refactoring” were viewed as “wastes of time” or “developers playing with toys”. Unit tests were a luxury for “lazy” developers- good developers should just be writing code that works. If the work you’re doing isn’t directly involved in getting cars built and shipped, you shouldn’t be doing it.