/Images/MainImage/Marcus Hammarberg.jpg finns inte.

Sprint Planner Helper

2009-04-11 20:48

Sprint Planner Helper - Vaccation halt

I am going to Ethiopia for two weeks and the project comes to a natural (and needed) halt during that period.

I had hoped that I would have got further than this but I must stay content with what I've got.

The visit to Ethopia will be something very different and exciting. Especially with Albert who right now is 14 months and have just started to walk...

Get back to you on the trip at www.marcusoft.net


Postad av Marcus Hammarberg

Kommentarer (0)   Kategorier:  Sprint Planner Helper



2009-04-07 22:10

Sprint Planner Helper – Session 26

I have come to realize that I am not working… Not very flattering that I has taken me about 2,5 months to come to that conclusion but here I am.

So I will probably slow down the pace for this project. I have not done loads so far but I felt a bit pressured to “produce” and that not the kind of feeling I would like to have on my parental leave. So a bit slow – and still only when it’s fun!

OK – the thing today is to find aggregates and create repositories for the Sprint domain object.

When it’s comes to aggregates I still find them quite hard to grasp. The mainstream definition seems to be “things that must exists together” and the most common example is the Order-OrderLine relationship.

But for my Sprint I have a list of SprintItems each with a list of ActionItems. And if feels quite strange to get the complete thing each time I bring up a sprint. Feels to heavy. So I’ll start with the aggregate being the Sprint, Team and SprintItems and then another aggregate for SprintItem and ActionItems.

I am not sure that this is good DDD but I’ll start of like this. My modeling is done in PowerPoint, and if you follow my code (on this project @ CodePlex) you’ll find it in the modelling.pptx-file.

[PowerPointing in progress]

aggregates

OK – that was the thinking part. Now I need to add repositories for these aggregates. That is mostly inheritance and tests. Simple tests… :)

[Coding in progress]

Ok – that took some time. But now I have the tests in place and everything is dandy to get started on the UI for the sprint-part of my domain.


Postad av Marcus Hammarberg

Kommentarer (0)   Kategorier:  Sprint Planner Helper



2009-04-02 21:37

Sprint Planner Helper – Session 25

Today I will continue working on the model, surrounding Sprints, and of course drive it forward with tests.

I came to realize today that I am now converted. I am now a TDD-guy. I will do tests even if it’s not required of me. And the reason is security and speed.

I have gone from coding along with no worries – the tester will find (any) bugs for me… Then I heard of unit-testing and started to write some – just for fun in the start (yeah – pretty sick). After a while I didn’t dare to check in any code that I couldn’t prove with some test – but a wrote the code first. And after a while of doing that, I was so feed up with running behind with the tests that thought I’ll give true TDD a chance.

What I pretty soon came to realize is that not only was the code easier to test that way (doing the test first) – but I often spotted bad design and code even as I was writing the test. Before the code was even written, if you like.

That’s my reason for doing TDD.

OK – on to the code.

More test are written – more knowledge about the domain is acquired. I really like this way to get about the model.


Postad av Marcus Hammarberg

Kommentarer (0)   Kategorier:  TDD    Sprint Planner Helper



2009-03-30 21:25

Sprint Planner Helper – Session 24

My detour for learning ASP.NET MVC is coming to an end. I cannot say that I fully know the framework but I have a much better understanding of it now and that will hopefully help me keep the tempo up.

I have a few things left (such as editing product backlog items) surrounding the product. But I will leave them for later. I am so long back to the DDD that this project also is aiming to learn me.

The third item of my user stories is a biggie and it concerns Sprints – the main object of my domain model.

3. As user I can create a sprint that represent a sprint in which some items of the product backlog is to be realized.

The sprint has a goal description and a start, stop and demo-date and the team members with availability (in %), absent hours and focus factor (in %).

The sprint also contains a sprint backlog which initially contains a sprint backlog item for each product backlog item selected. 

The sprint backlog contains summarized values for total number of hours and story points.

I’ll start by making some simple tests to get to know the model. That’s probably what I have time for today

Unleash the code-fingers!

OK – I’m getting quite used to not managing the things that I think I will… I have now TDD’ed all the parts of an sprint (Team Members, Actions, SprintBacklogItems etc) – but not the actual SprintObject. I’ll get to that next.

Very good progress today. Doing TDD is such a good way to “get to know” your objects. I would love to do it in pairs in a real project – or even in a group to get the whole team to know the core of the domain object.


Postad av Marcus Hammarberg

Kommentarer (0)   Kategorier:  Sprint Planner Helper



2009-03-22 21:42

Sprint Planner Helper – Session 22

I have had some serious thoughts on what to do next in my project. On one hand I want to update the way I am doing the GUI for the product and product backlog. Right now I am warm and learning a lot about ASP.NET MVC so it feels quite good to continue there.

And on the other hand this is first and foremost a DDD-learning experience and I have got stuck for a while in the ASP.NET MVC trench.

And finally since I only have one hour a either way will take me on a detour from the other track. What to do?

After some serious consideration I decided to spend today’s session on a DDD-thingy that I ran into in the walkthrough. I want to implement the “IsValid and GetRuleValidations”-pattern. And include it in my BaseRepository Save-method.

That will be enough for today – I think.

[Coding with lots of simple tests takes place here]

Yeah – I liked that. Now I have a foundation for validation in place. I even added the validation rules for the Product, ProductOwner and ProductBacklogItem.

Good progress today.


Postad av Marcus Hammarberg

Kommentarer (0)   Kategorier:  Sprint Planner Helper



2009-03-20 22:04

Sprint Planner Helper – Session 21

I’m back! After doing a detour through the sample chapter of the upcoming ASP.NET MVC book (lovingly called “The four faces”, i heard…) I now feel ready to go on.

And I learned a few things by that sample chapter; about ASP.NET MVC, yes but also I saw some flaws of my DDD-ing, especially in the use of the Repository pattern.

The main thing is that I have a separate Update-method that feels a bit strange. Another thing I learned and finally understood was the IQueryable-interface.

By using it you can defer the execution of the actual database query until the client calls. Which means that the query will be fine tuned with all the parameters that the client has includes (such as Take, Sort etc.). (For a much better explanation see this.)

So I’ll update my IRepository to something like this:

    public interface IRepository<T>  where T :IBaseEntity

    {

        T GetById(int id);

        IQueryable<T> Find();

        void Add(T entity);

        void Delete(T entity);

        void Save();

    }

And then I’ll face the consequences of that… I expect loads of tests and code to fix.

[Coding, coding, coding…]

The first thing I needed to do was to move the fakes from the Repository-project into the Test-project where they belong (again a tip from the sample chapter). OK – that made me re-invent the InMemory-Repository. But when I was done the code quality was much better. Clean code!

But I also feel that I might ditch the InMemory solution altogether and go to a database-solution… It starts to feel quite strange…

Then the connection to CodePlex was lost… Took about ten minutes to restart…

With my new repository I also introduced a pattern, called Unit Of Work. Its from Fowlers book Patterns of Enterprise Architecture, which on my bedside table. In this example is basically means that I need to be sure to call the Save-method of the IRepository-interface after each add or delete.

Finally I once again got the opportunity to praise TDD. Did refactoring for about 50 minutes with minor changes all over the place. Ran the tests… 5 failing. Corrected them in 5 minutes! Show me that without any test and I will be very impressed.

Next session will start to implement some “implementation patterns” from the sample chapter, such as the Details-views, the two-phase Delete etc.


Postad av Marcus Hammarberg

Kommentarer (2)   Kategorier:  Sprint Planner Helper



2009-03-13 20:35

Sprint Planner Helper – Session 20

Today I plan to finish up the last part of the prioritizing of Product Backlog Items (see Session 19). That is TDD the controller and then wrap the GUI.

Let’s go!

Whooa – I ran into some problems with routing. Some problems that took me about two sessions (read: hours) to solve. To not to bore you with details or meaningless posts on me scratching my head, I’ll sum it up in this post.

Here is the layout of the “problem"; I have an Action-method with two parameters:

public ActionResult PrioUp(int productID, int productBacklogItemID)

OK – but how do I create a link to that method? Well by using the Html-helper ActionLink-method of course. You define an anonymous object with the route values. Here is my example:

Html.ActionLink("Prio up""PrioUp", "ProductBacklogItem", new {productID = Model.ID, productBacklogItemID = item.ID}, null);

OK – but here comes the problems. I have no routing-table entry for sending two parameters. And here I was hanging around, trying stuff out, screaming loud, hammering the keyboard. I just don’t get the routing-stuff yet…

So finally I added this routing-table entry, first of the entries:

            // http://localhost/ProductBacklogItem/PrioUp/productId/productBacklogItemID

            // http://localhost/ProductBacklogItem/PrioUp/1001/2

            routes.MapRoute(

                "ProductBacklogPrio",                                       // Name

                "{controller}/{action}/{productId}/{productBacklogItemID}", // Url with parameters

                new {controller = "ProductBacklogItem"},                    // Parameter defaults

                new { productId = @"\d+", productBacklogItemID = @"\d+" }

            );

That worked! I cannot say that I fully understand why since I thought that I tried it… but naming issues and not concentrating well enough.

A few things to note:

  • It has been very helpful to specify an example on how I wanted the URL to look.
  • I had to specify the full URL ({controller}/{action}/{productId}/{productBacklogItemID} to get it to work
  • I skipped default values for productID and productBacklogItemID since that make no sense
  • The final row is a constaint that states that productID and productBacklogItemID should be numeric

These problems and a tip from Christer made me decide to pause this project for a while. There is a new book on ASP.NET MVC coming out soon which contain a tutorial chapter that looks very nice. You can download it here.

I will run through that chapter and hope that it wont take me to long and also that I’ll learn a lot of stuff that come in handy in the Sprint Planner Helper project.

In fact (and this is a secret) I love doing these walkthroughs – feels like I know something very well…

Alright – but now I have a way to prioritize product backlog items up and and down.

See ya in a while.


Postad av Marcus Hammarberg

Kommentarer (0)   Kategorier:  Sprint Planner Helper



2009-03-10 10:00

Sprint Planner Helper – Session 19

After my refactoring yesterday the function that re-prioritize product backlog items was reduced to swapping priority points on two items.

So that’s what I’ll do today. TDD through a function that swap priority points for an product backlog item and the item before (prioritize up) of after (prioritize down) it.

[Coding in progress]

That really was an old-time programming problem. Fun! But now I have TDD’ed a priority swap algorithm. That was all I managed to get through today. Some progress I think.

Now all that is left is to reach this functionality from the GUI and reload the list after it’s done


Postad av Marcus Hammarberg

Kommentarer (0)   Kategorier:  TDD    Sprint Planner Helper



2009-03-08 22:48

Sprint Planner Helper – Session 18

I haven’t done to much on the Sprint Planner Helper project during this week. A lot of Salvation Army activities has taken up my time.

But I have read the blog post (in form of a PDF-book) from DDD Step By Step. I have read much of it before but sometimes other word clear things up for you. This book did it for me.

OK – what to do tonight (Abbe is sound asleep and Elin has gone to work). I have most of the stuff from my first two user stories in place. But I need a way to easy move product backlog item up and down in the list. This will come in handy when the product backlog items are estimated.

So I’ll introduce some methods to move the in the product backlog list. And some arrows in the GUI for the list.

Let’s write some lovely simple tests and see where it takes me.

[tap, tap, tap… Marcus is typing]

Oh my good – this was really to open a can of worms. I have to rework the product backlog class from a List<ProductBacklogItem> to class of it’s own. This is also to follow Extreme OOP rule #8 – Use first-class collections, so it feel quite alright.
Took me about 40 minutes to figure out though, my tests broke down…

The solution was quite simple. After I had reworked the ProductBacklog to not inherit List<ProductBacklogItem> I created a property that return the list in sorted order. The sorting was taken care of with this simple LINQ-statment:

public List<ProductBacklogItem> ProductBacklogItems

        {

get

            {

var listToReturn = from item in productBacklogItems

orderby item.Priority

select item;

return listToReturn.ToList();

            }

        }

After adding an AddProductBacklogItem-method I was back on track with all green lights…

I was then at the edge of blowing my 1 hour rule. So I stopped. Tomorrow I’ll get back to my reprioritizing of item.


Postad av Marcus Hammarberg

Kommentarer (0)   Kategorier:  Sprint Planner Helper



2009-03-03 22:03

Sprint Planner Helper – a DDD learning experience

Since about a month I am on parental leave (föräldraledig in Swedish, not sure on the translation) and I am loving it.

However when I left for that leave it was a lot of things that caught my attention, such as doing TDD for real, DDD and ASP.NET MVC, and I felt that I needed to do something that had with my profession to do…

So I pondered that for a while and came up with a project that could keep me busy on a comfortable level (have fun, max 1h/day or 5 a week are my rules). The project name was Sprint Planner Helper

I have been blogging about this on my private blog, www.marcusoft.net , but have now decided to post to the Avega-blog also. To not go into post-mania and repost all my current posts here, you get a link list instead:

Oh my God – I hope no-one reads all of them at once…


Postad av Marcus Hammarberg

Kommentarer (0)   Kategorier:  TDD    Sprint Planner Helper    DDD

  RSS Feed

Marcus Hammarberg

I am a consultant with Avega working with Microsoft, .NET, system design and agile system development. When i am not working most of my time is taken up by the Salvation Army and playing my instrument, the euphonium. I am married to Elin since july 2006 and we are living in the middle of Stockholm.. In january 2008 our son Albert was born and have taken a prominent place in our hearts and lives.


Kontakt