Wednesday, July 28, 2010

Reality programming

It is a reality that we have a huge army of programmers that do not care about the quality of the code they write. It’s the reality, and we should not really blame them: they are trying to put bread on the table, feed their kids, parents and possibly other relatives as well.

So the reality should dictate different approach to programming. Rather than assuming that no code will be duplicated, we should assume that copy-paste will be the primary tool of development, and build our process around this. And when a programmer attempts to change some code that is also duplicated in 99 other places, the IDE should ask the programmer if he or she want also to modify the code in other 99 places, or maybe even give the programmer option to modify the code in 50 other places and leave the other 49 not modified. I know this is possible, because I am now checking out the tool called Atomiq that can find duplication in the code base.

What about source code? Say, if we want to revert a changeset in one file, the IDE will prompt us to revert the changes to all the code that is duplicated?

I know that most of developers will never write unit tests, but for the cases when their customers force them to do so what if the IDE will also duplicate unit tests to cover all duplicated code?

I know that most of the customers never test, but for those whose process requires them to do so what if the IDE will tell them that if they write a test case for a screen it will also work for 10 other screens that are duplicate of this one?

The purpose of these enhancements is not to encourage poor code quality, but to reduce the effect of the inevitably poor quality.

Generate encryption key (128-bit) for RijndaelManaged

$algorithm = [System.Security.Cryptography.SymmetricAlgorithm]::Create("Rijndael")
$algorithm.set_keysize(128)
$keybytes = $algorithm.get_Key()
$ivbytes = $algorithm.get_IV()
[System.Convert]::ToBase64String($keybytes)
[System.Convert]::ToBase64String($ivbytes)

Wednesday, July 21, 2010

My profile

Create folder WindowsPowerShell in My Documents
Create file Microsoft.PowerShell_profile.ps1
Copy this into the file:

function prompt {
$Host.UI.RawUI.WindowTitle=$(get-location)
"$ ";
}

Powershell command to get all the groups I belong to.

$ [Security.Principal.WindowsIdentity]::GetCurrent().Groups | % {$_.Translate([Security.Principal.NTAccount]) }