by in CodeSOD on

"Include descriptive comments for each method," isn't bad advice. I mean, ideally, the method name and parameters would be descriptive enough that you don't need to add lots of comments, but more comments is rarely going to hurt things. Unfortunately, "include descriptive comments" usually decays into "include comments". And that's how we get piles of code like this one, from Patrick:

// // Function name : CZiArecaRaidController::ReadAllRaidsetInfo // Machine : w7gre7 // Environment : Visual Studio .Net 2008 // doxygen : /// \fn CZiArecaRaidController::ReadAllRaidsetInfo(BSTR ContextInfo, IZiArecaDataCollection *pRaidsetInfoCollection, IZiArecaDataCollection *pVolumesetInfoCollection, IZiArecaDataCollection *pPhysicalDriveInfoCollection) /// \brief /// \details /// \param ContextInfo /// \param *pRaidsetInfoCollection /// \param *pVolumesetInfoCollection /// \param *pPhysicalDriveInfoCollection /// \return STDMETHODIMP /// \author (redacted) /// \date 24.01.2011 09:59:10 // STDMETHODIMP CZiArecaRaidController::ReadAllRaidsetInfo(BSTR ContextInfo, IZiArecaDataCollection **pRaidsetInfoCollection, IZiArecaDataCollection **pVolumesetInfoCollection, IZiArecaDataCollection **pPhysicalDriveInfoCollection) { // ... } // // Function name : CZiArecaRaidController::GetArecaErrorMessage // Description : // Return type : string // Argument : ARC_STATUS stat // Author : (redacted) // Machine : Lapgre5 // Environment : Visual Studio .Net 2005 // Date/Time : 05.06.2007 15:24:53 // string CZiArecaRaidController::GetArecaErrorMessage(ARC_STATUS stat) { // ... }

Document Soup

by in Feature Articles on

An Enterprise Resource Planning system needs to keep track of your enterprise resources. Many of those resources, especially the expensive ones, need lots of documents tracked about them- inspections, service reports, maintenance bills, etc. So the ERP and the Document Management System need to talk.

Years ago, for Coyne, this presented a few problems. First, the ERP was a mainframe application running on an IBM mainframe. Second, it was getting retired. Third, the DMS didn't talk directly to it, but instead communicated through a terminal emulator and used configuration files to correctly parse the screen contents coming back from the mainframe.

The Tech Lead

by in Feature Articles on

Years ago, Karthika was working as a contractor. She got hired on to develop an intranet application for a small government project. The website in question was already in use, and was absolutely mission critical for the organization, but it also had a very small user base- roughly five users depended on this application.

When Karthika started, she immediately encountered a few surprises. The first was the size of the team- 8 developers, including a Team Lead. That seemed like a large team for that small number of users, and that didn't even include the management overhead. The code base itself was similarly oversized; while the product was important, it was a pretty prosaic CRUD app with a few tricky financial calculations involved.

Classic WTF: The Old Ways

by in CodeSOD on
It's a holiday in the US today, so we're taking a trip into the past for a haunting classic about how things used to be. Original. -- Remy

Greg never thought he’d meet a real-life mentat.

“We’re so happy to have you aboard,” said Jordan, the CEO of IniTech. She showed Greg to the back end of the office, to a closed door marked with just one word: Frank. Jordan, not bothering to knock, opening the door.

Up Up Down Down Left Right Left...

by in Error'd on

...Right B A. Right? Every so often, someone sends us a submission with a hidden agenda. Of course we get the usual solicitations for marriageable exotic beauties and offers to trade linkspam locations. But then there are the really interesting ones. Maybe they're legitimate, maybe they're photoshopped or otherwise faked, and maybe they're an attempt to bypass someone's ban on political propaganda or quack science. In any case, there isn't any of that here this week, but we're saving them up and maybe we'll feature a future issue of spot the fraud for you.

First up is dog lover George with a hysterical spam-blocking email address, sharing a help message that must have been crafted by Catbert himself. "My sixty seconds of glory awaits!" he howls, but then whimpers "I will be real disappointed if the agent isn't [Gone in Sixty Seconds headliner] Nicolas Cage."

A Pointer to your References

by in CodeSOD on

John C works at a defense contractor, and his peers are well versed in C. Unfortunately, many years ago, a lot of their software started being developed in Java. While references are often described as "pointers, but safer," they are not pointers, so your intuitions about how memory gets allocated and released are likely to be wrong.

Which is definitely the case for John's peers. For example, in C, you generally want really clear understandings of who owns a given block of memory. You don't want to allocate memory and hand it off to another module without being really clear about who is responsible for cleaning it up later. This means that you'll often write methods that expect buffers and other blocks of memory passed into them, so that they don't have to worry about memory ownership.

A Basic Print Algorithm

by in Feature Articles on

Common snail

In the late 90s, Aaron was employed at a small software company. When his coworker Mark submitted a letter of resignation, Aaron was assigned to maintaining the vast system Mark had implemented for an anonymous worldwide company. The system was built in the latest version of Visual Basic at the time, and connected to an Oracle database. Aaron had never written a single line of VB, but what did that matter? No one else in the company knew a thing about it, either.

The Correct Browser

by in CodeSOD on

Sometimes, it's not the code that's bad, but what the code costs. For Elizabeth's company, that cost was significant in terms of dollars and cents. They needed to staff up to accomplish some major Java Enterprise work, so they went with the highest of the highly paid consultants they could find. These consultants came from a big name firm, and were billed at an eye-watering hourly rate.

Elizabeth warns us that the Java code is a behemoth of WTFs that is "too difficult to describe", but one particular WTF leapt out at her. Specifically, included in the application was a file called nonIEUser.html. This project was happening circa 2012, which is after Microsoft finally admitted standards might need to be a thing, and definitely well outside of the time when your web application should only work in Internet Explorer. For a greenfield project, there was no reason to do anything IE only, and fortunately, they didn't- aside from forcing a check to yell at you if you didn't use IE.