Showing posts with label How To. Show all posts
Showing posts with label How To. Show all posts

Monday, 23 June 2014

User Story with Technical Use Case Template

Every single time I join a new agile team, I am asked the same thing - How do you write a user story?

There are many ways to achieve this. Here is mine template of choice. It is a User Story with Technical Use Case template. The hardest part everyone has when writing a story is defining Business Value. If your users wouldn't say it then it isn't business value. Keep that in mind.

User Story: @id


User Story: [One line description of the story. Keep it short as this is how the team will refer to the story. e.g. Eligible User logs in]

As a/an [persona/user/role/consuming-system e.g. Eligible User]
I want to [do a function of the system e.g. Log in]
So that [business value e.g. Access my information]

Main Flow

Preconditions/Entry Criteria

  • This is an unordered set of conditions that must be met before the first step can begin.
  • E.g. The user is on the login page
  • E.g. The user has already been added as a valid user with a username and password
  • …


Steps
1.      This is an ordered numbered list of steps that represents the happy path through the workflow.
2.      E.g. User enteres username and password.
3.      E.g. User clicks the “Login” button.
4.      E.g. User is authenticated and authorised and shown the Successfully Logged In page.
5.      …

Post Conditions/Acceptance Criteria/Exit Criteria

  • This is an unordered list of conditions that must be satisfied in order for the flow to be considered completed.
  • E.g. User sees the Successfully Logged In page.  
  • …

Alternate Flow 1

Preconditions/Entry Criteria

  • This is an unordered set of conditions that must be met before the next step can begin.
  • E.g. User login was unsuccessful
  • …


Steps
4.1   This is an ordered numbered list of steps that represents the happy path through the workflow.
4.2   This included all error flow but not exception flow.
4.3   E.g. User sees the Login page with an unsuccessful message .
4.4   E.g. User is able to retry logging in.
4.5   …

Post Conditions/Acceptance Criteria/Exit Criteria

  • This is an unordered list of conditions that must be met for the story to be complete.

Alternate Flow 2

 … 

Alternate Flow 3

… 

Exception Flow

Preconditions/Entry Criteria

  • This is an unordered set of conditions that must be met before the next step can begin.
  • E.g. A system exception has been thrown.
  • …

Steps

  • This is an ordered numbered list of steps that represents what happens every time there is an exception in the flow that can’t be anticipated. 
  • E.g. User sees the Error page with an filtered error message
  • …

Post Conditions/Acceptance Criteria/Exit Criteria


  • This is an unordered list of conditions that must be met for the story to be complete.
  • Sunday, 23 June 2013

    Visual Studio Tricks - UML Validation of your Intended Architecture



    Now for the third post from the series of Visual Studio Tools I Can't Live Without on using UML diagrams to validate your intended architecture.

    Part of what I do when I run a code review is to extend it with a report on design divergence. That is when I look at what the intended application design was and what has actually been implemented.

    This takes several long and probing interviews with the application architect or technical lead, asking questions about what they think has been coded. Then I look at the code at a high level, with more attention paid to sections with more complexity.

    Sometimes it is pretty spot on. Sometimes it is very very different when we get in to the code.

    As mentioned in other posts, I will use tools like dependency graphs to get a quick high level understanding of a code base. Another tool that Visual Studio gives me that I didn't have in the past is UML diagram validation of code.

    Visual Studio has a project type called a Modelling Project that allows you to create different kinds of UML diagrams that communicate what your intended application design is or are created from code and show the implemented application design.

    Again, there is a lot of documentation on how to create these diagrams. The main thing to know is that there are many different types of diagrams and once you put them in place, they can be used to validate the actual code.


    Using these tools, you can reverse engineer a code base quite quickly and take in the high level design visually, which is for me the fastest way to understand an application architecture.

    It is also quite revealing in that it can show boundary violations between components that cause future extensibility pain. In one case, we identified calls being made from the view directly to the data access layer, bypassing business logic layers. The architect there didn't realise that some of the less experienced developers didn't know they shouldn't do things like that.

    Layer and Class diagrams are my favourites. The ability to drag and drop a file from the Solution Explorer in to the diagram makes them a breeze to create.

    Once I have diagrams in place, I communicate to the technical leads how to continue to use and create them for regular checks and even in gated check-ins.

    A picture really is worth a thousand words.


    Thursday, 20 June 2013

    Visual Studio Tricks - Dependency Graphs



    In the second post of this series of Visual Studio Tools I Can't Live Without are Dependency Graphs.

    When I conduct a code review or set up a gated check-in, static code analysis will give a list of all the things that are wrong based on a predetermined set of recommended practices. These are mostly superficial and not 100% indicative of whether a code base is bad or terrible or should be burnt to the ground.

    Usually, people will look at the number of of errors and warnings found by static analysis to draw conclusions. These can often be the same issue over and over due to things like copy and pasted code, generated code or agreed practices that counter recommended practices.

    In any code review I carry out, there is more than just a list of errors. There is an understanding of where those errors sit in the the scheme of things, how serious they are and if they are an indication of worse things to come.

    To draw theses kinds of damning or freeing conclusions, an engineer must understand the code base. We have only days to get to this point so we draw on everything we can to help us with understanding what we are judging.

    Years of experience will help.
    A walk-through with the technical lead will help.
    And a picture that speaks a thousand words will certainly help.

    With Visual Studio 2012 (VS2012), I have embraced and celebrated the idea of Dependency Graphs along with Analyzers.

    There are a lot of instructive posts about how you go about this. There is no need for me to walk you through it.

    What I do want to do is make you aware that there is a way to look at the complexity in code in a visual way. You can find and explore circular references, unreferenced nodes and hubs which are highly referenced nodes.

    One place this is valuable is in code reviews of pending change sets. VS2012 can filter to just pending changes. This allows a technical lead to ensure that unnecessary complexity is not introduced with bug fixes or added features.

    If you need to understand how your code is connected then use this tool. You may even become dependent.

    Visual Studio Tricks - Code Clone Detection



    It seems that the tools I take for granted are not used by all. This is the first in a series of posts where I will be sharing some of my essential Visual Studio tools that every .NET developer should be aware of. If you already are then avoid me stating the obvious and go read something else.

    Call me Code Review Girl and hand me a cape. In my role, it is common for me to travel the depth and breadth of Asia, Australia and New Zealand to conduct a code review and design divergence checks on very large government and commercial code bases.

    Microsoft has internal tools that let us do that with great ease. This is always where we start. However, we often go further with remediation plans and sit with developers to show them the kind of things we found in their code that need improving. We don't just show them how to fix it but explain why these issues are issues and how they can be tracked down. In my case, I use pair programming to start. Teach a dev to fish and all that.

    When I pair program with a developer, I will never let them copy and paste code. They can either type the whole thing from scratch or they can write a method and call it in both places. Copy and pasting code is an anti-pattern that will result in bloated code bases and often carried errors.

    Now, that is all well and good when you are writing new code with another developer but for the times when you aren't watching and enforcing that rigour or for past crimes, Visual Studio 2012 gives you Code Clone Detection.

    I won't go in to too much detail repeating what the link above explains but I will give you a quick summary of what you get and how to use it.

    Code Clone Detection looks at code statements of 10 or more lines that appear in methods and properties across entire projects or solutions. It works on code with up to 40% of its tokens changed and with statements that have been rearranged.

    There are two ways to use it:
    1. Highlight a specific piece of code, right-click and choose to Find Matching Clones in Solution; and find that specific code repeated; or
    2. Use the Analyze menu to Analyze Solution for Code Clones and find all occurrences of repeated code.
    There are ways to exclude certain files like generated code and you will want to do that with large generated code bases.

    I find this one of the most useful tools when looking at how to attack a large code base that needs a refactoring machete. This is a tech lead's best friend. Or at least one of them.

    Let the clone wars begin.

    Thursday, 22 September 2011

    A Thousand Words


    When I find myself explaining a concept over and over again to the same or different members of my team, it is a signal that I need to draw a picture.

    Often, I draw the picture for a few people before it clicks that I should put it on an A3 piece of paper and stick it on a wall or take a photo and send it around in an email.

    In the case above, I was explaining mapping between model classes coming out of different layers of the application. All sorts of words were being used to refer to these objects and it was getting confusing.

    This image has given us an explanation of where mapping classes exist; what models coming out of different layers are called; namespaces to be used when creating or referring to mappers and models; and a common language for technical discussion.

    To write that in a document would be long and cumbersome.

    When you aren't explaining it in code, explain it in pictures.

    Wednesday, 3 August 2011

    Tell me a story


    The story wall went up at work today. We are the not just the only project running agile, we are the only project with much of a plan at all. Working in this small city has frustrated me to no end. People here talk of things they do, without doing them. They say they are aiming for this and that and then all the aiming that is done is in the talking of it.

    This project is different. We are walking the walk. The team likes the idea of agile. They are willing to try it. They are willing to find the flavour that suits them and the project.

    Our goals are simple. Short deadline. Fixed budget. Huge scope.


    The Story Behind It



    When I joined, we had done a lot of requirements gathering and there were big solid specs being written. There were documents defining process and documents defining documents. Today, I uploaded my last documentation of the project up to the Sharepoint portal and turned my head to the story wall.

    Over the last few weeks, we have been breaking down tasks. I walked them through how to do that breakdown and then how to guesstimate to the best of our knowledge at the time. We recorded effort in days and the whole team agreed on complexity and volatility. We came up with numbers and costs and best of all, a shared understanding of what we were building.

    The first visible way this has been communicated is to produce a story wall from our master story list. The master story list is a list of the discrete tasks that describe functions and sub-functions in the required system. Developers will undertake one task at a time, after business analysts have described it and they have both agreed on acceptance criteria. That acceptance criteria will guide our test driven approach to development and eventuate in automated tests and the QA and then user acceptance tests for each story/task/story.




    Reading the Cards


    Right now, the wall is made up of different coloured cards...
    • White - Story cards made up of an Id, a task description, estimation of effort, complexity and volatility ratings and space for acceptance criteria and notes;
    • Green - Descriptive cards that give headings for the stages that a story goes through and other important sections that a card can belong to;
    • Pink - Defects which are played like stories and require Ids, estimations and all the things a story needs. They will come out of testing stages after they have been accepted for QA and moved out of In Dev, which are two of our story stages;
    • Yellow - Tech cards for technical tasks that are related to stories and need to be explicitly detailed. I personally hate tech cards but for iteration 0, they are valid. If I see too many, heads will roll;
    • Blue - We haven't associated them with anything yet. We are calling them Terry cards. Terry is our project manager. We didn't want him to feel left out since he's on leave and I'm sure he'll have a good suggestion for their use. Possibly things Damana is not allowed to blog about;
    • Sticky notes of random colours - These denote blockers and notes relevant to a story. They are stuck on the story card.


    The Life of a Card

    There are columns that represent the stages a story, defect or technical card can move through. At each stage, there is an owner of that card. A card can not be in play and not have an owner. For a card to move from one stage to another, there must be a discussion between at least two members of the team and one must be the owner handing over to a new owner.

    Our stages for this project are...
    • Backlog - Where all stories sit until they are played in an iteration. Everything starts here. It's a little like Munchkin Land;
    • In Analysis - All stories that are being played in a current iteration will start here on the first day of the iteration, after the IKO (Iteration Kick Off) meeting. At this point they belong to the business analysts and will only move once they are ready for development. This is usually a decision made by two analysts or an iteration manager and an analyst. Remember that the analysis on a story does not need to be 100% complete. A story card is an opportunity for a conversation. It is not a spec;
    • Ready for Dev - Now the story is available for a developer to pick up once they have the bandwidth to start and complete it. At this point, the decision to move it to the next stage is made by a business analyst and a developer. If you live in a perfect world then hopefully a QA is around to help establish acceptance criteria with those two;
    • In Dev - The acceptance criteria is set, the estimation validated loosely by the dev and the shared understanding of what is required completed enough to start the task having occurred between analysts and developers (yes, a pair). Development starts. This does not mean running away and working in solitude. Nope. There will be more questions for the analyst and the business and other members of the team. Nothing happens in isolation on this agile team. Transparency and Conversation are paramount;
    • Ready for QA - As it sounds, this is when the developer(s) think that the story has been fully implemented and can be taken for system testing. In our case, this means acceptance criteria are met and there are automated tests at all levels ready and running in continuous integration. Full integration has been made with the project code base and all compliance with agreed coding and developer standards are adhered too (well, mostly). At this point, the developer and the QA are often having a chat. Anything that needs clearing up is brought to the business analyst. Beware of slippery developers who bargain at this point. Don't pay the ferryman until he gets you to the other side. I have turned around to many QAs and said "well, you agreed I met the criteria so move that to another story";
    • In QA - The story is in system test and belongs to the QA. I won't tell you how to do good QA because I'm a developer and there are better people out there to tell you such important things;
    • Ready for UAT - The story has met acceptance criteria and passed system testing. It is ready to show to the client;
    • In UAT - Users are testing it. The team deals with defects and waits for users to accept the implemented functionality. Business analysts, QAs and iteration managers are dealing with outcomes at this stage. We wait;
    • Signed-Off - The users have tested it and the business has signed off the story as complete. We celebrate. For some that is chocolate. For others champagne.

    Pwn It

    Every member of the team has chosen themselves an avatar that will represent them on the wall. Some chose their photos. Some chose creatures or characters that represent them. This is how they will be seen and how they will own their current task. These are about the size of a business card. Our only rule is "no nakedness".


    The Outcome

    Every process is different. Every wall is different. The purpose is the same. Communicate and provide visibility to the whole team and stakeholders.

    Tomorrow, we will start holding our stand ups around the story wall. That is when the team will see the true value of both the visual story wall and stand ups. It will become the most important part of our project.

    It will grow and change so that it gives meaning to our particular project. Come back once in a while and check how we are progressing.

    Tuesday, 27 April 2010

    Offline Installers


    Most installers available for download online these days, will actually download a a small executable that will download the rest of the required installation files form the Internet as it progresses. If you have a slow connection or are using a proxy then it will often fail.

    Do not fret.

    Usually, there will be an option to use what is called an Offline Installer. It will be accessible from another location of the installer's website. If it isn't obvious and easy to find then search for application installer offline in your favourite search engine.

    For example: Here is the online installer for Chrome from Google and the here is the offline one.

    This may seem too simple to share but I've encountered several people who have given up trying to install something because it failed through the online version.

    Friday, 9 April 2010

    Restart Windows from the command line


    If you don't have access to restart a Windows machine (maybe you've remoted in) then here is the cheeky way to do it from the command line...

    > shutdown -r -f -t 01

    Where...

    • -r is Restart (you can use -s for a straight Shutdown and -h for Hibernate);
    • -f is Force; and
    • -t is Timelapse with a 01 second delay.
    If you want to abort the shutdown use...

    > shutdown -a

    Saturday, 20 March 2010

    Would you like fries with that?


    One in ten.

    That's how many managers I have worked with who have made me better at my job just by working for them. There were three things about them that made me a better employee...


    They are direct

    If they wanted something from me then they asked me clearly and explained the reasons why. That could include doing things to gain brownie points with clients; for political reasons inside an organisation; for urgency; or for winning or losing a battle that needed to be won or lost.

    Most developers are not political animals. In fact, trying to make us that works the other way. We don't have the same drives as the fox in the work place. Gaining power and status doesn't attract us to the work we do. Developers who like that usually end up as managers or start calling themselves Architects. No, software engineers chose to work in this profession because creating something from nothing is what we enjoy doing. Bringing order to chaos. Finding patterns in a mess of requirements. Deconstructing an unfathomable problem domain and rebuilding it in technology.

    Don't get me wrong, we aren't stupid or disconnected from the games played in the workplace. Most of us would rather be but we are aware the these dynamics exist and that no matter how illogical it is, we are affected by them. We often see them as an necessary evil that must be dealt with to get stuff out of our way so that real stuff can be achieved.

    With that in mind, when the political manoeuvrings draw us in we would rather you just tell us what you need us to do to make them go away. I have had many a management type ask me what it is ok to tell the team. My answer is almost always the same: tell them the truth.

    Manipulation to get us to do what you want is only going to come across as condescending and kinda stupid (on the part of the manager). We are grown ups. Be straight up with why and how and unless it's illegal or completely immoral then you will find that we are on your side and do want to help make things happen.


    They remove blockers

    What I do well, is build things. In my world it involves talking to a framework on top of an operating system, running on hardware in a controlled little utopia that (in the best case) helps someone do their job better or be serviced at a higher level. People talk of efficiency and cost-benefit and rapid delivery and usability. That's a lot of blah blah blah to me most of the time. I want what I produce to make a positive difference in the world. When I walk off this client site, it should be in a better state than when I arrived. Be that for the workers internally or customers and external agents. Whoever uses the system should be benefiting from the man(a) hours I put in to it.

    Those hours are the hours I bill the client that add up to the how much the project costs and how long it takes. I'm a cog in a complex system of other cogs including other software developers, managers, analysts, business people, users, testers, and dozens of others who care about getting the project out the door. What I need from a manager is to not know what all the other cogs are going through, except in summary. I need to work with a person who can hear me when I identify something that is slowing my progress and use whatever means they have to remove that blocker.

    The best managers I have every worked with removed those blockers systematically and efficiently. They heard the pain points we were experiencing and took them seriously. They did not pacify with promises of actions but instead did all they could to get us moving again or at least explain what was holding us up. Information will set you free. Keeping information flowing in to a team and out of it, then on to whoever else needs it or can use it to keep us moving forward is the key to being a good manager or leader of a team.

    People who pacify the team and cushion the message to the client are only prolonging the moment until the truth bites and the pain bubbles up to the surface. It's just like patting someone with a dislocated shoulder on the head and saying "I know it hurts. I'll get something for that right away" and then walking in to the next room and telling the doctor that all the screaming is just the person in the other room, having a pillow fight with a bunch of teenage girls. It doesn't help anyone do their job.

    Solve the problem by removing the blocker and keeping the lines of communication open.


    They are part of the team

    This is the controversial one. The one that I have argued with many technical leads and managers about. They say that to lead, you can not be part of the group. That leading means living outside the organism that follows you on the leash. It means appearing infallible to those above and those below.

    A very respected project manager at a recent company I worked at gave me feedback at the end of a project that summed up to this: You can not lead a team and be part of that team because no one will do what you say. She was on her way to becoming a big manager in that company. Management loved her because she was one of them. Of course, she wasn't one of us. One of the consultants that went out there and did the actual work. Nobody trusted her. We all liked her and said she was very organised and did her job well but we didn't want to follow her anywhere. She knew how to be a good project manager but she was never a leader.

    A leader doesn't need the authority of another person to lead a group, they need the authority of the group. I did tell her this and she scoffed at it. Interestingly enough, within a month of getting a good promotion she was out drinking with the troops and doing all she could to become one of them. Why? Because bossing someone around only gets you so far. People have to know you understand them and have their best interests at heart or they won't follow you anywhere.

    The big thing a manager needs is to be part of the team. Not necessarily mates who go out boozing it up together but someone who suffers their pain and celebrates their triumphs. Someone who knows what coffees they drink or that they don't drink coffee at all. Of course they have to be organised and structured and good with clients but people always forget how important it is to be good with your team as well.


    In the end, most of this can be summarised by one important skill... communication.

    Tell your team what you want in a clear and direct way with the real reasons behind the request. Listen to the team about what is causing them to slow down and remove those blockers or talk to someone else who can. Get to know your team and let them get to know you. You have to spend a lot of your time with these people so they might as well know why your least favourite alcohol is tequila or that the client drives you nuts too.

    Wednesday, 8 July 2009

    How to complain about SMS or MMS spam to your mobile phone

    In Australia, it is a serious offense to spam a mobile phone via SMS or MMS without the user opting in. If this happens to you, make a complaint to the Australian Government through ACMA.

    I shall now go and complain about Optus.

    Sunday, 15 February 2009

    ✄ Cute ♧ Symbols ☻ On ☂ Your ❤ Mac ✿

    Someone asked me yesterday how to get cute little symbols in their tweets. This applies everywhere and not just on twitter.

    There are many sites that will give you a bunch so you can copy them. That's an easy and quick way to find them.

    If you have a Mac, this is the best way to find them...

    1. Go to your System Preferences and select International


    2. Under the Input Menu tab, turn the Character Palette on


    3. An Australian flag (for us Aussies) will appear on the right-hand side of the menu bar. Under that is the option to Show Character Palette containing all the possible symbols


    4. You can insert from the Character Palette in to any text box or document. Now go and annoy everyone to death with pictures instead of words ☻

    Wednesday, 21 January 2009

    You can't make everyone happy, so don't try too hard


    My personality type according to Myers Briggs, sees life as a series of constant battles. In the past that was the case. With age and a pinch of wisdom, that is no longer the trend.

    Since this is my professional blog, I'd like to discuss the idea in the context of the workplace and your place in your organisation.

    First thing, no one respects a yes man. That is a rule. Remember it.

    Having an opinion is always good. You don't always have to voice it all the time but having one is essential. Shutting up is a skill. Learn it.

    So how do you balance the need to speak out and at the right time close the gate between the your brain and your mouth?

    I'm an extrovert and this is something I've constantly struggled with. Even after ten years of practice, there is no easy answer. I do however have a good handle on being myself and not spending too much time pleasing everyone. There is the saying that "you can not please all of the people, all of the time" and this is true but that doesn't mean you should quit and sit passively by, pretending this is not happening.

    Here is how I think you can do this...

    Count to Ten

    Take your time to form your own opinions. Listen to others who you respect. Think about what you respect and like about their ethos and adopt those things as your own with your flavour. Through discussion, reading and contemplation, form your opinion about things conceptually before being in that actual situation. If a whole complex situation is too much then work with parts of situations.

    Don't jump up and voice an opinion on something to the room if you have not thought through what is about to come out of your mouth.


    Admit you are wrong, if you are

    Often people voice an opinion and stick to it purely out of pride. If you do get it wrong then learn to admit you are wrong. There is nothing wrong with changing your opinion and telling people, if what you think now is different and improved. People will respect you if you are humble enough to admit you a wrong. Don't be too humble though.


    Shut Up Already


    When you have said your piece and articulated what you think then stop.

    Do not make the mistake of saying something over and over again with the assumption that they aren't agreeing because they simply don't understand. Sometimes, people just don't agree with you, for whatever reason. Say what you have to say and then stop saying it.

    Give the person you are talking to, time to digest what you have expressed.


    Don't try to please only your Managers

    One thing I have seen of late is people who state an opinion just to show their bosses that they agree. Managers are not idiots. Ok, some are but if they aren't then they see right through you. If your opinion is an exact parrot of your superiors then all that you will gain is a Mr Burns and not the respect you may crave.

    Pleasing only those above you also wins you no friends. I've worked in environments where the rule was to "kiss up and kick down". There is only so far you can go with that war cry. Remember to consider how what you say will filter the views of those around you. All people matter. Not just the ones who decide your pay rise.


    If you follow those four rules, you will find that you will be fine. Interpret them how you will but find your voice. Your own voice. Learn when to use and when not to.

    Sunday, 11 January 2009

    TDD Objective-C : Testing a Cocoa Framework Project

    My intention is to write an iPhone application that does something simple, just so I can learn how they are designed, built, tested and deployed. The first step is to design the core functionality that the application will use. For that, I am creating a Cocoa Framework, which is a class library. This project will be test driven.

    This describes how I created a Cocoa Framework project and the accompanying unit tests.

    Operating System: Mac OSX 10.5.6
    IDE: Xcode 3.1.2
    Language: Objective-C


    Creating a Cocoa Framework Project and Test Target

    1. Start Xcode;
    2. Go to File -> New Project... and create a new Cocoa Framework project named MyApp;
    3. In this MyApp project under Targets, Add -> New Target... of the type Cocoa Unit Test Bundle called MyAppTests.

    Making Your Target Dependent on the Main Executable

    "When you configure your test target, you need to decide how you want that target to behave. The unit test bundles that come with Xcode can be integrated with your executable in one of two ways. One technique is to configure your test target as a separate entity that you build and run independent of your main executable. The other is to add dependencies to your target that automatically build your executable and run the tests each time you build." -- Xcode Help

    I've chosen to run the tests every time I build the framework project, so I followed the steps on this Xcode Help page: To make your test target dependent on your framework project.

    Here is a summary of how to make a Cocoa Unit Test Target dependent on your Cocoa Framework by establishing the dependency in your Xcode project:

    1. Select your MyAppTests target;

    2. Open an inspector for the target;

    3. Select the General tab;

    4. Add a dependency to the test target by clicking the + button and selecting the framework target MyApp from the list;

    5. Select your Unit Test Bundle target;

    6. Open an inspector for the target. To get an inspector on a project, just control-click on the test target and choose Get Info. The resulting window is referred to as an inspector. Typing Command-I does the same thing;

    7. Set Build -> Linking ->Bundle Loader to $(BUILT_PRODUCTS_DIR)/MyApp.framework/MyApp;


    Create a Test Class and a Failing Test

    1. Control-click on the MyAppTests target and choose Add -> New File...;

    2. Create a new Objective-C Test Case Class and name it MyAppFunctionalityTests. Two files will be created - MyAppFunctionalityTests.h (the declaration) and MyAppFunctionalityTests.m (the definition);

    3. In MyAppFunctionalityTests.m, add a test method like this:


    //
    // MyAppFunctionalityTests .m
    // MyApp
    //
    // Created by Damana Madden on 10/01/09.
    // Copyright 2009 __MyCompanyName__. All rights reserved.
    //

    #import "
    MyAppFunctionalityTests.h"


    @implementation
    MyAppFunctionalityTests

    - (void) testThatThisIsTrueForThisCase
    {
    STAssertTrue(false, @"oops it didn't work.");
    }
    @end

    4. To run the test, build the MyAppTests target. You will see this test fail.

    Important: All tests must be prefixed with the word 'test' or they will not be picked up and run.

    Saturday, 15 November 2008

    Making your own VS.NET nunit Test Project Template

    Returning to .NET has been exciting after a long time away playing in Java and Ruby land. I can't say I'll miss XML config files and all that junk.

    First thing I did after creating my first ASP.NET MVC project was to add a template to easily create a project to test it. The new template will create a class library project with MVC, nunit and my mocking framework of choice Rhino included and ready to go.

    When you use VS.NET 2008 to create an MVC web application, it asks if you want to add a testing project to go alongside. Unfortunately, the only choice of test project template you get is the Microsoft one and I like nunit much much more.

    This is how we do it...

    Set the project up the way you want it to appear new
    1. Create a new C# class library project. Give it a general name which will apply to your test project template.
    2. Add a reference to the System.Web.MVC dll.
    3. Add a reference to the nunit.framework dll.
    4. Add a reference to the Rhino.Mocks dll.
    5. Set the Copy Local property for all of the above dll references to True.
    6. Create a Controller folder under the project root.
    7. Add a class HomeControllerTest to the Controller folder.
    8. Add unit tests to cover the About and Index actions.
    9. Build your project to get the binaries.

    Export the project template

    1. Go to File --> Export Template and use the wizard to export the template. Call it NUnitTest. You will be told where the zip file is saved to.
    2. Be sure to chose the option to include the icon.
    Importing the new template
    1. Move the NUnitTest.zip to %Program Files%\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates\Csharp\Test\1033. This might be different for you.
    2. Quit Visual Studio.
    3. Open a command prompt and navigate to %Program Files%\Microsoft Visual Studio 9.0\Common7\IDE.
    4. Execute devenv /setup and go make a cup of coffee.
    5. If you now open VS.NET 2008 and create a new project, you should be able to see your template show up under the C#-->Test directory.
    6. Add the registry key below by copying the text in to a file and calling it nunit.reg. Run this regfile to add the key. You can add it manually also using regedit.


    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\MVC\TestProjectTemplates\NUnit\C#]
    "Template"="NUnitTest.zip"
    "Path"="CSharp\\Test"
    "TestFrameworkName"="nunit Test"
    "AdditionalInfo"="http://msdn2.microsoft.com/en-us/library/ms243147(VS.80).aspx"
    "Package"=""

    Friday, 31 October 2008

    Finding our target velocity without black magic

    To be in the moment (and I always like to be), here is a post for Halloween that removes the black magic from the estimation process and determines initial velocity.

    Photo by euart used under the flickr Creative Commons license

    Starting a new project and being around from the beginning is always an eye opener. If you are involved in estimation then it is also like signing a contract. Breach of promise to reach the guessed random number can be punished with overtime and a sense of failure. Heaven forbid a late project especially if it is fixed price.

    I've started a new project and we are working out how long it will take and what resources are required. For the first time, estimation seemed more deliberate and less like guesstimation.

    This is how we did it...

    What you need to start estimating:
    • The latest draft of the master story list - a list of the all the stories known so far, written like "AS a person using the system, I WANT TO do something functional SO THAT business value is achieved";
    • As many members of the delivery team as possible - including engineers, testers (QA), business analysts (BA) and even business;
    • Agree on the length of an iteration;
    • An estimation deck - usually consisting of cards representing the Fibonacci sequence between 1 to 13. If you don't have this then use your fingers with 10 fingers = 13;
    • A willingness to estimate in points and not days;
    • A big table for everyone to sit around and to spread the cards on;
    • Snacks - this can take a while.
    Next you get the team to understand what you are building, both high-level technically and what the business wants:
    • Sit everyone down at the table;
    • Have the BA or Project Manager (PM) read through every story;
    • Allow questions to understand what the story means;
    • Rewrite or breakdown stories in to small functioning parts;
    • Write out all stories on 4x6 cards.
    Now you start throwing numbers around:
    • Re-read the stories;
    • Get everyone involved in delivery to do min-likely-max estimates and write them on the back of the cards- minimum points if all goes blissfully well, likely points in a realistic situation and maximum points if all hell breaks loose;
    • For each story work out volatility - low, medium or high;
    • For each story work out completeness - complete, incomplete or unknown;
    • For each story work out complexity - simple, medium or complex;
    • Engineers group the stories in to what they think they could complete in one iteration. Use about 5 groups - dependencies and iteration order are not important. Just look at the size of the stories and group an iterations worth;
    • PM secretly adds up the total likely estimated points from the groups and works out average iteration velocity;
    • PM lays out different groups of stories that would fit in to the new predicted velocity - note this is not the teams actual velocity because that isn't known until they actually start banking points;
    • The engineers looks at the groups and decide if they are too big, just right or too small - it's a little like Goldilocks;
    • Rinse and repeat - this can be re-estimated and sorted again to double check numbers.

    Monday, 27 October 2008

    This one is better: ruby-net-ldap

    After posting a quick how-to about Ruby-LDAP, I received a couple of very helpful comments that pointed me towards ruby-net-ldap. This is a pure Ruby LDAP library that is stable and has good documentation to help you along. It is the best Ruby LDAP gem out there and I've been through almost all of them to get to this point.

    Here is a simple search for an organizational unit with the name "marketing"...


    require 'rubygems'
    require 'net/ldap'

    def ldap_search

     ldap = Net::LDAP.new
     ldap.host = "localhost"
     ldap.port = "389"
     ldap.auth "cn=Directory Manager", "password"

     filter = Net::LDAP::Filter.eq( "ou", "marketing" )
     attrs = [ "ou" , "objectClass"]

     ldap.search( :base => "dc=mycompany, dc=com", :attributes => attrs, :filter =>
     filter, :return_result => true ) do |entry|
       puts entry.dn
     end

    end


    Here is the code to add an organizational unit under the base node...


    require 'rubygems'
    require 'net/ldap'

    def ldap_search

     ldap = Net::LDAP.new
     ldap.host = "localhost"
     ldap.port = "389"
     ldap.auth "cn=Directory Manager", "password"

     dn = "ou=marketing, dc=mycompany, dc=com"
     attr = {
       :ou => "marketing",
       :objectclass =>"organizationalUnit"
     }
     ldap.add( :dn => dn, :attributes => attr )

    end



    Check out the rest of the documentation for pretty good examples. This is the library I recommend. In my situation, I'm using ruby-net-ldap to import data in to, manipulate and query data in an OpenDS LDAP server.

    Sunday, 5 October 2008

    Ruby-LDAP

    I said it would never happen but here is another Ruby blogpost for the ThoughtWorks pool. In my defense, there really wasn't much help out there on this topic so my pair and I decided this had to be posted. His post on what we tried in order to make Ruby talk to LDAP is over there.

    The Bits
    OpenDS is Sun's LDAP server. We chose this as our LDAP server because it is the one most likely to sit behind the OpenSSO Single Sign-On implementation we are populating, querying and binding to. It is written purely in Java and provides a bunch of useful shell scripts and a Java API to do the things we want to do. This will allow us to test our Ruby-LDAP implementation independently of our solution.

    OpenDS has a nice installer with a friendly setup wizard. If you want to script the install then run this from the root of the installation directory:


    >$ './setup --cli --no-prompt -p 1389 -D "cn=Directory Manager" -w "password" -b dc=example,dc=com -a --doNotStart'


    Ruby-LDAP was the friendliest and most sensible choice because it was the most pure Ruby choice which allowed us to do things the Ruby way. RJB let us use the OpenDS libraries but was too much like writing Java in Ruby and involved running another JVM on the production server it is destined for. If we were to go that far then we'd have opted for JRuby to do the bridging. After ActiveLDAP flat out refused to acknowledge OpenDS and would only play well with OpenLDAP, that was written off. Ruby-LDAP is a written in C so it isn't a nice gem install but instead takes a bit of making and shaking to get going.

    Here is how to install it from the command line once it is downloaded and unzipped:

    >$ ruby
    ruby-ldap-0.9.7/extconf.rb "."
    >$ make
    >$ make install

    The Required Basic LDAP Knowledge
    LDAP is like a very simple and slightly stupid database for storing Identity information. It does not have transactions. You can't query it with SQL. It is a tree. It does have a schema.

    Understand your LDAP schema. You can customise it. It is made up of nodes that are defined by object classes and attributes. These include but are not restricted to: Organization; OrganizationalUnit; and Person.

    Distinguished Name (DN) appears everywhere when you are dealing with LDAP. It is the unique name given to a node in the LDAP tree and describes the exact path from the node to the root. A DN starts at the node and walks up the tree. It looks like: uid=damana,ou=australia,dc=mycompany,dc=com

    This is an LDAP glossary that was useful in deciphering the LDAP maze and nomenclature.

    Adding an Organizational Unit
    To add an organizational unit:


    #/usr/bin/ruby -w

    require 'ldap'

    connection = LDAP::Conn.new('localhost', 1389)
    connection.bind('cn=Directory Manager','password')

    record = [
    LDAP.mod(LDAP::LDAP_MOD_ADD,'objectclass',['organizationalUnit']),
    LDAP.mod(LDAP::LDAP_MOD_ADD,'ou',['australia
    ']),
    ]

    connection.add("ou=branches, dc=
    mycompany, dc=com", record)

    connection.unbind


    Adding a User
    To add a user to an organizational unit:


    #/usr/bin/ruby -w

    require 'ldap'

    connection = LDAP::Conn.new('localhost', 1389)
    connection.bind('cn=Directory Manager','password')

    record = [
    LDAP.mod(LDAP::LDAP_MOD_ADD,'objectclass',['person']),
    LDAP.mod(LDAP::LDAP_MOD_ADD,'cn',['Damana Madden']),
    LDAP.mod(LDAP::LDAP_MOD_ADD,'cn',['dmadden']),
    LDAP.mod(LDAP::LDAP_MOD_ADD,'sn',['Damana Madden']),
    ]

    connection.add("cn=Damana Madden ou=australia, dc=mycompany, dc=com", record)

    connection.unbind


    Deleting a User
    To delete a user:


    #/usr/bin/ruby -w

    require 'ldap'

    connection = LDAP::Conn.new('localhost', 1389)
    connection.bind('cn=Directory Manager','password')

    connection.delete("cn=Damana Madden ou=australia, dc=mycompany, dc=com")

    connection.unbind

    Friday, 20 June 2008

    Live Outside Your Comfort Zone

    Photo by doeth used under the flickr Creative Commons license

    IT is a changing space. It moves faster than other industries. The tools you worked with five years ago are the ones we would all sigh at if we heard they were being used now. Languages are born, reborn, popular and then not. The shape of the space changes with architectures ending in OA and everything 2.0. Your head will spin if you try to do it all but our jobs do mean that we have to at least keep up and know what the latest technology is, even if only for those moments at the water cooler.

    Of late, I've had the chance to meet a lot of smart people who are new to the industry and asking how to keep up with all the changes. Of course, us oldies mention reading blogs, tech books, books on thinking, joining user groups and all those practical things. A lot of people are doing that but they still look around and wonder why nothing is happening. I think it's because you can't wait for change. You have to stretch yourself and extend your comfort zone.

    We all look on ourselves favourably and think we live on the edge. Each of us is convinced that we push ourselves to be better at things - things we already do and those we don't. That's probably mostly true. For me, it's not really enough.

    It is easy to stagnate. Take a job that by definition appears hard to others and you at first and then stay in it too long. Too long is when you know what the upcoming day entails. When you are comfortable. When nothing in your day scares you and makes you doubt yourself that little bit. That is a bad spot to be in. That is when you need to move on or shake things up.

    When I talk to someone who is bored with their job, my usual response is to tell them to start making it fun and if that's not possible then find something newer and harder. Yes, quit and go for a job that extends you. Every interview I have ever been to involves me interviewing them too. Sometimes the guys on the other side of the table don't pass. I don't hire them as my employers. They aren't smart enough or intellectually intimidating enough to excite me about the job. That's what you should do.

    The more you move, the more likely you are the stupidist person in the room, the more unsure you are that you know everything there is to know then the more likely you are to learn and keep up. That's not always in another job. Maybe it's in another team at work. Maybe it's outside work in a user group for a language or tool you have never used before. Be a sponge and also take something to the group. Everyone can add something to a situation.

    Soon enough, you'll be back in your comfort zone and you'll surprise yourself about what you know. At that point, shake it up and move again.

    Monday, 17 March 2008

    I, Consultant

    The Asimov 3 Laws of Consulting decided over dinner with Giles, Jason and myself are:

    1. A consultant must protect its own existence as long as such protection does not conflict with the Second or Third Law;
    2. A consultant may not injure a client or, through inaction, allow a client to come to harm;
    3. A consultant must write good code.
    Order matters.

    Thursday, 6 March 2008

    gmail Unread emails feed

    gmail lets you subscribe to your unread emails through this feed: http://mail.google.com/mail/feed/atom

    Unfortunately, because it is a secure feed that must be authenticated you can not use google reader to view items. Firefox can do it but it's far too painful to read. Netvibes can do it but that's pointless since it already has a widget that does it. Since I work at organisations that don't allow web mail access but usually do allow reader, it would be nice to be able to read new mail even if I can't respond to it.

    While google reads this page and it's propriety software analyses and understands me better than I do myself, can you please send a quick email to the reader guys and ask them to implement this already?! Until then, simply advertise netvibes and crackberry as alternatives.

    Speaking of the disturbing omniscient behaviour from the almighty big G - who in their right mind would sign up for google health? How much knowledge is too much to share with one enormous big brother like co-orporation. Don't do it! Next they'll want dental records and chips implanted.

    Acknowledge Me

    Apple started a user experience trend many iOSes ago when it accepted Settings changes and did not ask for confirmation. Once the chang...