I often get questions about writing software in .NET: Is it expensive? Do I have to have a Windows machine? Can I build a website? Can I build “serious” software?
While I’ve written a couple of articles on how I learned Ruby on Rails and installing Rails on your Mac, my formal background is programming using Microsoft’s .NET framework. As a developer at Rackspace on the RackConnect product, I use .NET every day to make sure that we can link together our customers’ dedicated servers to their cloud servers. If you want to get started learning .NET, here are a few suggestions I have for you.
1. Choose Your Language
First, there’s no “.NET” language. Instead, .NET is a framework that provides an environment that programs in several languages can execute, including C#, Visual Basic.NET, Python, Ruby and Lisp (.NET developers can work in open source too).
So if .NET is the framework, what language should you use? I strongly recommend C# (pronounced “C Sharp”); it is far and away the most popular language used in the .NET ecosystem. Almost all open sourced software in the .NET environment is in C#. Most serious .NET software engineering projects use C# as it is a derivative of C++ and is a powerful object-oriented language. People with a background in Java should find it a relatively easy transition to learning C#.
The other popular option is using Visual Basic .NET, but I would only advise learning this language if your primary programming experience is writing macros and scripts for Microsoft Office applications. If this is the case, Visual Basic .NET might be an easy fit to get you started quickly. Or you can learn Visual Basic .NET if you really, really hate semicolons.
2. Choose Your Platform
What kind of apps do you want to build? Web, PC, Windows Phone or Windows 8 Store? If you want to create a website or web app, start with ASP.NET MVC (model, view, controller). If you have used the Django or Rails frameworks, ASP.NET MVC will be a familiar pattern for you to use. In addition to ASP.NET MVC, there is another .NET web architecture called ASP.NET Web Forms, but I wouldn’t bother too much learning Web Forms unless you have to support an app that’s already written in it.
If you want to make a Windows application for a PC or laptop, you will use Windows Presentation Foundation (WPF). These apps will work in Windows 7 or 8 but won’t run on a Surface Tablet or fit perfectly into Windows 8. However, if you are looking to sell your application in the Windows 8 Store, you will need to make sure it is created in Visual Studio 2012 using the Windows 8 Store Application Templates. Check out this post for more information comparing WPF and Windows 8 Store apps.
3. Setting Up Your Environment
The typical setup for a .NET application uses Visual Studio as the IDE (code editor, debugger, etc) and SQL Server as the database. Some versions of Visual Studio and SQL Server can cost a lot of money, but don’t let that deter you if you are interested in using .NET. Microsoft offers Visual Studio Express and SQL Server Express at no cost, which is a huge help if you are looking to get your feet wet. Not only can you learn on the express editions, but they are fully licensed and capable to run production commercial applications, up to certain performance and size limits.
If you are primarily an open source developer and don’t have a Windows machine laying around, you can get Parallels or VMware for your Mac, or even spin up a Windows Cloud Server at Rackspace. If you really don’t want to run Windows, you can check out the free, open source Visual Studio replacement called MonoDevelop that runs on Mac OS X or Linux, and Mono, which is an open source replacement for the .NET framework that is compatible across multiple operating systems. There’s even a MonoTouch project that lets you build iOS apps!
4. Learning The .NET Framework
One thing that I give Microsoft a lot of credit for is how easy it makes it for people to learn the .NET framework. The Microsoft Developer Network (MSDN) site has a lot of resources for developers, including detailed documentation and sample code in different languages that you can use. Clicking the “Learn” tab on the Microsoft’s ASP.NET site is one of the first destinations that you should visit if you are making a web application.
If you are a visual learner, I highly recommend the videos at Pluralsight for learning both the language and the web, mobile and Windows application code. Although a little expensive, this is a very Microsoft heavy training site that has some amazing instructors who stay up-to-date with the latest trends.
For the developers who prefer to read books, one must-read is the C# Yellow Book. This is a great resource for anyone looking for a solid foundation in programming in addition to C#. A book that is a little bit older, but one that I have found helpful, is Programmers Heaven C# School eBook, which will give an overview of programming basics as well as C#.
The best way to get started is to pick a project idea and start building. When the inevitable bug or sticky issue pops up, StackOverflow is a fantastic website for getting your .NET and general development questions answered. Happy coding!