Development tip - Try using Visual Studio Code Snippets

If you haven't been programming in visual studio for long, chances are you haven't heard about code snippets.

Code snippet is actually code which you can quickly insert into the code editor. Typically snippets are common language constructs which you use often and a number of them come bundled with VIsual Studio. You probably noticed them in IntelliSense as you were typing code.

As the tooltip says, you can simply go to code snippet and then hit TAB key twice to insert it.

Some useful C# snippets are:

  1. #region - Inserts #region and #endregion, puts a cursor where you would normally type the name.
  2. try - Inserts a try-catch
  3. tryf - Inserts a try-finally
  4. for and forr - Insert for and reverse for loops
  5. prop - Inserts an automatic property
  6. propfull - Inserts a property and a backing field

As snippets for these short constructs exist, there are also snippets for entire classes and methods. And you can also create your own. To see all snippets that are shipped with Visual Studio, simply go to Tools -> Code Snippets Manager...

This nifty little thing is also available in Visual Studio Community Edition. You can play with the snippets, download new ones from the Internet and if you try to get into a habit of using them, possibly even improve your coding practices.

In a future blog post we'll create a small code snippet of our own.

Happy coding!

Great developer resources - Issue #1 - MSDN code samples

There are a lot of great developer resources out there on the Internets, so it occurred to me that it would be interesting to showcase some of them, especially ones that are jam-packed with great resources, such as a Developer code samples sub-site on MSDN.

The basic premise on this site is that everybody can upload a code sample, and then community votes on it, meaning that the best quality samples are really, really good and useful.


Functional Principles for Object-Oriented Development by Jessica Kerr

Lately I have been playing a bit with F#, mainly out of curiosity. To be honest, functional programming looks a bit scary to me, especially the syntax. But the guys over at and are pretty persuasive, so I did decide to invest a bit more time in playing with it. I will see where it will lead me. Hopefully I'll blog something concrete about #fsharp in a little while.

As a part of my journey so far I stumbled upon this video where Jessica Kerr explains the basics of functional principles and how to apply them in our "main" languages, like Java or C#. I strongly suggest you invest a bit of time and at least take a look at what it's about and how you can apply functional principles already today.

I really, really think you can watch the video and take away something from it immediately. It might even inspire you to try a bit of functional programming yourself.

Jessica also has a blog and she also tweets under @jessitron. I suggest you pay her a visit.

The Expert (Short Comedy Sketch)

I had to take a minute out of my day and share this wonderful and funny video about how is it like to be an engineer in a corporate world.

I really suggest that you take a few minutes to watch it.

Of course, as with everything, it can be up to interpretation. The engineer could also have asked what do they really want to accomplish by asking to draw lines in this fashion and then maybe a better way would have come up for the real goal to be achieved. Others might say the rest of the team should have asked clients (or themselves) this first.

A lot of time clients do not know what they really want and what the best solution is unless it's suggested or recommended to them. As developers we should try to keep this in mind always. Dialog is everything. When in doubt, ask. This should be our contribution to our companies and to the world of software development in general.

Firefox Add-On of the ... month? Issue #1: HttpRequester

Let me quickly introduce an interesting add-on for Firefox to you. It's called HttpRequester and it's very very useful add-on for basically any developer.

What it does, it enables you to quickly send a HTTP request using method which is not easily done through browser (PUT/POST/DELETE).

You can also use a "browser view" instead of plain-text view.

It also contains a history of your previous requests so when you click on a previous request you can see what previously happen and you can execute it again.

There's even an option to save/load previous requests and to view raw request info.

All in all, a very useful little add-on that stays out of your way when you don't need it and when you do, it's immediately available. If your primary browser for development is Firefox, I strongly suggest you give this add-on a try.