Alex W. used to work with a “senior” C# developer. This “senior” developer’s resume proudly proclaimed that he had 15 years of experience developing in C#.
That “senior” developer has long-since moved on to more senior pastures , but he left behind code like this:
string str = "<sessionid> <client> <sessiondate>.XLSX";
str = str.Replace("<sessionid>", row["clientname"].ToString());
str = str.Replace("<client>", row["clientname"].ToString());
DateTime time = Convert.ToDateTime(row["startdate"].ToString());
str = str.Replace("<client>", row["clientname"].ToString());
str = str.Replace("<sessiondate>", time.Day.ToString().PadLeft(2, '0') + " " + time.Month.ToString().PadLeft(2, '0') + " " + time.Year.ToString().PadLeft(4, '0'));
workbook.WriteXLSX(companyPath + str);
Obviously, since this “senior” developer had been using C# since before it was invented, he was using it before they had added methods like string.Format()
, or any sort of elegant date-formatting.
