Sunday, 7 February 2010

Why software projects fail most of the time?

example of software project failiure

No PMs, it’s not because they run over time or over budget. It is that they are not user focused and don’t do the right thing. Most software applications out there have been over time and massively over budget. The ones that lasted are also very usable.

We focus too much on telling the machines what to do and how to do it and we completely forget about the human beings in front of the screen.

Just step back, take a second position and ask “Is this the right thing?” Deep down you know what right means, right? That is my question to differentiate between responsible and irresponsible senior software engineers.

Sunday, 6 December 2009

WIF manually generate federationmetadata.xml

I have been playing with claim based security lately, particularly with windows identity foundation. I hit the wall when I wanted to create a custom security token service based on MVC.NET. The default visual studio template for an STS project is a website type of project.

The core of the STS is the federationmetadata.xml file that advertises the claims that are issued by the STS. This file is generated by visual studio every time you create a new STS project. It is a digitally signed xml document so no way to manually change it.

One way to solve my problem is to generate an STS website every time I want to change something in the metadata, but this is not that nice.

The other way is to use the classes in the Microsoft.IdentityModel.Protocols.WSFederation.Metadata namespace. Which is fine but far too complex. What I did instead is:

var vsToolsAssembly = Assembly.LoadFrom("Microsoft.IdentityModel.Tools.VS.dll");
Type metadataUtilityType = vsToolsAssembly
.GetType("Microsoft.IdentityModel.Tools.VS.MetadataUtility");
metadataUtilityType.InvokeMember("GenerateMetadata",
BindingFlags.Default |
BindingFlags.Public |
BindingFlags.Static |
BindingFlags.InvokeMethod,
null,
null,
new object[] {"CN=STSTestCert",
"CN=STSTestCert",
passiveSTSUrl,
passiveSTSUrl,
isActiveStsType,
claimsOffered,
fullPath});

I am basically calling the code that VS calls when creating the STS You can download the whole solution from here.

Thursday, 29 October 2009

SQL Express feature request: running databases in memory

While I like this syntax of SQL Express connection strings:

Server=.\SQLExpress;AttachDbFilename=c:\mydbfile.mdf;Database=db; Trusted_Connection=Yes;

it still doesn’t solve my problem of running integration tests quickly. One option to improve the speed would be to have the database file on a RAM Disk but that is not always possible.

This would be way better:

Server=.\SQLExpress;Database=db; InMemory=Yes; Trusted_Connection=Yes;

Microsoft, when can we have something like this?

Sunday, 25 October 2009

Getting svn revision number from NAnt

http://stackoverflow.com/ has got the svn revison number in the footer which is quite cool especially when you have a build script that deploys the application automatically.

This is how you can get the revision from svn:
svn info --xml [repository url]

which returns
<?xml version="1.0"?>
<
info>
  <
entry
    
kind="dir"
    
path="."
    
revision="6">
    <
url>http://svnserver/svn/svnrevisiondemo/trunk</url>
    <
repository>
      <
root>http://myserver/svn/svnrevisiondemo</root>
      <
uuid>cb474c29-17db-0310-ba2e-db2fec5ab780</uuid>
    </
repository>
    <
commit
      
revision="6"
>
      <
author>cosmin</author>
      <
date>2009-10-25T17:09:08.315246Z</date>
    </
commit>
  </
entry>
</
info>

The most important bit in this output is the revision attribute of the commit node. This is the NAnt task that peeks into the xml above and extracts the revision number:
    <target name="find-svnrevision">
        <
property name="svn.revision" value="0"/>
        <
exec program="svn"
           
commandline='info "${project::get-base-directory()}" --xml'
           
output="svninfo.xml"
           
failonerror="false"/>
        <
xmlpeek
           
file="svninfo.xml"
           
xpath="/info/entry/commit/@revision"
           
property="svn.revision"
           
failonerror="false"/>
        <
echo message="Building revision number: ${svn.revision}"/>
    <
delete file="svninfo.xml" failonerror="false" />
  </
target>

Saturday, 24 October 2009

Ubuntu VM, renamed network interface eth0 to eth1

Few days ago my desktop restarted after a security update; Microsoft stop doing that! Unfortunately my git repository, an Ubuntu server 9.04 was running in VirtualBox. After restarting it the network was down and the only thing I could get from the logs was something like “renamed network interface eth0 to eth1” or so.

I started digging a bit and found that the MAC address of the virtual network adapter changed which made Ubuntu freak out a bit.

The solution was simple and straight forward:

sudo rm –f /etc/udev/rules.d/70-persistent-net.rules

Restart the VM and you are back in business.
Hope you find this useful.

Saturday, 17 October 2009

Software development ain’t building construction

How many of you have grand parents that worked in the software industry? None I guess. How about parents that are software developers? Not too many. Our industry is a made up industry. It has existed for less than a generation and as with any new field we needed a paradigm. We found construction.

Software development is not at all similar to construction though. Or let me put it this way: you should not assimilate software development with construction if business agility is what you are after.

In construction, once the architecture is ready, the materials to be used have been specified and the execution plan has been created, there is nothing major that can be changed in the process. The clients of a construction cannot ask for flying buildings or while the underground parking is being built to change their mind and demand an airplane parking instead.  The building can only function at the place it has been built and the clients cannot request to be moved to Antarctica. The law of gravity cannot change after the architects finished the design.

In software development all the above is possible or should be possible and this is the key differentiator when it comes to business agility. So the underlying idea in software development should not be resisting change but embracing it.

Behaviour-driven development is an “outside-in” methodology. It starts at the outside by identifying business outcomes, and then drills down into the feature set that will achieve those outcomes. Dan North

The idea behind the “outside-in” way of developing software is that you start up with the directly visible behaviour of the system, the surface, and fake or mock out all the dependencies. Present the result to the customer, get the feedback and incorporate that feedback into the next iteration. Everything adapts and evolves with the customer needs; this is not at all the case in building construction. Once a castle has been built there is no easy way to change the materials used in the walls or swap the basement with an airplane hangar.

Software is soft, elastic, fluid. The castle is not.

Developing software using the construction paradigm can be successful but most of the time, if it does not fail completely, results in rigid products that do not meet the requirements, unsatisfied customers and bad experiences for everybody involved in the development.

Just my experience, no scientific study to prove this.

References:
BDD – a road to effective design and clean code: http://www.infoq.com/presentations/bdd-dan-north
The Damned Construction Analogy: http://jamesshore.com/Blog/That-Damned-Construction-Analogy.html 
BDD+DDD: http://domaindrivendesign.org/library/north_keogh_gitlevich_2007
Strategic design: http://www.infoq.com/presentations/design-strategic-eric-evans
The Agile Manifesto: http://agilemanifesto.org/

Saturday, 3 October 2009

Test from Live Writer :)

If you see this then it works…

This is my new blog.