Thursday, June 30, 2011

Kill Projects and Develop Agile Programs

http://ctotodevelopers.blogspot.com/2011/06/kill-projects-and-develop-agile.html

Wednesday, June 29, 2011

Best practices of the past

Looks like SharePoint faithfully following the best practices of 10 years ago. Lots of XML files, XSLT - some of younger developers don't remember the hype surrounding these at the turn of the millennium. When I experienced pain of setting up BCS in SharePoint 2010, it reminded me of EJB as they were around 2000: lots of duplication in various XML and code files, typo-unforgiving environment, etc.

Come on! It's 2011! Everyone is talking about "convention over configuration", "view engine", Razr, code-first Entity Framework, etc. Are we going to see these in SharePoint 2020?

Tuesday, June 28, 2011

Evil security in Win2008R2

On Windows Server 2008 R2 there is no way to install assembly into GAC. Drag and drop - get "Access denied". Gacutil is not installed!

Had to copy gacutil.exe and gacutil.exe.config from my Windows 7 workstation to the server, then can install assemblies without any problems. Evil security again???

Development experience in SharePoint still sucks!

Struggling through BDC Model creation in Visual Studio: what a tedious and unforgiving process. Almost no feedback or error messages...

To create a List I have to edit an XML file...

Wednesday, March 23, 2011

Aspect-oriented programming

AOP and policy injection has low adoption because the use cases suggested are not that important. After all, security and logging has already pretty robust frameworks in both .Net and Java, and other use cases seem just lame...

Instead, where AOP can actually help is to enforce the Open-Closed principle, because it gives you a better alternative to subclass the classes trying to avoid modification. Rather than create derived classes a developer can create aspects or policies that extend the behavior of the class without having to modify it or create a string dependency through rigid inheritance structure.

Tuesday, January 04, 2011

Monday, October 11, 2010

Two lessons

I learned two lessons last week:
1. Friends don't let friends use ASP.Net Login Control
2. JQuery is the best way to fix bugs in ASP.Net.

Wednesday, August 11, 2010

Visual Studio command prompt with Powershell

I updated my profile in .\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 to include VS2010 prompt:


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

#Set environment variables for Visual Studio Command Prompt
pushd 'c:\Program Files\Microsoft Visual Studio 10.0\VC'
cmd /c "vcvarsall.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
write-host "`nVisual Studio 2010 Command Prompt variables set." -ForegroundColor Yellow

Thursday, August 05, 2010

Good TFS! Bad WebDeploy!

Evil MsDeploy wiped out my SharePoint site that was used to support TFS projects. Luckily I am on TFS 2010, so eventually I managed to get the site back without doing some low-level XML editing. I have to admit Microsoft did a very good job in making TFS more manageable.

I wish the next version of WebDeploy will be safer...

Wednesday, August 04, 2010

Comma in Powershell

Mmm Learned today the hard way that comma should not be used to separate parameters. That is, instead of:
Encrypt-String "Alex", "089234kljhwsdf=", "98qasdlfkjhasdflkjh==
you should use
Encrypt-String "Alex" "089234kljhwsdf=" "98qasdlfkjhasdflkjh==

Great explanation here.

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]) }

Wednesday, May 05, 2010

Посредственные программисты.

Засилию посредственных программистов способствует политика компаний, не желающий тратить деньги на тренинг своих сотрудников. Мол, хороший программист сам должен учиться, если хочет преуспеть как профессионал. Ха! Скажите это женщине с двумя маленькими детьми, или её мужу, работающему по 60 часов в неделю! Так многие программисты не поднимаются выше уровня, который они получили в институте.

Monday, May 03, 2010

Serialize objects into C#

Am I the only crazy person who would like to serialize objects into C# code? Not binary or XML serialization. I want to take an object and generate C# code that will recreate all the public properties of this object and save the code to CS files.

Thursday, April 29, 2010

MSDN and Offshore developer

Including TFS (and some other features) in MSDN Pro has another benefit: it makes it possible to use these features when working with offshore outsourcing partner. It is no secret, that offshore development is all about cost, so to keep the cost down the offshore partners limit the money they are willing to pay for development tools. Having extra $2000 per developer means extra 96c per hour, which can reach 5% of the hourly rate. Which means that either the company risk losing business or the developer will be underpaid.

So this is really a smart move from Microsoft side.