Marc Duiker

My experiences & thoughts about Azure, Sitecore & DevOps.

Hands-on with Sitecore Helix: Anatomy of the Add-HelixModule.ps1 PowerShell script

Add-Feature PowerShell function

In my previous post I showed how I got to a solution which allows the developers in my team to create new Feature and Foundation modules with ease.

I showed the moving parts of the solution but I did not go into much detail of the most important part so that’s what I’ll do in this post. This would be particularly useful if you want to change the script yourself to match it to your needs.

Hands-on with Sitecore Helix: Using PowerShell to add a new module

PowerShell plus Visual Studio equals Sitecore Helix

Embracing Sitecore Helix

Ever since I attended Anders Laub his presentation at SUGCON Europe 2015 about component based architecture in Sitecore solutions I have been a strong advocate of these modular principles. I even went to Pentia to learn about this in full detail.

I was very happy to see that Sitecore finally got their act together and published their Helix guidelines and recommended practices on the web.

For the last half year my team is using the modular Helix style architecture with success and it’s time to share some experiences.

Blog upgrade: Post excerpts, microformats and improving performance

Time for an upgrade

I finally made some time available to work on this blog. There were a couple of things I wanted to improve since I moved to GitHub Pages/Jekyll.

  1. Better looking index page. Before todays change it was a very simple (and boring) bulleted list of links containing the date and title of individual blogposts.
  2. Improved content structure. Having a well defined content structure improves SEO.
  3. Higher performance. Faster page loads makes both users and Google happy.

Improving unit test readability: helper methods & named arguments

‘Uncle Bob’ wrote the following in Clean Code: A Handbook of Agile Software Craftsmanship:

“The ratio of time spent reading (code) versus writing is well over 10 to 1 … (therefore) making it easy to read makes it easier to write.”

So think about that when you write your next bit of code. You need to make sure your code is easily readable and understandable for others, you hardly ever write code just for yourself.

Workflow Management SPE Module

Workflow Management SPE Module

Sitecore PowerShell Extensions first encounter

Although I had heard of Sitecore PowerShell Extensions (SPE) several years ago I never used it myself until earlier this month. My interest was raised again during the Accelerated development with Sitecore PowerShell Extensions session by Adam Najmanowicz during SUGCON Europe 2016.

Right after I got back from SUGCON the project I was working on had a nice challenge. Workflows were being set on existing templates and hundreds of content items had already been created using these templates and had no workflow or workflow state set on them. We needed a way to update the content items with the workflow that was set on the Default workflow field on the updated templates.

For me this was an excellent opportunity to try SPE. I wrote a Sitecore PowerShell script to update Workflow and Workflow state fields, posted it in a gist and tweeted about it. I got in contact with Michael West and Adam Najmanowicz (the developers of SPE) who made some excellent suggestions to improve the user friendliness of the script.

Sitecore investigation: Errors installing a content package with item buckets

Bucket icon

A colleague showed me this error today in the Sitecore log:

ERROR There is no appropriate index for [item path - {GUID}]. You have to add an index crawler that will cover this item

‘I’ve never seen that!’ was my first reaction…

This issue occurred when a Sitecore zip package with content items was installed on another environment. There were quite some lines in the Sitecore log which mentioned the same error but for different item paths and GUIDS. I looked up the GUIDS on my local machine and they were all Bucket folder items with no content items in them.

Here’s an example of how that looks like (when you’ve checked the Buckets option in the View toolbar):

Item bucket with an empty bucket folder

Choosing communication tools for distributed teams


Team communication

My work at Tahzoo and the work I do for the Dutch Sitecore user group require me to do a lot of communication in distributed teams. Effective and clear communication is difficult, even more so when the team members are at different locations. Having the right tools in place helps a lot. Since there are so many communication tools out there I want to share my opinion on some of these so perhaps you can make a more informed judgment when deciding which tools to use.

Moving my blog - I <3 Github & Markdown

Moved blog to Github, writing posts in markdown.

The blogging experience

Blogging should be hassle free. With my old blog platform, blogging was far from that.

Party this was due because I deviated from the built-in themes and I hacked something custom into it. I always needed to manipulate the html of a post because the paragraphs tags and white space were off… very annoying.

And when blogging gets tedious because of such things you blog less and less. It’s been almost a year since I posted anything, which is of course unacceptable ;).

Isolating calls to Sitecore.Context for improved unit testability - Part II: ItemAdapter

I don't adapt to my environment, my enviroment adapts to me.

Recap of Part I

This is part two of the “Isolating calls to Sitecore.Context…” series. If you haven’t read the Part I please do so to get the right context (pun intended).

In Part I the GetItem() method from ItemProvider returned an actual Sitecore Item. Because of the IItemProvider interface and Sitecore.FakeDb it is possible to return fake Sitecore items and no dependency to the Sitecore context is required in unit tests.

Although unit testing is now possible there are some (minor) downsides to them due to Sitecore.FakeDb:

  1. Unit tests still require additional Sitecore assemblies and the Sitecore license file.
  2. Unit tests look a bit cluttered due to setting up the fake Db and DbItem.
  3. Unit tests are not very fast to execute.

So lets look at another way of dealing with Sitecore items to get very lean unit tests.

Isolating calls to Sitecore.Context for improved unit testability - Part I: ItemProvider, Moq and FakeDb

I find your lack of unit tests disturbing!

Sitecore projects and (un)testable code

Over the last years I’ve been involved with quite some Sitecore projects, some were true greenfield projects where a solution is created from scratch and some involved ‘only’ customizing components or extending the existing platform with new functionality. I enjoy both types of projects since they each have their challenges. I do want to share my concern from what I’ve seen in some of the latter solutions. Some things that all of these projects had in common were:

  1. Little to no utilization of an ORM, such as Glass Synthesis, CDM (or a well defined self made solution).
  2. Lack of proper testable code (no dependency injection).
  3. Lack of unit tests

Of course all these three points are related. If maintainability is important it is vital to any software project that code is written in such a way that it is unit testable. Although this post concerns isolating Sitecore, it could as well be about isolating calls to a custom database or to a logging component.

This post is intended as a practical guide for the ones involved with these ‘difficult’ projects and are strongly in favor of improving the code base in order to improve the testability and maintainability without spending many man months up front to make it happen.

Sitecore Symposium 2014 - Keynote Session (photo impression)

Barcelona Keynote Session

Michael Seifert, the CEO of Sitecore, opened the Symposium with an excellent keynote about experiences and its role in the current (and future) digital landscape. Experiences should be collected and can actually be shaped for marketing purposes. Michael showcased how Sitecore 8 can help organisations in shaping experiences for their audience.

Sitecore MVP Summit, Dev Podcasts and Newsletter

Sitecore MVP Summit Miami

Sitecore MVP Summit Miami

This week more than 60 Sitecore MVPs from 10 different countries will attend the first global Sitecore MVP summit. I consider myself very fortunate to be one of them :).

There are quite a few Dutch MVPs and many of them are able to join the summit in Miami. For the non-Dutch MVPs who are attending, I’m pretty sure you’ll be able to recognize us ;). (Make sure to check #sitecoremvpsummit on Twitter the next few days!).

Lazy Programmers User Code Snippets

Full property code snippet

The best programmers are lazy

The great Larry Wall (author of Perl) claimed that laziness is one of the greatest virtues a programmer could develop. The best programmers are lazy in the sense that they do not write duplicate code or take pleasure in writing boilerplate code. They are efficient in writing code that follows the DRY, KISS and YAGNI principles.

Visual Studio Snippet for Extension Methods

Extension method snippet

Extension methods

Using extension methods in Visual Studio can really help to reduce writing boilerplate code. Here’s a simple snippet which can be used to create extension methods.

After importing the snippet via Tools > Code Snippets Manager you can use it by typing exm[TAB].

Sitecore Introduction for Developers

Sitecore introduction for programmers

(click to open the presentation)


At a recent TechTalk at my employer I gave a presentation about Sitecore. The presentation was targeted towards developers who have no experience with Sitecore whatsoever. I had 30 minutes to explain and show what Sitecore is and that was the biggest challenge of the presentation, there is just too much to tell! Next time I’ll focus on one topic and go more in depth.

The HTML5 presentation is made with reveal.js and I’ve uploaded it to Azure using Dropbox (super easy!).

Have a look and feel free to share and reuse it!

Presentations for Programmers

Presentations for programmers

(click to open the presentation)

Great Slides + Great Speaker = Great Presentation

In the last few years I find myself doing more and more (technical) presentations. I have to admit I even start to like it. I absolutely admire great speakers like Scott Hanselman (Microsoft) and Tim Ward (Sitecore/CluedIn). They speak with such passion about technology that I immediately want to use or do whatever they promote. Although my presentation skills are nowhere near the level of these speakers I do have a good grasp of what makes a great presentation. So before becoming a great speaker lets start with creating great slides.

Visual Studio Snippets for Unit Test Methods

NUnit test snippet

Unit Test Method Naming

As mentioned in a previous post, having a clear naming convention for unit test methods is important to keep tests readable and maintainable. Sticking to the convention might be difficult at first and require some discipline but is definitely worth it in the long run.

Visual Studio Snippets

In order to make it easy for myself (and other developers) to use the <UnitOfWork> _ <StateUnderTest> _ <ExpectedBehaviour> naming convention, I’ve created two code snippets, one for NUnit and one for MSTest. After importing the snippets (see below) you can use the them by typing:

nutest[TAB] (for NUnit)


mstest[TAB] (for MSTest)

The resulting code is displayed at the top of this post. The snippets use three placeholders (marked in yellow) which make up the method name using the suggested convention. In addition I’ve added Arrange, Act, Assert comments in order to help structuring the test.

The Importance of Good Unit Tests and Test Reviews

GOTO by xkcd

I’m currently following an online TDD course by Roy Osherove. I’m about half way through and although I have quite a bit of experience writing unit tests and using test frameworks I’ve gained a lot of knowledge from the course already. Here are some highlights about good unit tests and test reviews.

Good Unit Tests

Roy stresses the importance of the three pillars of a good unit test:

  1. Readability
  2. Maintainability
  3. Trustworthiness

If any of these are not taken into account during development developers are likely to drop unit tests all together because it will become a burden to use instead of an aid.

Marc Duiker profile

Marc Duiker

Lead Consultant @ Xpirit
Co-founder of SUGNL

Twitter || LinkedIn || Github