The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,229 other subscribers

Archive for September 25th, 2012

Please fellow programmers, name variables more properly.

Posted by jpluimers on 2012/09/25

The code I had a hard time understanding

The below code didn’t compile during a .NET 1.1 to 4 migration.

Downstream code:

Word.Document document = app.Documents.Add(ref FileName, ref missing, ref missing, ref missing);

Upstream code (6 layers up!):

string filename = Path.Combine(ConfigurationSettings.AppSettings["MSWordTemplateDirectory"], (string)status["CoverLetter"]);

And somewhere in the middle:

public bool GenerateLetter(Word.Application app, DataRow row, object FileName, object FilePathAndName)

Afterwards the code is this

Downstream code:

Word.Document document = app.Documents.Add(ref templateFileName, ref missing);

Upstream code (6 layers up!):

templateFileName = Path.Combine(ConfigurationSettings.AppSettings["MSWordTemplateDirectory"], (string)status["CoverLetter"]);

And somewhere in the middle:

public bool GenerateLetter(Word.Application app, DataRow row, object templateFileName, object documentFileName)

Coincidentally, parameters are now all lowercase.

–jeroen

Posted in .NET, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »

 
%d bloggers like this: