"I recently had the chance to work on one of our projects that has been in development for longer than I have been employed here," writes Phillip, "back when the project was first started, a large part of it was outsourced overseas because, well, that was all the rage back then."

"I was assigned a few relatively simple tasks, which afforded me the opportunity to poke around the code for a bit. One of the first things I found was this, right at the top of SqlHelper.cs."

public static List<string> GetMonths(int month)
    {
        int _month = month;
        List<string> monthList = new List<string>();
        for (int i = 0; i < 12; i++)
        {
            switch (_month)
            {
                case 0:
                    monthList.Add("December");
                    break;
                case 1:
                    monthList.Add("January");
                    break;
                case 2:
                    monthList.Add("February");
                    break;
                case 3:
                    monthList.Add("March");
                    break;
                case 4:
                    monthList.Add("April");
                    break;
                case 5:
                    monthList.Add("May");
                    break;
                case 6:
                    monthList.Add("June");
                    break;
                case 7:
                    monthList.Add("July");
                    break;
                case 8:
                    monthList.Add("August");
                    break;
                case 9:
                    monthList.Add("September");
                    break;
                case 10:
                    monthList.Add("October");
                    break;
                case 11:
                    monthList.Add("November");
                    break;
                case 12:
                    monthList.Add("December");
                    break;
            }
            _month++;
            _month = (_month % 13);
            if (_month == 0)
                _month = 1;
        }
        return monthList;

    }

"I have yet to understand what the function does, or how exactly it's used. When I asked if anyone was considering any general clean-up and refactoring, the lead developer mentioned he had already spent a fair amount of time on that. Curious as to what this clean-up was, I took a look at one of his larger check-ins. In hundreds of different places, code that looked like this..."

string strConn = ConfigurationSettings.AppSettings["ConnectionString"];

"Had been updated to this..."

string strConn = ConfigurationManager.AppSettings["ConnectionString"];

Phillip added, "clearly, worrying about whether or not a particular part of the .net framework showing a warning because it had been deprecated was more important than whether or not un-managed resources were disposed of properly."

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!