Monthly Archives: May 2012

What is wrong with Enum.ToString()?

This morning, while we where working on the creation of Key/Value pair table containing different kind of entities one of my senior team meber ran into an “Exotic” behavior. The key of our table is a string build on the composition of the entity Id and the entity type. The entity type is simply an enum value converted to a string. This looked like this:

_ToString = string.Format(“[{0}/{1}]”, id, contactType.ToString());

contact type is here the enum variable. Nothing really fancy or complicate untill we ran the performance monitor on it.

We saw that this line, according to its simplicity was taken too much time to  process.

We have to perform this operation for millions of records and every millisecond counts.

At first sight I though it was the string.Format() that was taking all the processing and we tried a quick optimization.

_ToString = “[” +  id + “/” + contactType.ToString() + “]”;

Same result. I had to face it, the ToString() of the enum variable was taking most of the processing.

The number of entries in enum being short, we tried the following code

switch (contactType)

{

    case ContactTypeEnum.Undefined:

        _ToString = “[” + id + “/Undefined]”;

        break;

    case ContactTypeEnum.Organisation:

        _ToString = “[” + id + “/Organisation]”;

        break;

    case ContactTypeEnum.NaturalPerson:

        _ToString = “[” + id + “/NaturalPerson]”;

        break;

    case ContactTypeEnum.OrganisationContact:

        _ToString = “[” + id + “/OrganisationContact]”;

        break;

    default:

        throw new ArgumentOutOfRangeException(“contactType”);

}

The difference was impressive. This long piece of code is almost 8 time faster.

The following image gives the performance numbers of each of the code block.

 

 

Enterprise, System, Software, Application, Technical Architect, what is my role?

Enterprise, System, Software, Application Architect, just pick one.

I’ve been on assignment building a strong commercial relationship with my current customer for several years now. Interesting projects, nice environment, smart and fun colleagues, everything is available for me to stay happy and work there ever after… but… Well, I am starting to have the need to meet new people and face new challenges. Of course I do not want to jeopardize my relation with my current customer, but I need to evolve. I need to get out of my comfort zone and start something fresh.

This is why I have decided to update my resume and to investigate different opportunities that could be available on the IT market.  First think first. What am I? What is my role? On my current assignment I ‘m called a “Technical Architect”. Yeah!!… but what does it means… This title is not available anywhere else. I checked on IEEE, Wikipedia, googled about it… there is no Technical Architect Role definition or at least I could not find one…

As a “Technical Architect” what are my duties:

Team coordination: Coordinate is not really the term. Lead and coach seems more appropriate. I guide the team on the activities we should conduct in order to deliver and act as scrum master.  I advice the project manager on what is achievable and what is not and if I feel a potential risk on the project.

Functional analysis: I do not conduct the functional analysis but I review it. I did it on the past but in Belgium you need to speak both national language to work on this area and unfortunately, I don’t. review the functional analysis for consistency and feasibility. I challenge the content as well. I will probably not let build a space ship to cross the street.

Technical Design and Architecture: I have an analytical mind. I like to conceptualize and modelize stuff. I enjoy putting structure and explain difficult concept. If I manage to make myself understood then I can say I really have understood what I was talking about. This is probably the activity I’m better at.

Development:  I love to code and unfortunately this is something I do not do enough. I’m told to be not to bad  at that and In order to stay up to date I try to do my TDD Kata at least three or four times a week. I have a pluralsight subscription and I complete at least one training every two week. This is a must have for any developer. I try to stay sharp or Csharp to be precise and pluralsight is a good way for this..

Coaching: This is also something I like to do. I like to share knowledge. On my current assignment I try to do this on a daily basis. I launch topics I read about. I advice on training people should follow. I share my tips I tricks and I try to understand what the others are doing. If I manage to bring the level of expertise of the team I’m working with to a higher level of expertise then this is already a success for the project.

Day to day management and client facing: I’m also organizing the deliveries and the operational hand over. Coordinating the testing and the delivering is also part of my duties.

I perform other activities but those are most probably the most frequent ones.

Now let see what title I can find to match those duties. l find on Wikipedia the following definitions:

Enterprise architect: handles the interaction between the business and IT sides of an organization and is principally involved with determining the AS-IS and TO-BE states from a business and IT process perspective.

Solution Architect: The Solutions Architect is responsible for the development of the overall vision that underlies the projected solution and transforms that vision through execution into the solution. Solution Architects in large organizations often act as the bridge between Enterprise Architects and Application Architects.

Application Architect: An application architect works with a single software application. This may be a full- or a part-time role. The application architect is almost always an active software developer.

The following tables indicates many of their differences

Architect Type Strategic Thinking System Interactions Communication Design
Enterprise Architect Across Projects Highly Abstracted Across Organization Minimal, High Level
Solution Architect Focused on solution Very Detailed Multiple Teams Detailed
Application Architect Component re-use, maintainability Centered on single Application Single Project Very Detailed

According to those definitions and tables, I must probably seat somewhere between the Solution architect and the application architect but closer to this last one.