Recent Representative Line

A single line of code from a large application that somehow manages to provide an almost endless insight into the pain that its maintainers face each day.

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();

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).