BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Sharing Code Snippets

Sharing Code Snippets

This item in japanese

When possible, commonly used code should be wrapped up in frameworks and libraries where you don't have to look at it. But when that's just not possible, we often have to turn to lengthy blocks of boilerplate code. This is especially true of patterns like IDisposable, where there is standard but it just can't be implemented at the library level.

One way to reduce the pain of building boilerplate code is Visual Studio's code snippets feature. Out of the box it has quite a few items for VB and a handful for C#. And while editing them has become relatively easy, sharing them with your teammates is another story.

One tool that could make this easier is Marckus's SnipPit. This open source project uses a SQL Server database to act as a repository for your code snippets. Unfortunately it doesn't integrate with VS's built-in snippet support, but one could see it being combined with Bill McCarthy's Snippet Editor.

Rate this Article

Adoption
Style

BT