Remy Porter

Computers were a mistake, which is why I'm trying to shoot them into space. Editor-in-Chief for TDWTF.

Feb 2017

The Longest Method?

by in Representative Line on

An anonymous reader was chatting with their fellow developers on Slack. They work for a telecom, and thus have to support software and hardware from a variety of vendors. In one Apple-provided API, they found this method.

ALUnlockWebServiceRequest appleUnlockWSRequest = new ALUnlockWebServiceRequest();
appleUnlockWSRequest.getAddPendingUnlockDeviceRequestAndCheckUnlockStatusDeviceRequestAndRemoveUnlockDeviceRequest();

The Billable Hour

by in Editor's Soapbox on

For every line of code that ends up in software the general public sees or interacts with, for every line in your Snapchats and Battlezone: Call of Honor Duty Warfare, there are a thousand lines of code written to handle a supply chain processing rule that only applies to one warehouse on alternating Thursdays, but changes next month thanks to a union negotiation. Or it’s a software package that keeps track of every scale owned by a company and reminds people to calibrate them. Or a data-pump that pulls records out of one off-the-shelf silo and pushes them into another.

That’s the “iceberg” of software development. In terms of sheer quantity, most software is written below the waterline, deep in the bowels of companies that don’t sell software, but need it anyway. That’s the world of internal software development.


Well Padded

by in CodeSOD on

We don’t receive many CSS-based submissions, possibly because CSS is already pretty horrible. There are real-world, practical things that you simply need to take a hacky, awkward approach with.

Matthew found this code, however, which isn’t a clever hack to work around a limitation, and instead just leaves me scratching my head.


A Date With a Parser

by in CodeSOD on

PastorGL inherited some front-end code. This front-end code only talks to a single, in-house developed back-end. Unfortunately, that single backend wasn’t developed with any sort of consistency in mind. So, for example, depending on the end-point, sometimes you need to pass fields back and forth as productID, sometimes it’s id, productId, or even _id.

Annoying, but even worse is dealing with the dreaded date datatype. JSON, of course, doesn’t have a concept of date datatypes, which leaves the web-service developer needing to make a choice about how to pass the date back. As a Unix timestamp? As a string? What kind of string? With no consistency on their web-service design, the date could be passed back and forth in a number of formats.


Rolling for Dollars

by in Software on the Rocks on

Today, we present our second installment of Software on the Rocks, complete with new features, like an actually readable transcript done by a professional transcriber. Isn’t that amazing?

In today’s episode, Alex and Remy host a special guest, Justin Reese, founder of Code & Supply, one of the largest developer community organizations out there, with a nearly constant stream of events. In this episode, we discuss what building a community is like, when is it fair to really tear into bad code, and that time Alex made 10,000 people late for work.


Notted Up

by in CodeSOD on

There’s an old saying, that if your code is so unclear it needs comments to explain it, you should probably rewrite it. Dan found this code in a production system, which invents a bizarre inversion of that principle:

static BOOLEAN UpdateFileStoreTemplates ()
{
  BOOLEAN NotResult = FALSE;

  NotResult |= !UpdateFileStoreTemplate (DC_EMAIL_TEMPLATE); // Not-ing a fail makes it true, so if Not result is True we've had a failure
  NotResult |= !UpdateFileStoreTemplate (DC_TABLE_HEADER_TEMPLATE); // Not-ing a fail makes it true, so if Not result is True we've had a failure
  NotResult |= !UpdateFileStoreTemplate (DC_TABLE_ROW_TEMPLATE); // Not-ing a fail makes it true, so if Not result is True we've had a failure
  NotResult |= !UpdateFileStoreTemplate (DC_TABLE_FOOTER_TEMPLATE); // Not-ing a fail makes it true, so if Not result is True we've had a failure
  NotResult |= !UpdateFileStoreTemplate (WS_EMAIL_TEMPLATE); // Not-ing a fail makes it true, so if Not result is True we've had a failure
  NotResult |= !UpdateFileStoreTemplate (WS_TABLE_HEADER_TEMPLATE); // Not-ing a fail makes it true, so if Not result is True we've had a failure
  NotResult |= !UpdateFileStoreTemplate (WS_TABLE_ROW_TEMPLATE); // Not-ing a fail makes it true, so if Not result is True we've had a failure
  NotResult |= !UpdateFileStoreTemplate (WS_TABLE_FOOTER_TEMPLATE); // Not-ing a fail makes it true, so if Not result is True we've had a failure

  return !NotResult;
}

Hired: Salary Trends

by in Announcements on

You may remember our new sponsor, Hired. To help them match up talent with employers, they’ve created their own proprietary dataset about salary and hiring trends, and have published their annual report about what they’ve found.


A Sample of Heck

by in CodeSOD on

An email from Andrea Ci arrived in our inbox, with nothing more than some code and a very simple subject line: “VB Conversion: a year in hell”.

A lot of people have that experience when encountering Visual Basic code, especially when it’s VB6, not VB.Net. Even so, could it really be that bad? Well, let’s look at the sample Andrea provided.


The Second Factor

by in Feature Articles on

Famed placeholder company Initech is named for its hometown, Initown. Initech recruits heavily from their hometown school, the University of Initown. UoI, like most universities, is a hidebound and bureaucratic institution, but in Initown, that’s creating a problem. Initown has recently seen a minor boom in the tech sector, and now the School of Sciences is setting IT policy for the entire university.

Derek manages the Business School’s IT support team, and thus his days are spent hand-holding MBA students through how to copy files over to a thumb drive, and babysitting professors who want to fax an email to the department chair. He’s allowed to hire student workers, but cannot fire them. He’s allowed to purchase consumables like paper and toner, but has to beg permission for capital assets like mice and keyboards. He can set direction and provide input to software purchase decisions, but he also has to continue to support the DOS version of WordPerfect because one professor writes all their papers using it.


Strung Out Properties

by in CodeSOD on

Microsoft recently announced that they’re changing how they handle .NET languages. Up to this point, the focus has been on keeping them all feature compatible, but going forward, they’ll be tuning VB.Net towards beginners, C# towards professionals, and F# towards people who have to use .NET but want to “be functional”.

VB.Net’s biggest flaw is that it’s inherited all of the Visual Basic programmers. You may be able to write bad code in any language, but I’m not convinced you can write good code in VB6 or earlier. Those bad habits, like Hungarian notation, can mark out “modern” code written with a distinctly “non-modern” mindset.


Episode 1: Traveling Angular

by in Software on the Rocks on

Welcome to Software on the Rocks, the Daily WTF podcast. This is a new feature we’ll be running on a bi-weekly basis for a first season of a few short episodes. If folks like it, or more important, if we really like doing it, this may continue, but for now, we’re committed to season of 6 episodes.

In this episode, Alex and Remy discuss ruining the site, the dangers of booking airline tickets, and why Angular 2 is absolutely the best possible framework for those who love lots of boilerplate.


Someone Hates These Interfaces

by in Representative Line on

Let’s start with a brief lesson on .NET. .NET, like most OO languages, needs the ability to perform “cleanup” when an object finally dies. One option for this is the Finalize method, which is called when the memory is freed, but since it’s the garbage collector’s job to do that freeing, you have no idea when (or even if) that will happen.

To solve that problem, .NET has an interface, IDisposable. The I, of course, is one of the lonely last relics of the tyranny that was “Hungarian Notation”. Classes which implement this interface have a Dispose method, which should be called by an instance’s owner to trigger cleanup (or can be auto-invoked through some nice syntactic sugar).