The Best Way to Learn ASP.NET
You're looking to learn ASP.NET? I can't blame you. Not only is it an extremely flexible platform, but .NET developers are in high demand and will continue to be. Unfortunately, it can be an intimidating platform to learn — especially if you are brand new to development or have never used Java or C++. However, once over the proverbial hump, you’ll find it to be a rewarding and enjoyable platform to develop for. This syllabus is designed to get you up and running on the ASP.NET stack, being able to write your own applications.
Assignment 0: Disregard the Naysayers
Taking a page from Siddharth's earlier guide to learn PHP, disregard the haters. The majority of ASP.NET’s critics are kids who know nothing about the platform other than it was made by Microsoft; they haven't spent five minutes with it to come up with any kind of informed opinion.
While there are certainly valid criticisms of the platform, they are typically made by developers who not only know C# and the .NET Framework, but PHP, Ruby, C++, Java, and other platforms.
ASP.NET isn’t perfect—there is no such thing. But it is one of the most flexible and powerful server-side technologies available today.
Assignment 1: Pick a Language
I fully recommend you pick C#.
ASP.NET is often incorrectly thought of as a programming language; it is actually a platform built on .NET’s Common Language Runtime (CLR), the component of the .NET Framework responsible for executing .NET applications. Because of this, a .NET developer can use whatever .NET-enabled language they want to write their ASP.NET application. This means you can write an application in C#, Visual Basic.NET, Python, PHP, Perl, and many other languages. As long as there is a .NET compiler for your chosen language, you can write an ASP.NET application with it.
Keeping that in mind, I fully recommend you pick C#. While it may be tempting to pick another language you might be more familiar with, the bulk of information, both in books and on the Web, are geared towards Microsoft's officially supported languages: C# and VB.NET. Additionally, C# was specifically designed for the .NET Framework, and thus, is the most intuitive for using .NET's features. This is one of the reasons why .NET is intimidating; not only do you have to learn the framework, but a new language, too. But it is well worth it in the end.
- Visual C# 2010 Step by Step: After you pick a language, it's a good idea to get familiar with it. If you want to dig into the C# language before getting into ASP.NET, I recommend Visual C# 2010 Step by Step. It is a very good introduction to the language, and will introduce you to many aspects of the .NET Framework as well. It's not required reading, but you'll have an easier time learning ASP.NET with a solid foundation in C#.
- ASP.NET from Scratch: Nettuts+ has a semi-fast-paced series called ASP.NET from Scratch, presented by yours truly. The beginning lessons are a couple years old, but Lesson 1 and Lesson 2 give you some background of the platform as well as a brief introduction to ASP.NET. You don't necessarily have to follow along with the examples (they use older tools which you will not want to download), but watch the first few lessons to get an idea of what you're getting into. The later lessons work with the MVC framework, which you should wait on learning until a later time. The series was designed to get you up and running with ASP.NET, so it is not as comprehensive as a book might be, but that'll be taken care of with...
Assignment 2: Read Some Books
Two to be exact. There is no shortage of ASP.NET books in the world, but there are bad books, good books, and excellent books. The two listed here are excellent, and I want you to read them in order.
Author: Imar Spaanjaars
Beginning ASP.NET 4 in C# and VB starts at the very beginning by walking you through downloading and installing a free version of Visual Studio called Visual Web Developer Express. You’ll then embark on your ASP.NET journey, learning syntax, controls, themes, and other features of the platform. Just as Visual C# 2010 Step by Step gives you solid foundation in C#, Spaanjaars’ Beginning ASP.NET 4 in C# and VB gives you a solid foundation in ASP.NET fundamentals.
Author: Bill Evjen, Scott Hanselman and Devin Rader
This book dives deeper into ASP.NET to give you a more complete understanding of the platform. It will not only expand upon the topics covered in Spaanjaars’ book, but it will introduce you to other features of ASP.NET and the .NET Framework: sessions, the provider model, membership (authentication and user roles), security, state management, caching, and the list goes on. There is not much this book does not cover, and it will be an invaluable resource you can return to when you need a refresher on a particular feature or topic.
By the time you finish these two books, you’ll have a very good understanding of the platform. So it's time to branch out and...
Assignment 3: Create Something
Reading is one thing; doing is another.
Reading is one thing; doing is another. While you undoubtedly followed along with the examples in the previous listed books, doing something on your own is one of the best ways to learn. So for this assignment, write something. Building your own blogging engine, forums, or to-do list will put what you've learned into practice. Start small and add more to your project as you finish a piece. Make sure you include the following features:
- Database-Driven: It should be database driven. Use Microsoft's SQL Server Express as your data store, and design the tables you'll need for your application. If you're new to designing databases, it's typically a good idea to think of your data as logical objects. For example, a blog app could have a table called BlogPosts where the table's fields describe blog posts (title, posting, date of post, etc). Keep it simple and logical.
- UI: It should have a "front-end." By this, I mean the portion of the app that visitors would see; it's the content that your project is supposed to display. If you build a blog, it's the blog posts, archives, etc. If you're building a forum, it's the threads and posts contained within the forum. If it's a to-do, list, it's the tasks you (or other users) are to keep track of.
- Admin: It should have a "back-end." This is the administrative portion of the project, where you maintain the blog posts, forum, or to-do list. Make sure you protect it by requiring administrators to authenticate.
Never fear to crack open a book or ask questions on the Web. Sites like www.stackoverflow.com and forums.asp.net are valuable resources where you can ask questions and get tips from pros who have used the platform for years.
For extra credit, add in users and roles.
- For a blog, add the ability to have multiple authors post blog posts, and give them roles that determine what privileges they have.
- If a forum, add the capability for users to sign-up for an account and start and add to topics. Also use roles to determine what users can and cannot do. Add moderators and super-admins for extra extra credit.
- If a to-do list, make it multi-user capable, where users can have their own unique and private to-do list.
Naturally, you'll need some way to administer these users and roles, so be sure to add that capability to your "back-end."
Assignment 4: Watch the ASP.NET from Scratch MVC Screencasts
The WebForms technology you have been using up to this point is just one of the programming patterns you can use to create ASP.NET applications. A second programming model is ASP.NET MVC. It's still ASP.NET but uses a different programming pattern called Model-View-Controller (MVC), and it is noticeably different than WebForms.
To get started with the MVC Framework, watch the following ASP.NET from Scratch lessons:
These lessons will get you up and running on the MVC path quickly.
Assignment 5: Read Some MVC Books
Author: Jon Galloway, Phil Haack, Brad Wilson, K. Scott Allen
Parts of this book will be reviewed from the ASP.NET from Scratch screencasts, but it does cover other topics such as Test Driven Development (TDD), security, and extending MVC, as well as dive deeper into topics covered in the ASP.NET from Scratch videos. This is a must have resource for any ASP.NET developer wanting to grasp the MVC Framework.
Author: Steven Sanderson, Adam Freeman
Once again, there will be review material, as many topics are covered in ASP.NET from Scratch and Professional ASP.NET MVC 3, but this is an excellent resource to give you other developers' perspective on the MVC framework.
Assignment 6: Rewrite Something using the MVC Framework
Just as writing something for Assignment 3 helped solidify your understanding of ASP.NET WebForms, you need to write something using the MVC Framework. When I learn a new language or pattern, I like to rewrite an existing project using my newfound knowledge. So for this assignment, rewrite the app you wrote for Assignment 3, but use the MVC Framework instead of WebForms. This rewrite should adhere to the same requirements as Assignment 3, and it has the same extra credit.
Assignment 7: Follow the Masters
Many Microsoft employees involved with ASP.NET blog and tweet regularly, but not every ASP.NET master works for Microsoft. Be sure to follow these guys and subscribe to their blogs:
- Scott Guthrie (@scottgu, weblogs.asp.net/scottgu/) is one of the original architects of ASP.NET and offers informational tweets and blog posts on the subject (particularly new stuff).
- Scott Hanselman (@shanselman, hanselman.com/) tweets a lot, but he provides a ton of information on .NET and technology in general.
- Phil Haack (@haacked, haacked.com/) also works for Microsoft in the MVC team, and his information blog posts cover a wide array of ASP.NET topics. He's also responsible for NuGet, a package management utility for Visual Studio and .NET apps.
- ASP.NET Team (@aspnet, www.asp.net) is the ASP.NET website, featuring community spotlights, forums, and tutorials.
Assignment 8: Keep up to Date
Microsoft releases several Community Technical Previews (CTP) before every major release.
Computer technology is a fast-paced industry, and ASP.NET is no exception. Since its release in 2002, ASP.NET has gone through five major versions (and one point release), with a new version coming in 2012, and ASP.NET MVC has seen three versions since its 2009 release. Things move rather quickly, and keeping up with the changes and improvements of new versions are a necessity.
Thankfully, it is relatively easy to stay current with ASP.NET. Microsoft releases several Community Technical Previews (CTP) before every major release. Not only do you get to play with the new features in the upcoming version, but you have documentation, including a thorough "what's new/changed", with every CTP release.
This lesson plan will get you on the road to ASP.NET goodness. It's a fantastic platform, and it gets better with every new version and point release. If you have any questions, feel free to ask them in the comments or tweet me. If you have anything to add, please share it with the rest of us in the comments. Thanks, and I hope you enjoy ASP.NET!