Author Archive

LEAN -Software Development in Small Teams - Part 2 – KanBan Board v1 - v2

In the first part of this journey I posted about two value stream maps we created. The next step after doing Value Stream Maps of our two primary processes was setting up our KanBan board. I would first like to explain some of the thought we put into setting up our KanBan board. During our discussion on KanBan in Small Teams Dave said to not over complicate your KanBan board, and I agree. Especially for smaller teams there is no need to have a 15 state KanBan board. So what Hiren and I cam up with is shown below:

KanBan-BoardV1

What we have is 3 states for a task to be in: Backlog, Work In Process (WIP) and Done. I think there are several important parts to our KanBan board:

  1. Limits– Notice there are limits on the first two columns (Done is a feel good state, no limit), this is to create blocks when necessary and to prevent a state from filling up with a pile of inventory as is possible with other methodologies. The limits are in place to effectively block processes up stream from piling up. When a state is blocked no other work can be performed in that state.
  2. WIP has two tracks – We are a small company so we are developers and IT guys both so we decided we should leave a spot open in WIP for an IT task. I am thinking about making it so that if a Red IT task is in the slot then that “Stops the Line”, a Red task would be an emergency or super high priority that was really preventing any other work from being done.
    1. I decided to keep the WIP limit at 2 thinking that we won’t have an item in IT very often and if we do someone is probably not working on a Dev item anyway.
  3. Standard word definitions / Constraints – Below the bottom horizontal line is where we list the standard work definition or other constraints that are associated with each state.

So this board is setup and we were just about ready to start using it when I started watching the video from the open spaces session Chad uploaded on viddler, see KaizenConf Article. When I got to the point we were talking about laying out boards I realized I had forgotten a column. So we will call the board above v1 and the one below v2.

KanBan-BoardV2

In version 2 we have added a column between WIP and Done called Deploy. My thought behind this was that we don’t do release per feature, yet, and we also don’t have a set release schedule but what I want to do is release features in batches of about 3. So the standard work definition for deploy is if there are 3 or more tasks/features in this state then we should schedule a release. I don’t have it in the picture but I am going to have a limit of 5 or 6 on this state.

We are going to run with this KanBan board for a week or two and see if we need to make further improvements on it in that time. If we do I will post them up here, if not then I might make the lines a bit more permanent so they are straight.

Next up I am going to discuss the layout of our KanBan cards.

KaizenConf Wrap

I know this is a little late and somewhat out of order but I really feel compelled to write a public thank you note to all of the facilitators and attendees at the pre-conference workshops and the KaizenConf open spaces conference. I have made a boat load of new friends in the ALT.Net community that I know will be long lasting and very fruitful. The 4 day conference was by far the best conference I have ever been to. I came with so many questions got some answers and left with even more questions. It was very humbling to be surrounded by a lot of smart people, at the same time it is also very encouraging because these people are all very nice, friendly and real.

 

Workshops

The workshops that were put on were outstanding. I personally attended the Advanced NHibernate talk which was very helpful, you can see my notes here. I also went to the DDD Chalk Talk on Thursday afternoon, this was a very good talk about different aspects of Domain Driven Development. Friday started off with Jeremy and Chad’s Opinionated ASP.Net session and followed up with Dave’s Pull Don’t Push - Lean Systems and KanBan. All of these sessions were great. I have linked to what information is available now, and will link more as I find it.

 

Open Spaces

Friday night we “Opened” the space and one of the topics I suggested is Lean software engineering / KanBan with a small team. I didn’t know if anybody would vote for my topic or not but low and behold they did. So at my first open spaces event, I was also the convener of a space. This was a little bit intimidating at first but I handled it very similar to the way I do my college classes, we just all talked. Special thanks to Dave Laribee, Chad Myers, Chris Bilson and others that I don’t know your names, for being so involved and speaking during this session.

 

I spent time in some other very good sessions such as KanBan Applications, and Concurrent Set Based Software Engineering. There were so many good topics that I can’t even remember what all they were,  but there is a full list on the wiki.

 

As an action item on Sunday with KanBan in Small Teams I committed to documenting my teams implementation of the Lean Methodology with a KanBan task board.

 

In conclusion, Thank You again to all the great people in the Alt.Net community that came together in Austin to make this a very memorable event.

LEAN -Software Development in Small Teams - Part 1 – Value Stream Mapping

As promised at KaizenConf in Austin I am going to document our implementation of Lean Software Development as we go through the process of eliminating waste and creating a flow or pipeline process. We are in a unique situation as the rest of the organization is already following a LEAN approach for the most part due to the fact we are a Lean Manufacturer. So upon our return today we have gotten some guidance from internal “Lean Experts” and have started the process. The very first thing we did is two Value Stream Maps (VSM), this has helped us identify a couple of things already in the short amount of time it took to create them.

Value Stream Maps

I am going to first show the VSM’s and explain them a bit, then I will share some lessons learned already. Since we are a small company the IT department and Software Development department are one in the same, as in we do both. This means I need to have some value stream maps for both areas of concern. The VSM’s we created today are based on an average for each area. As we start and complete work in these areas I will create more VSM’s so that I have a better understanding of just where our waste and value times are and what happens in each. The way I like to create my value stream maps is that a box represents Value Add and a line represents no value add. Each box or line is then given an amount of time that a request/feature stays in that area.

Software Feature VSM

SW-Feature-VSM1

This is the VSM for a feature request in our company and it flows like this:

  1. Customer Request comes in, usually via phone or email
  2. Request enters To-Do List
  3. Feature undergoes Design and Analysis
  4. Feature enters Backlog
  5. Development/Testing is done
  6. Feature waits on customer approval
  7. Dev/Test any fixes
  8. Demo the feature with Customer
  9. Release feature
  10. Done Done

IT Request VSM

IT-VSM1

This is the VSM for an IT Request in our company and it flows like this:

  1. Customer request comes in, usually via phone or email
  2. Request then undergoes a quick Severity Check to determine how critical it is
    1. This gets a little interesting now as the path splits into two different paths, one for low or regular priority and one for high priority. The only thin different is the amount of time spent in each area.
  3. Request enters To-Do list
  4. Request is analyzed
  5. Request gets worked on (WIP)
  6. Request is complete.

 

Just creating these two value stream maps has identified a few errors that need to be worked on. The first area is Customer request, we need to create a standard way to handle requests. This should also put more responsibility on the customer than just accepting, “I need you guys to make X”. Second thing is that the VSM for a software feature is really just a guesstimated average right now. We have to work very hard to create like sized items to go on the KanBan board, which I will post about in a bit.

I have also lost my virginity (and you should too)

UPDATE: I have lost my virginity in regards to attending my first software conference, just in case that wasn’t clear… you know who I am talking to.

I just read Brian Mavity’s latest post and am obviously rowing the same proverbial boat that he is. This is not only my first software development conference but the first software development conference our company has ever sent anybody to. I personally have already taken more away from this than I ever imagined. Just sitting around at dinner or socializing with the same people whose blogs I follow is somewhat intimidating, but they are all very welcoming and want to help us new guys get going. I have had conversations (okay, mostly absorbing) with Ayende, Chad Myers, and Jeremy Miller. I have also been able to speak one on one with others and will most definitely get the opportunity to do some more.

Same as Brian Mavity, if you your company does not care enough about their development team to spare a little time and money to get you involved, you should consider finding a place that does or making your voice heard better to accomplish this.

I am really looking forward to the next few days worth of activities.

KaizenConf Workshops – Advanced NHibernate

As some of you know I am attending KaizenConf for the next few days. I am going to use my blog as my notepad as I take notes during different workshops and sessions. My note taking skills sometimes have a lot to be desired so be patient if these notes look very sketchy. I will try my best to come back through and make sense of them later.

Advanced NHibernate

I am currently sitting through Ayende’s workshop on Advanced NHibernate and there is some really good stuff going on here. Three of the topics I have found most interesting is Multi-Tenancy, Full text indexing with NHibernate Search, and caching with NHibernate. NHibernate search is a project that combines Lucene, a proven java index tool, and NHibernate to alleviate strain on the database engine by keeping indexes on disk and performing queries on that data faster. Indexing is accomplished by decorating entities with attributes. Of all these topics caching with NHibernate has really grabbed my attention as it probably has the greatest results for the applications I am currently working.

Caching with NHibernate

1st Level cache –Contains Identity Map – Session – Single instance of an object in a particular session

2nd Level Cache – contains the SessionFactory – lives for the entire application lifetime, it also has 4 levels of cache within it:

timestamp
query cache
collection cache
entity cache

 

Caching Configuration

Enable query cache <property name=”cache.use_second_level_cache”>True</property> in NHConfig – A single on off switch in the application to enable/disable caching is not a good solution because caching is complex and could affect business rules and performance. So you have to enable caching for a specific entity by using Cache_usage = CacheMode (ReadWrite for Ayende’s samples) in the entity mapping file. The NHibernate cache hashtables are stored like below:

Entities Cache:
————————-
Blog#1 : { Name: “…”}
Post#1 : {…}
Post#2 {…}

Collection Cache
—————————
Blog#1.Posts { 1,2,3,4,5,6} – stores id’s only

Query Cache:
—————————
“select top 5 * from Post” : {1,2,3,4} // stores id’s only

Ayende used his blog sample for all of the code examples today. When he put caching on the Blog, and the collection of posts in the blog map and on the post entity the fewest calls to the database occurred. To enable query caching the property cache.use_query_cache = true in the config file.

Session.Load vs Session.Get

Load == I know the entity exists in the database, it returns a proxy to the object. Throws an exception if the object is not lazy loaded and cannot be found.

Get == NH really goes to the database and fetches a row or throws an exception if it does not exist.

Which one of these to use depends on the business rule for the entity.

 

NHibernate Contrib project descriptions

NHibernate cache libraries:

PrevelanceCache – persistent caching for smart client applications

SysCache – using ASP.net caching – gives it the ability to put things in the cache and forget about it – only works if you have one machine.  Other wise you get cache poisoning.

SysCache2 – ASP.net caching in the farm – maybe application is not the only thing that updates the database. This is good when the application is not the sole owner of the database.

MemCache – a distributed hashtable, thats it basically it is distributed caching.– Server sitting on TCP with a hashtable – the Client caches the key and always goes back to same server in farm for cache retrieval. Very simple, works very well. This is also known as MemCacheD and is the same caching strategy that Facebook uses.

SharedCache – SharedCache from CodePlex

Velocity – From Microsoft – more complex than memcache, more options but they validate the cache space you have.

 

Other NHibernate Contrib Projects

NHibernate.Linq – pretty good, handles most of the common scenarios, does not handle the crazy scenarios that are capable in LINQ. Currently working on a fully functional LINQ library.

NHibernate.Validator– Just as you can specify constraints in SQL Server. You can specify constraints in your mapping file and the validator will validate that for you.

Spatial – GIS applications

Shards – partition the data across multiple db’s – written by Google to deal with problem of having multiple database. You can teach NHibernate a sharding strategy so that it knows which database to use. This is a strategy that is used by companies such as Facebook.

 

Another very interesting topic Ayende talked about is self optimizing queries. This would be used by session.Future<TYPE>() you could use this in your repositories on all lists/CreateCriteria methods. This creates a MultiCriteria which returns multiple result sets in one database trip. This is very similar/exactly like multiple result sets in stored procedures.

IRepository Code

This is by request from Frank Mao, he was wanting me to post up the code I am using for IRepository<T> so here it is:


public interface IRepository<T>
{
//IList<T> FetchList();
ICriteria CreateCriteria();
T Get(object id);
void Load(T obj, object id);
void Delete(T entity);

void DeleteAll();
void DeleteAll(DetachedCriteria where);
T Save(T entity);
T SaveOrUpdate(T entity);
T SaveOrUpdateCopy(T entity);
void Update(T entity);
long Count(DetachedCriteria criteria);
long Count();
bool Exists(DetachedCriteria criteria);
bool Exists();
IList<T> FindAll(DetachedCriteria criteria, params Order[] orders);
IList<T> FindAll(Order order, params ICriterion[] criteria);
IList<T> FindAll(Order[] orders, params ICriterion[] criteria);
T FindFirst(params Order[] orders);
T FindFirst(DetachedCriteria criteria, params Order[] orders);
T FindOne(params ICriterion[] criteria);
T FindOne(DetachedCriteria criteria);

ProjT ReportOne<ProjT>(ProjectionList projectionList);
ProjT ReportOne<ProjT>(DetachedCriteria criteria, ProjectionList projectionList);
IList<ProjT> ReportAll<ProjT>(ProjectionList projectionList);
IList<ProjT> ReportAll<ProjT>(bool distinctResults, ProjectionList projectionList);
IList<ProjT> ReportAll<ProjT>(ProjectionList projectionList, params Order[] orders);
IList<ProjT> ReportAll<ProjT>(bool distinctResults, ProjectionList projectionList, params Order[] orders);
IList<ProjT> ReportAll<ProjT>(DetachedCriteria criteria, ProjectionList projectionList, params Order[] orders);
IList<ProjT> ReportAll<ProjT>(bool distinctResults, DetachedCriteria criteria, ProjectionList projectionList, params Order[] orders);
}
}

I should note that this is a slightly modified version of IRepository that I got from the UnitOfWork tutorial code that is posted here: http://hibernatingrhinos.googlecode.com/svn/trunk/UnitOfWork/src/NHibernateRepository/

Csla Project Tracker + ObjectFactory + Altdotnet = Goodness

I will start off by giving my regular disclaimer, I am not an expert on this, however, I am also not an idiot either.

 

How It Was

 

We have been using Csla as a business object framework for about 3 years now and have had good results with it. That and we like things to just work and it does. Now a few months ago we started to get introduced to the altdotnet way and have seen the light and the need for many of the principles of altdotnet in our organization, it just makes sense. A few weeks ago Rhockford Lhotka release the beta version of Csla 3.6 and with it he has introduced support for an extensible ObjectFactory. This custom ObjectFactory takes the place of the DataPortal_XYZ() methods in the business object.

 

Now with the old way I had to make an object and write at least 3 lines of data access code for every property. This is cumbersome and just plain stinks. But good news! There is a better way.

 

The Better Way

 

So with this new ObjectFactory in Csla I can now spread some altdotnet goodness into my Csla projects. To be more specific here is what I have done, this has increased the dependencies of the project but has made the code much more flexible and easier to test.

Hopefully this little overview has intrigued you enough to go download the source code for the Csla sample redone with an ObjectFactory implementation. The source code and zip file are available at http://code.google.com/p/cslaptrackerfactory/ I will update the repository as I make changes/ additions to the code. I have created this as an open source project because I know that my method is not the only method and hopefully we can collectively come up with a way to use Csla with altdotnet goodies in a more standard way. So with that said, if you want to join the project, drop me a line.

 

I will post more articles that go in depth on how/why I did things a certain way in this project later, I hopw.

ALT.NET a College Curriculum?

There has been a lot of discussion recently on the ALT.NET list about how the ALT.NET way is so hard and complicated that it may be equivalent to a college computer science curriculum. This all started as a discussion that was geared towards building some type of cascading curriculum guide to ALT.NET software engineering principles such as TDD, S.O.L.I.D, continuous integration, unit testing, composition over inheritance, etc… I agree with this totally, We need to make some type of curriculum guide to ALT.NET principles. I am fairly new to ALT.NET and I am also fairly young. Where I work there are only two developers and we are also testers/designers/everything so when we decided that we could write better software by following the ALT.NET principles we had a hard time finding a starting place amongst all the available information. It is simply overwhelming when you are first starting, and I know we have been talking about easing the entrance barrier, but it’s just not that easy. There has to be some difficulty or is the reward is not as great in the end. However, I do believe that some type of curriculum guide would be a great tool for everyone involved with ALT.NET at any level. I think the best thing about this chart is just to show how the different principles build on each other and relate to each other so you have a reference point you can find yourself on.

Now back to the discussion on Computer Science (CS) curriculum in colleges, I graduated from a small college in Oklahoma with a degree in CS a few years ago. I personally gained a lot from college because I had a professor who had previously worked in the real world, and I worked in the real world developing software while in college so we could have intelligent conversations that only a few other students understood. This was great for me, a self motivator, but not for everybody else. I was able to demand the one on one time that I needed and to ask questions and have problems that forced the “super” students into thinking about problems other than writing a counter in a nested loop. I have now been asked to teach some software courses at the college and help, along with other alumni to revamp the curriculum that is taught in the school. In January I will begin teaching two semesters worth of ALT.NET curriculum. This will be a huge leap ahead for the students, but also for the faculty as I feel so much college faculty is out of touch with the real world anyway.

Ultimately though I think what college is really designed to do is teach students HOW to think and HOW to learn since a college cannot be expected to keep up with all the latest and greatest trends in Software engineering but it can teach students some higher level principles such as ALT.NET or at least get them started down the right path to learning ALT.NET.

SQL Server Timestamp field and Fluent-NHibernate

This morning I was trying to do a Version mapping with Fluent-NHibernate on a timestamp column in a SQL database, this didn’t work so good right out of the box so I dug around and found some information here and there and once I pieced it together it all worked.

First off the mapping:


public class ProjectMap : ClassMap<Project>, IMapGenerator
{
        public ProjectMap()
        {
            WithTable("Projects");

            Id(x => x.Id)
                .GeneratedBy
                .GuidComb()
                .WithUnsavedValue("00000000-0000-0000-0000-000000000000");

            Map(x => x.Name)
                .WithLengthOf(50)
                .CanNotBeNull();

            Map(x => x.Started);
            Map(x => x.Ended);
            Map(x => x.Description);

            Version(x => x.TimeStamp)
                .TheColumnNameIs("LastChanged");
          }

}

public override VersionPart Version(System.Linq.Expressions.Expression<Func<ProjectResource, object>> expression)
{
     var versionPart = new VersionPart(ReflectionHelper.GetProperty(expression));

     versionPart.SetAttribute("type", "ProjectTracker.Library.Mapping.UserTypeTimestamp, ProjectTracker.Library");
     versionPart.SetAttribute("generated", "always");
     versionPart.SetAttribute("unsaved-value", "null");

     AddPart(versionPart);
     return versionPart;
}
 

The main thing here is the overridden Version method. What this override is doing is setting up a few attributes required to make this all work properly, I think most of them are self explanetory. Inside this method is a set attribute method that sets the type of the timestamp to UserTypeTimestamp. The coded for this class follows below:

UserTypeTimestamp Class:


public class UserTypeTimestamp : IUserVersionType
    {
        #region IUserVersionType Members

        public object Next(object current, ISessionImplementor session)
        {
            return current;
        }

        public object Seed(ISessionImplementor session)
        {
            return new byte[8];
        }

        public object Assemble(object cached, object owner)
        {
            return DeepCopy(cached);
        }

        public object DeepCopy(object value)
        {
            return value;
        }

        public object Disassemble(object value)
        {
            return DeepCopy(value);
        }

        public int GetHashCode(object x)
        {
            return x.GetHashCode();
        }

        public bool IsMutable
        {
            get { return false; }
        }

        public object NullSafeGet(IDataReader rs, string[] names, object owner)
        {
            return rs.GetValue(rs.GetOrdinal(names[0]));
        }

        public void NullSafeSet(IDbCommand cmd, object value, int index)
        {
            NHibernateUtil.Binary.NullSafeSet(cmd, value, index);
        }

        public object Replace(object original, object target, object owner)
        {
            return original;
        }

        public System.Type ReturnedType
        {
            get { return typeof(byte[]); }
        }

        public SqlType[] SqlTypes
        {
            get { return new SqlType[] { new SqlType(DbType.Binary) }; }
        }

        public int Compare(object x, object y)
        {
            byte[] xbytes = (byte[])x;
            byte[] ybytes = (byte[])y;
            if (xbytes.Length < ybytes.Length)
            {
                return -1;
            }
            if (xbytes.Length > ybytes.Length)
            {
                return 1;
            }
            for (int i = 0; i < xbytes.Length; i++)
            {
                if (xbytes[i] < ybytes[i])
                {
                    return -1;
                }
                if (xbytes[i] > ybytes[i])
                {
                    return 1;
                }
            }
            return 0;
        }

        bool IUserType.Equals(object x, object y)
        {
            return (x == y);
        }

        #endregion
    }

Now for the Business object change this:

private byte[] timeStamp = new byte[];

To this:


private byte[] timeStamp;
internal byte[] TimeStamp
{
     get { return timeStamp; }
     set { timeStamp = value;}
}

With the addition of the class and an internal Property so NHibernate can access the data in the timestamp everything works pefectly to implement optimistic concurrency with Fluent-NHibernate and SQL Server timestamp fields.

CSLA 3.6: Object Factory intro

We have been working the past few days on getting the new ObjectFactory up and running with CSLA 3.6. The approach we are taking is that we really want to abstract the Data Access Layer away from the Business Object so that we have some flexibility in the future to change the way we access the database. At the current time we are planning on using NHibernate as our ORM tool, one especially nice feature is that it is able to load your objects automatically so no more LoadProperty(SomeProperty) or ReadProperty(SomProperty) a million times. This one thing alone makes this very appealing to me.

 
  clip_image002

This diagram above is a representation of the basic architecture of the system. What we are basically doing is using the Repository pattern to keep data access decoupled from the business object through the use of the ObjectFactory and StructureMap. This is a setup very similar to what Frank is using in his project. However we are not using DTO objects in between the Repository and the business object. We might change this later but for now we will let the ORM load the objects directly.

I am currently working on implementing the ProjectTracker from the CSLA examples. My goal with this is to accomplish several things:

  1. Learn the ins and outs of the ObjectFactory and how it works with StructureMap, NHibernate, Mock Objects, TDD, etc..
  2. Provide a working drop in replacement to the “stock” ProjectTracker.Library, there shouldn’t be any changes required to the UI or anywhere else.
  3. Provide the source code so others can learn from what has been done and make contributions to make it work better or smoother and have it provide a model for people to base their frameworks off of.

So stay tuned because I will be adding more information here as I get closer, should be real soon. I will probably setup the source code on Google code or codeplex, if I do that let me know if you want to make contributions to the project.

« Previous PageNext Page »