If you are a .NET web developer, in this tutorial, you will learn about 10 free open source packages that will make your development workflow easier. I firmly believe in re-use, why re-invent the wheel when you do not need to? We all need to write custom code, however, it comes with a challenge. One of the issues with writing custom code is change. When we write custom code it is usually to meet a specific requirement or need. As a CMS developer, one of the biggest challenges of my job is dealing with change. Change is part and parcel of creating a website.
A client who asks for feature 'x' today will almost certainly want it to do something different in a week's time. I'm not a mind reader and I do not have marvel superpowers... yet 🦸. No one can build systems to cater for requirements that the client hasn't even thought about yet. Using a framework that has been designed and tested to work on multiple projects will allow you to build systems that can more easily deal with change. Not only that, you will save a significant amount of development time (and consequently money) on unneeded development, testing and maintenance of these features. Let someone else do the hard work for you 🙃. This saving means you will have more time to work on the interesting features.
I've had a look around the web and I can't seem to find many articles written especially for us .NET CMS developers that highlight which open-source frameworks you should look at, so I thought I'd start my own list. Below lists 10 tools that I use in production enterprise-level website, I hope you find something of value in it 😇
Bootstrap: A great frontend CSS and grid library that will prevent your frontend from looking like a dog's dinner. I use this all the time for bespoke applications when I don't have access to a designer. Not having to worry about creating a custom fluid grid is a massive win. Not having to create my own carousels, menus and form styles saves me a lot of time.
As a developer, I regularly need to create user interfaces for back-end systems. Bootstrap will vastly improve the look and feel of these systems in a fraction of the time.
NUnit: The best unit testing framework I've used for .NET. Originally written in Java, it has now been ported over to ASP.NET. NUnit has great Visual Studio support and almost all testing frameworks are compatible with it.
As a .NET developer, NUnit is your best tool for unit testing. If you don't know why you should use test your code and write unit tests, this is a great book to learn about the topic. NUnit is an invaluable framework to ensure your project has high test coverage.
Structure Map : Structure map is a great IOC container for .NET. There are so many out there but this is the easiest one I've used so far. Using Structure Map will mean you can use dependency injection within your codebase. This means that you can architect your code using SOLID principles. Writing code following SOLID will mean your code will be easier to update after the inevitable requirement changes are made. Structure Map is as good a tool as any of the other IOC containers, so if you do not know where to start, start here!
Fluent Assertions: Fluent assertions is a set of extension methods that allow you to write your unit tests in a more readable and human format. There's a good article written by the author here about why he created it. Fluent assertions make your unit tests easier to read. When you need to re-look at those tests you wrote six months ago, writing tests in a more sentence based style will make it easier for you to get back up to speed on the project.
Umbraco CMS: I think all websites should use a CMS system to power their content. Creating and maintaining a custom CMS is a lot of hard work. If you haven't got the budget to buy any commercial CMS software, Umbraco is a great free CMS you can use. Umbraco does everything you will need a CMS to do. It is open-source and free. I have written over 100 tutorials on Umbraco CMS and I've produced a whole YouTube series on it as well. If you do not know how to learn it, start here!
Log4Net: Log4NET is a great free log provider. Log4Net makes it easy to write custom logs to a file system, a database, or a custom destination of your choice! With NuGet, you can add Log4NET to your project in seconds. In terms of logging capabilities, I can not see a good reason not to use it! After you deploy your project, you WILL have to maintain it. You don't want to spend hours trying to track down where that mysterious error is coming from. Using Log4Net to log errors and exceptions will give you a central error point that will help you hunt those issues down. It's far more versatile compared to anything you would be able to build yourself.
Json.net: Json.NET is a great little framework that allows you to convert your C# objects to JSON notation. It's great If you want to flatten an object and store it in a string property. Using Json.NET I can use good .NET naming conventions and decorate everything with suitable JSON naming conventions. This is a must-use tool if you need to work with JSON or you need to perform serialisation or derealisation on data.
Automapper: Automapper will automatically map different objects for you. It will map properties with the same name between different objects, which can cut down on the amount of boilerplate code that you will need to write. When you need to add a new property to an object, the auto-mapper will make that boilerplate DTO to DTO code quicker to write.
One word of caution with Automapper is debugging. If you are mapping data automatically, it can be hard to diagnose bugs without good test coverage. Always have tests on any mapping code where you get data from a third-party API, if you do not... beware!
Moq: Simple mocking library that supports Lambda/LINQ. If you're using a CMS then a large part of your system will be hidden under the CMS systems API. If you want to create good scalable software, you will need to create MOQ's to deal with a lot of your CMS API calls. Moq is the best tool to do the job in ASP.NET!
CsvReader: I frequently have to create CSV reports for people. This little library allows you to throw a list of Enumerable objects at it and creates a nice CSV with the headers, you can also create custom mappings and export CSV files directly into an object.
That concludes the list. I hope you found something of value. Happy Coding 🤘