DevDisasters

Keep It Simple

Simple problems are often solved by simple solutions. Other times, simple problems are solved with an end user running a Web site from Visual Studio on their machine.

As the newly hired guy on a development team at the university, Jay was handed a pile of work that had queued up since the previous individual in his role had suddenly departed.

His first inherited application seemed to be a relatively simple affair: an in-house written add-on to the university payroll system to load municipality tax code. The way the process worked was that every few weeks or so, the university would receive one or more .csv files that included details of how much needed to be deducted for every employee. That data needed to be inserted into the database from an external tax service that handled all the messy local income tax details the university staff wanted to avoid.

Ordinarily, it's only a few rows in response to a single university employee's move to a different area of the city, but when it came to a quarterly full-on, all-employee refresh, the file could get fairly large -- upward of 100,000 records because the relationship was one employee to several rows of data. To add to the fun, Jay learned from the payroll system users that they expected every data load would require some degree or another of special attention to get the data fed into the database properly.

The payroll group found this extra manual work to be a huge pain and it was Jay's job to relieve that pain.

Not So Simple After All?
Going through the (curiously named) "database inserter" project code, he ran across this little beauty:

// This method is needed 
public static DataTable ReadCsvFile() {
  return readCsvFile(GetOutputFileNameFromGuid(HttpContext.Current.Request.QueryString["guid"])); 
}

"Wha …? GetOutputFileNameFromGuid? Where does a GUID come into this?," Jay wondered aloud, "Files are sent as Year-Month-UNIVERSITYPAYROLL.CSV ... OK, I'm officially confused."

Jay halted his investigation. If he was going to be able to really dig into this problem, he'd have to see how this data load was done -- straight from the source: the users.

This Is How We Do It ...
Jay made his way through the cube farm that made up the administrative services of the university and found Anne -- his user contact for the project.

He readied his notebook and pen, eager to take notes on Anne's process for doing the municipal tax data load. Anne, who was either excited to explain her process (or just really over-caffeinated), jumped into explaining her process rapid fire.

"Oh yeah. It's pretty simple, actually. First, I open up Visual Studio and once I pull down the latest version of the 'database inserter' project files from TFS, I run the page in debug mode. Next, I get a GUID from this site http://www.guidmaker.com/, put the municipal tax file in the directory for the 'database inserter' project, rename it to that GUID I got with a .csv and add 'guid=' with that GUID to the URL in Internet Explorer. Finally, I refresh the page, and let it chew on the file. Sometimes it takes five minutes, sometimes a couple hours -- really, it all depends on how many records there are. And, if there's a badly formatted record with an extra comma or something, it'll get hung. And let me tell you, that's a real pain! We won't find out until the next morning!"

Jay felt shell-shocked. In fact, he didn't make it past writing "1." on his page. "So ... y-you're a developer?"

Anne chuckled. "Ha! Yeah, I wish! Then I could make the real big bucks! Nah, the guy before you trained us all in how to do the data load like this ages ago until he could get the kinks worked out ... which I'm guessing is up to you now!"

Jay nervously chuckled in reply, "Ha! Yep, looks that way!"

The meeting wrapped up soon after and Jay navigated his way out of the cube maze and made it back to his desk. On his way, he was able to think about the process, the code, and everything that Anne had gotten used to doing and took the next logical step: He created a brand-new project in the payroll code branch aptly named, "Municipal Tax CSV Loader," and had a working solution by the end of the day, integrated into the already-existing payroll Web site, ready to test.

Anne was right -- it was pretty simple after all!

About the Author

Mark Bowytz is a contributor to the popular Web site The Daily WTF. He has more than a decade of IT experience and is currently a systems analyst for PPG Industries.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube