Wednesday, November 23, 2011

Variable Naming Conventions

The benefits of naming conventions in software code are generally recognized while specific "conventions" are debatable. Personally I'm looking for the implied intent and meaning of the source code, code that reads as a narrative. Here are the heuristics that I use (when not given a coding standard.)
  • Compound identifiers, containing more that one word
  • CamelCase the compound identifiers
  • Start with a letter; [a-z,A-Z]
  • Use only letters and numbers, no other chars like -_+~!. (Under_score is possible exception.)
  • Mnemonic names built from a (informal) dictionary of shorthand strings.
  • Start function identifiers with a cmdlet verb (Powershell convention).

Since I am currently developing in a .NET world the Microsoft recommendations also apply.

  • UpperCamelCase for most identifiers.
  • lowerCamelCase for parameters and variables.
  • No type prefix hints.
  • End the identifier with a base class name (optional).
And then there are the PowershellCommunity.org recommendations.
  • ScriptAndGlobalFunctionNamesShouldFollowCmdletNamingStandards
  • VerbsShouldBeSelectedFromStandardList
  • ScriptAndGlobalFunctionNamesShouldBePascalCased
  • CamelCaseVariableNames
  • NounNamesShouldBeSpecific
  • NounNamesShouldBeSingular
  • ScriptsIntendedToBeDotSourcedShouldUseLibraryPrefix
  • ProvideDescriptiveVariableNames
  • AvoidHungarianNotation

Sail to other shores with Coding Guidelines (PDF), naming conventions of OBO Foundry, Hungarian Notation pros/cons, and Powershell best practices.

Saturday, November 5, 2011

Upma

Two years ago I blogged about the Loughhaven restaurant. Well here is information on upma/uppammaa/upama (a spicy Indian dish using curry, vegetables and Cream of Wheat). Cream of Wheat, semolina and sooji; the names are many but the truth is one. Upma is good, make it the way you like it.

We tried toasting the sooji in a dry dutch oven and set it aside. Later used only two cups of water for a fluffier constancy. Sharon thought the wheat was a bit under cooked so next time we will use 2 ½ cups of water to a cup of sooji.

Below are a couple of videos that I referenced in developing the above recipe.

We tried the mold trick in this next video without using Pam, the upma came right out, no problem. (Maybe a non-fluffy version of the dish (more water) will cause it to stick to the cup.) Molding it certainly makes for a nice presentation, I put the yogurt on top and the pickle on the side.

If you know what you are doing this video is nice. She uses 3 cups of water to 1 cup of sooji.