Recent Articles

Mar 2017

Oh JavaScript!

by in Error'd on

"I have a feeling that VS Code is trying to tell me that the object class provides functionality common to all JavaScript objects," writes Eric.


O User, Where Art Thou?

by in Feature Articles on

POI Spremberg

Hikari had just left Apps R' Us when our submitter, Steve, was asked by the CEO to review some of his code. Now, Steve wasn't on the same project as Hikari, but he had a reputation for being thorough and concise, while Hikari had a reputation for being fast but sloppy. Apps R' Us was a smallish shop, so Steve was a good pick for taking over the project despite barely knowing the requirements.


Prepared for the Real World

by in CodeSOD on

Usul is taking a college course on Java programming, and it’s doing an excellent job preparing him for the real world. Already, he’s been forced to cope with someone who knows one true fact and has run off to apply it in the dumbest way possible. This would be his professor.

Our true fact is this: A Java PreparedStament object, used for running database queries, should be closed after use. This returns its connection to the pool and frees any resources the statement was using. You should do this, and you should do it as soon as you’re done with your connection.


Raiding the New Manager

by in Feature Articles on

David was recently hired on to head the company’s development team. This was a brand-new position; previously, William, the company’s IT Manager managed the developers directly in addition to his other duties.

While getting his workstation set up, he was unable to install the FileZilla FTP client. It was completely blocked via domain policy. Finding this very strange, David talked to the IT Manager and hoped there was a legitimate reason.


The Refactoring

by in CodeSOD on

I have certain mantras that I use to guide my programming. They generally revolve around this theme: "Thinking is hard, and I'm not very good at it; every block of code should be simple and obvious, because if it makes me think, I'll probably screw it up and break something." It's a good rule for me, and a good general guideline, but it's a little vague to implement as a policy.

Erika’s company wanted to implement this idea as a policy, so they set a limit on how many lines could be in a single method. The thinking was that if each method was short- say, under 100 lines- it would automatically be simple(r), right?


{{$Errord_title = null}}

by in Error'd on

"Wow! Those folks from null and undefined must be big fans! I mean, just look at that voting turnout!" Kayleigh wrote.


Micro(managed)-services

by in Feature Articles on

Alan worked for Maria in the Books-and-Records department of a massive conglomerate. Her team was responsible for keeping all the historical customer transaction records on line and accessible for auditors and regulatory inquiries. There was a ginormous quantity of records of varying sizes in countless tables, going back decades.

Maria was constantly bombarded with performance issues caused by auditors issuing queries without PK fields, or even where-clauses. Naturally, these would bring the servers to their proverbial knees and essentially prevent anyone else from doing any work.

The Red Queen with Alice, from the original illustrations of 'Through the Looking Glass'

Dictionary Definition of a Loop

by in CodeSOD on

Ah, the grand old Dictionary/Map structure. It’s so useful, languages like Python secretly implement most of their objects using it, and JavaScript objects imitate it. One of its powers is that it allows you to create a sparse array, indexed by any data type you want to index it by.

Catherine’s cow-orker certainly thought this was pretty great, so they went ahead on and used the Dictionary to map interest rates to years. Years, for this application, were not tracked as actual years, but relative to an agreed upon “year zero”- the first year of the company’s operation. There was a new annual interest rate tracked for each year since.


That Lying First Impression

by in Tales from the Interview on

Pickup truck with spoilers

Dima had just finished her Masters in electrical engineering, and was eagerly seeking out a job. She didn't feel any particular need to stick close to her alma mater, so she'd been applying to jobs all over the country.


Countup Timer

by in CodeSOD on

Dan has inherited a pile of Objective-C. That’s not the WTF. The previous developer had some… creative problem solving techniques.

For example, he needed to show a splash screen, and after three seconds, make it vanish. You might be thinking to yourself, “So I set a timer for 3000 milliseconds, and then close the splash screen, right?”


Nothing to Lose

by in Error'd on

"With fraud protection like this, I feel very safe using my card everywhere," Brad W. writes.


Episode 4: Anarchy for Sale

by in Software on the Rocks on

Thanks to a combination of illnesses, travel, timezones, and the other horrors of the modern world, we took a week off. If Angular can skip version 3, we can skip episode 3. Welcome to Episode 4 of Software on the Rocks, brought to you by Atalasoft.

In today’s episode, we are joined by TDWTF author Jane Bailey. We talk about the process of writing, the nature of programming, and “programmer anarchy”.


The Tokens That Wouldn’t Die

by in CodeSOD on

Expiration

Sacha received custody of a legacy Python API, and was tasked with implementing a fresh version of it.


Frayed Fiber

by in Feature Articles on

The 80's were a time of great technological marvels. The Walkman allowed a person to listen to music anywhere they went. The Video Cassette Recorder allowed you to watch your favorite movies repeatedly until they wore out. Then there was the magic of Fiber Optics. Advances in the light-blasted-through-glass medium allowed places like Seymour's company to share data between offices at blistering speeds.

Bill, the President of Seymour's company, always wanted them to be on the cutting edge of technology. He didn't always know the why or the how surrounding it, but when he heard about something that sounded cool, he wanted to be the first company to have it. That's where Seymour came in. As Vice President of Technological Development (a fancy job title he got for being the organization's only true techie) he made Bill's dreams come true. All he had to do was ask for the company credit card.

an illuminated bundle of fiber optic cable

Still Empty

by in CodeSOD on

A few months ago, Hannes shared with us some recycled code. In that installment, we learned that one of his team mates has… issues with strings. And naming things. And basic language features.

These issues continue.


The Travelling Error Problem

by in Error'd on

"Microsoft has really stepped up their remote publishing game with their Visual Studio 2017 RC!" writes Robert M.


The Installer Configuration

by in Representative Line on

John N supports a C# project that, on first run, needs to initialize a database. It pulls that data from a dbInstallFilePath, controlled by the application .config file. This brings us to our representative line:

    <add key="dbInstallDbFilePath" value="C:\TestData\" />

Misdirected Emails

by in Feature Articles on

John C was a vigilant protector of justice, a dark guardian of a public who didn’t even know he existed, striking fear into the hearts of criminals. Specifically, he did IT support for the local police department. It wasn’t a great job. Their infrastructure was ancient, underfunded, and under-supported. He was expected to provide just as much support for the department’s website as well as their radio system. The customers were a “special” brand of ignorant, and often pretty angry about it. The department provided service 24/7, which meant John was expected to be available at weird hours, and not even for emergencies. Many of his customers only worked night shifts, and he had to support them.

At around 3AM, John caught a ticket, entered in by one of the secretarial staff. “Officer Bishop reports her email is broke”. With that cornucopia of information, he called Officer Bishop.

Newman, the mail-carrier character from Seinfeld, in uniform

WriteTenMemoryLocations

by in CodeSOD on

Let’s say you needed to initialize a buffer to be 260 bytes long, and they all should be 255. Now, you’re using a high-level language, like C#, to talk to a legacy device, so you might have to jump through some hoops to deal with the device API, but how hard could it be? A better question might be, “how hard can you make it?”

There’s an old saying: “fast, good, or cheap: pick two”. Massimo’s employer doesn’t want to be greedy, so they consistently pick one: cheap, which means they get code like this:


The Automation Vigilante

by in Feature Articles on

Sipping Bird

Fresh off an internship, Trace landed his first full-time job performing customer service and administration at a large company.


Rebooting Space Mountain

by in Error'd on

Hugo K. writes, "Space Mountain is closed for refurbishment. It will reopen when all security patches are installed."


Cloning Date

by in CodeSOD on

We get a lot of bad date code samples. Since we all learned to read a calendar in elementary school, everyone assumes they actually understand how dates work, and then tries to codify that knowledge in code. Bad date code is like entry level awfulness, and it takes a lot to surprise me when I see bad date handling code. Mike R knows how to do it, though. He found this code buried in a 30+ file commit, with the helpful commit message, “asdf;”:

public class DateUtil {
    private DateUtil() {
    }
    public static Date setDate(Date date){
        if (date == null) {
            return null;
        }
        return new Date(date.getTime());
    }
    public static Date getDate(Date date){
        if (date == null) {
            return null;
        }
        return new Date(date.getTime());
    }
}


public class DateUtilUnitTest {

    @Test
    public void testSetDate() throws Exception {
        Date date = new Date();
        Date result = DateUtil.setDate(date);
        assertThat(date,is(result));
    }

    @Test
    public void testSetsNullDate() throws Exception {
        Date date = null;
        Date result = DateUtil.setDate(date);
        assertThat(date,is(result));
    }

    @Test
    public void testGetDate() throws Exception {
        Date date = new Date();
        Date result = DateUtil.getDate(date);
        assertThat(date,is(result));
    }

    @Test
    public void testGetsNullDate() throws Exception {
        Date date = null;
        Date result = DateUtil.getDate(date);
        assertThat(date,is(result));
    }
}

It's No Big Deal

by in Tales from the Interview on
Snoofle's tale is a little different than our usual Tales From the Interview, but these kinds of negotiating tactics are TRWTF. -- Remy

After more than 3 decades in our field, I find my self in the position of being able to afford to retire, but not yet actually ready to retire. This is partly due to the fact that my wife still wants to work. While walking off into the sunset together seems enticing, biding my time until she's ready seems somewhat boring (for the unmarried, having too much fun while she's still at work, even by her choice, is not conducive to marital bliss).

Once you realize that you've cleared the financial hurdles where the big bills like college tuition and the mortgage are paid and retirement is funded, your priorities at work change. For example, when you need to pay tuition and a mortgage, you are willing to put up with a certain amount of stupidity so that you can take care of your family. Once those bills are paid, your tolerance for idiocy shrinks quite a bit. To that end, I left my last job - for the first time - with no job to go to.