Hello everyone, it’s time for another installment of Adventures in Azure. Well, it’s supposed to be another installment of Adventures in Azure, but I have not spent a single second in Azure for the past month, so I am going to do the next best thing and showcase the technologies I have been working with, instead. To catch you up, I am moving my Vote Reporter over to Azure. The Vote Reporter is based on a codebase that I have kept with me in one form or another for over a decade during my .NET development travels. Whenever I find new code I like or if there is any sort of abstracted code I design, it goes into my codebase/framework. It is through this process that I have learned the most about computer science. Starting last year, I have taken to rewrite it to make it more compatible for the new cross-platform era upon us, and I have learned A LOT – A LOT A LOT! Haha. In fact, this past month was spent really ironing out a lot of issues between all the new tech I am integrating and learning, and just learning in general. So, without further delay, here are the key technologies I am using in my framework and I highly recommend you checking them out to see how they fit into your projects/solutions.
To start with, I cannot recommend xUnit as a unit testing framework enough. It is very straight-forward in its design approach and has a very extensible model if you so wish do so. There is a lot to like about xUnit, but what I appreciate most about xUnit 2.0 in particular is that it has been built up from the ground with parallel processing in mind. That means tests run concurrently (6 by default) and allow your tests to run fast.
However, if your code is built in a not-so-concurrent-friendly way (as my codebase was, making abundant use of the Microsoft.ServiceLocation.ServiceLocator anti-pattern), then you learn about it the hard way. In fact, most of my time has been spent within xUnit in one way or another learning this new way of thinking. Well, "new" if you are like me and have come from a WPF background where “threading” is simply about UI and background threads. My mind has totally been opened to this whole new world via xUnit and my code has benefitted from it greatly!
On the heels of xUnit is AutoFixture, which works with xUnit to easily introduce variables within your testing methods. Mark Seemann is a total hero of mine and still feel he runs the best technical blog on the web. This is one of his creations and I again can’t contain myself is saying how awesome it is, not only in function, but the code itself in its GitHub repo. I have spent some time (ok A LOT of time) exploring this codebase and learning a thing or two. After using xUnit + AutoFixture, I cannot imagine writing my tests in any other way.
ReSharper is one of those technologies where developers either love it or hate it (usually due to performance issues). For me, I buy my development machine with ReSharper in mind so it is never an issue. 🙂 The folks at JetBrains have just released a new suite of tools along with ReSharper and have called it ReSharper Ultimate. There are a lot of products included in Ultimate, but I will outline the ones that I enjoy the most:
- dotTrace: dotTrace is a profiling application that does a really good job of allowing you to dive into the performance of your application (or unit tests, in my case) and see where the bottlenecks are occurring, and where you can stand to improve your code. I have learned a LOT from using this tool and it has really been fun/easy to use once you get the hang of it.
- dotPeek: dotPeek is an awesome program that runs as a symbol server on your machine. This allows you to set up automatic loading of symbols whenever you want to debug your application – anywhere! in the application. Very handy. I used to use Red Gate Reflector but have since then simplified and removed it, using dotPeek instead.
- dotCover: Finally, this is another application I have spent a lot of time in. dotCover originally intended to allow developers to see the amount of code being covered in a test run, but it is now considered to be its test runner, too. What is super great about dotCover is its Continuous Testing feature, which essentially detects all the tests impacted by the changes in your code on each build (or save of the file, if you choose) and runs them. This has been incredibly useful in my development process, and of course, seeing how much code is being utilized via its code coverage has been great, too. This has allowed me to audit my codebase and get rid of code I no longer need, or build tests around the as-of-yet unused code to make sure it passes.
PostSharp is another one of those technologies that seem to have developers divided on using it or not. Some consider it "magic" while others truly appreciate its approach and power. I personally have fallen in love with the latest version, the 4.x release. If you are not aware, PostSharp enables Aspect-Oriented Programming for .NET applications. For me, PostSharp adds a lot of power to my design choices and has changed the way that I approach design decisions and consider problems. The team there has also been incredibly helpful on their support forum and have done a great job in making sure questions are answered, problems solved, and reported bugs fixed. They even go through the trouble of providing sample code to help you get started. I highly recommend this technology if you you are interested in finding a powerful new way to approach your solutions.
Finally, I have to give a shout out here to Steven Cleary, author of the Nito.ConnectedProperties project. This lightweight package has been amazing for me and again like PostSharp has changed how I go about developing solutions. If you are familiar with WPF attached properties, then you are already familiar with how ConnectedProperties work. Essentially, ConnectedProperties offer a thread-safe (important when you are now developing thread-aware/centric solutions!) data that you can attach to any object, as long as it is a reference object and not a value. The data is based on a WeakReference and gets cleaned up from memory when its host is collected. This project has started out as a cool tool in my proverbial toolbelt but has really turned into a powerhouse that has solved more than one tricky problem for me. I definitely recommend looking into this project, especially if you have experience with WPF attached properties!
Well, that concludes my tour and check-in for this month. I am hoping now that I can start moving onto Azure and get some value to report with its infrastructure for next month. Until then, keep your head in the cloud!