TDD & BDD

I received a comment on my blog yesterday from Chris Corcino. Chris pointed out that he has a hard time to get started with TDD and BDD with Sitecore. Basically it’s nearly impossible to emulate the ASP.NET HttpContext. And this makes it impossible to do some additional mocking. As Sitecore is really designed around the HttpContext, it’s not so easy to create you own IServiceProvider implementation. Actually Microsoft confirms this problems otherwise they wouldn’t have to bring the MVC model as a replacement for the Control model.
I’m not sure if I satisfy you completely with one of the following answers, but these 2 options might be valuable for you to do at least soem testing:

  1. Internally we use a mix of tools to do some intensive testing of for example our Security Model. I know the R&D team uses a trick to emulate the HttpContext: start it regular using the Web tester built-into Visual Studio Team System – Test Edition. Then you can run your tests from Visual Studio.
  2. Another option would be to use the DomainObjects module created by Mark Cassidy. This allows you to create a Domain layer. As this layer is basically the one you want to test, you might be able to replace the ‘Sitecore connectors’ of the module with some mock objects.

Hopefully this helped. Feel free to submit your comments.

Bug in .NET 3.5 SP1

We’ve sent out this message today after some heavy investigation:

Dear Sitecore Enthusiast,

You are receiving this message because you are subscribed to the Sitecore Product Issues and Patches mailing list.

On Monday, August 4th, Microsoft released the following service packs: Visual Studio 2008 SP1 and .NET 3.5 SP1.

Sitecore has discovered that these service packs introduce a bug in the LosFormatter class (System.Web.UI.LosFormatter in System.Web.dll, used to serialize and deserialize an ASP.NET ViewState). This bug causes stability issues in Sitecore products. Sitecore has raised this as an urgent priority issue with Microsoft (case number : SRQ080813600454) and is working to help resolve this issue.

In the meantime, PLEASE DO NOT INSTALL .NET 3.5 SP1 and Visual Studio 2008 SP1 on any server running a Sitecore product (including Sitecore WCMS, Intranet Portal, and Foundry) until further notice!

Symptoms associated with installing either of these service packs:

  1. Memory consumption increases dramatically and single core CPU usage goes up to 100% when opening the Access Viewer or Media Library applications.
  2. OutOfMemoryExceptions thrown in the Desktop and Content Editor.
  3. The browser becomes unresponsive when accessing Sitecore.

Please be aware that Microsoft  may include this Service Pack as part of the monthly ‘Patch Tuesday’.  Please take steps to avoid the automatic installation of these service packs.

Please be aware that the final version of SQL Server 2008 will require .NET 3.5 SP1.

If you have any questions about this issue, please contact Sitecore support.

Best Regards,
Sitecore Support Team.

Our next step is to help you guys out who’ve already installed the SP1. When you remove it, it doesn’t seems to resolve the issue. Once again experience would be highly appreciated. Feel free to contact me using adg(at)some-sitecore-domain.net or create a support ticket.

As Microsoft is working with us on the issue, we expect to come up with a solution soon.

A nice thing to notice is that someone in the community already picked up the message.

Something around Visual Studio / .NET 3.5 SP1?!

This is not official… but we’re investigating some issues with Sitecore and latest service pack. It seems like there’s an issue related to SQL Server.
As we’re in progress of testing everything as it might be our internal computer configs. I’m not able to tell you anything except:

There’s an issue related to the access viewer and creating thumbs in the media library. It seems like that every time Sitecore is accessing the database directly,the following issues occur:

  • Memory consumption of the working process is getting extremely high
  • CPU usage will at least go to the maximum on a core
  • Browser freezes

This only seem to occur on the final version of the SP, we haven’t reproduced it yet on the Beta or Release Candidate.

When you’ve got a similar issue with either Sitecore 5 or 6, please report it immediately to support. For all others who hasn’t installed SP1 yet, I would recommend to wait till the moment we clarify what goes on.

And once again: this is an unofficial statement as we couldn’t test every configuration. As soon as we’ve investigated everything I will come back to you guys and we’ll update resources as SDN.

Bibles for me as architect and developer at the same time

Often, when I meet developers I get the question, what do you read for literature to remain up-to-date. Or, which references do you use? Cleaning up the mess around my desk today brought me to the moment I had to put my books back together. So here’s my ‘desktop-list’ of 10 august 2008:

  1. Laughing at the CIO; A Parable and Prescription for IT Leadership by Bob Boiko
    The only IT leadership book I know which hasn’t lost real life views. Excellent book written in simplistic English. Worth for everybody who has to work with information business goals on a daily base.
  2. C# Programming Language, The (2nd Edition)  by Anders Hejlsberg e.o.
    My primary language is C#. So I don’t want to be limited by the language of choice. So if I’m having a problem with generics, strange Polymorphism or Encapsulation effects in C#/.NET. Or simply forget about the difference between value types and references in C#, I’ve got the bible nearby. Essential for me, especially when developing reusable components.
  3. The Object Primer: Agile Model-Driven Development with UML 2.0 by Scott W. Ambler
    This book has relearned me how to write code. Used at many universities as a start for OO programming. For me it’s my base to get back to. It also touches all the side effects of programming such as agile methodologies, testing and (domain) modelling. It won’t go to deep into UML, which is, from some perspectives a shame, but for UML modelling I’ve got other books(which are not on my desk by the way!!).
  4. Design Patterns: Elements of Reusable Object-Oriented Software by the Gang of Four
    This book is a must have for every developer and architect. Have been reading it 3 times and every time I access one of the pages it makes life a lot of clearer. Keep in mind with these design patterns that they are _never_ meant as a bible, but as a guide. For your own interpretation in your own language. Sitecore as a product uses a lot of design patterns, but again, modified to the .NET environment. I primarily use the book as a reference to understand other peoples’ code.
  5. Software Factories: Assembling Applications with Patterns, Models, Frameworks, and Tools by Jack Greenfield, Keith Short, e.o.
    You would expect this book is only about Software Factories but that’s an illusion. It is about structured development. Obviously linked to how to automate this and bring this to a valid reusable theory. I’ve learned from this book that the software industry has a long way to go. On daily base it helps me to write better tooling and frameworks for being more productive.
  6. Professional ASP.NET 3.5: In C# and VB (Programmer to Programmer) by Scott Hanselman e.o.
    As Sitecore is all about ASP.NET, my latest addition to my desktop list is this book. It gives a broad view of all features in ASP.NET from providers to ASP.NET, from webcontrols to webparts. I’m extremely happy to have it on my desk to search for some stuff instead of opening(and switching between) another browser with MSDN. It just feels a bit more comfortable.

I’m sure you can live without these books. But I simply can’t. I try to do a good job on daily base. Especially when I’ve to help people with technical problems. Supplying code examples, reviewing frameworks, etc, requires from me to have a the necessary tools close to me. A sad thing is that I’m unable to write enough code to qualify myself as a developer these days!

Hope this list is helpful for people searching for right literature :).

When I was the boss I would hire…

… Steve Gedikian. You know his name? He worked at Nullsoft, the founders of Winamp. Back in the time when I was playing with my first C# bits, he left Winamp as a program manager. Somehow this guy always impressed me. Look at this blog-post why he leaves Winamp:

Over the past 10 months we’ve lost most of our team. Those of us remaining have become quite weary of the many ‘compromises’ we are asked to make in order to keep moving forward. At this point, I feel like I no longer have the power to make any positive impact on Winamp.

That said, we did accomplish a lot during the past 5 years. I still occasionally get emails saying ‘wow, I didn’t know AOL owns you!’ and that’s a testament to how successful we were in staying true to ourselves, our products, and our community. Unfortunately it was just a matter of time until everything changes.

Leaving Winamp became world news because CNet payed some attention. Afterwards Steve Jobs hired him. And of course, Jobs did a great job. Still sad that he’s now ‘just’ managing iTunes. Which is not the most brillian application on the Windows platform(but can never beat Acrobat Reader), but at least it works and looks cool :).

The reason I remembered his name again was because Winamp released a new version yesterday. Seems like AOL still pays attention to Winamp. Hopefully they will continue developing and releasing version 6 some day. Last propaganda quote from AOL ;-), what’s Winamp:

One part genius. Three parts llama. And a sprinkling of corporate AOL. That’s what Winamp is all about.

My lesson for today in effectiveness

I want to share this great lesson from Microsoft’s #1 Project Manager, J.D. Meier, on what he learned from his manager Per in effectiveness.
2 quotes from this great entry:

Next steps?   Asking “next steps?” at the end of your meeting is a pretty crisp way of turning talk into action.
What’s the agreement?  When you’re not sure why things aren’t happening as you expect, check the agreement.  You might find you don’t really have one.

[..]

Expose the approach.   People may not agree on the implementation or the results, but sharing the approach is a good place to start.  Exposing the approach gives you a chance to improve the approach.  Exposing the approach can also build trust, particularly if everybody buys in.

Have fun reading these ‘habits’ of effectiveness.

Sitecore 6: Serializating items and whole database – Part 2

My last entry about serializing items and whole databases was kind of more an introduction. Today I’m going to explain in detail what the ribbon buttons do. I’ll finish this series tomorrow by showing how to do this from code.

Developer toolbar with serializating tools

Serialize Item: This option let’s you serialize the currently selected item to disk. This means that when you serialize for example /sitecore/content/home, the following stuff will be created in %root%/data/serialization:

  1. Let’s assume that the item located is in the master database, then the action will create a folder ‘master’.
  2. The action creates creates the folder: /sitecore and /sitecore/content
  3. Finaly the item creates a home.item-file which contains the contents of the item

Serialize Tree: This option is similar for the first 2 steps comparing it to serialize item. In the third step the action now creates a hierarchy of items and folders from the current item.
Let’s assume that the home item has 2 child items, e.g. child1 and child2. The system will create the following folders and items:

  • /master/sitecore/content/home.item (item-file)
  • /master/sitecore/content/home/ (folder)
  • /master/sitecore/content/home/child1.item (item-file)
  • /master/sitecore/content/home/child2.item (item-file)

Update Item: This option loads an item from disk without forcing to overwrite. So if a field in empty(null) or a versions doesn’t exists, the Update Item will add this data, but never overwrite.

Revert Item: This options load an item from disk but forces to overwrite. So when fields have changed, they will get processed and overwritten. You can imagine this might be a bit more time intensive then the previous one.

Update Tree: Same as update item, but now for a whole tree.

Revert Tree: Same as revert item, but now for a whole tree.

Update Database: Same as revert item, but now for a whole database.

Revert Database: Same as revert item, but now for a whole database.

 

There’s also a hidden command, which is of course unsupported ;). It’s called ‘LoadAllDatabases’. To enable this, go to you core database and navigate to: /sitecore/content/applications/Content Editor/Ribbons/Chunks/Serialize. Then duplicate ‘Update Database’ and ‘Revert Database’. Change the names to ‘Update all Databases’ and ‘Revert all Databases’. Use the following commands: ‘itemsync:loadalldatabases’ and ‘itemsync:loadalldatabases(revert=1)’.
Have fun!