views:

675

answers:

4

For a newcomer to .NET Web Development and programming in general, who chooses C# as there preferred language. Is it better to learn C# first - without trying to apply it web development. It seems most literature for C# uses Console or Windows forms as a learning platform. So would that be the best direction? Or should you practice in web development and try and learn C# alongside.

+1  A: 

You need to understand the fundamentals of C# in order to develop anything useful, be it an ASP.NET website, windows client or web service.

I would start with some good tutorials around the basics of types, classes, methods, events and so on to get to grips with C#. C# Station has some good introductory tutorials here.

To develop web specific skills, start with HTML and CSS.

Then look at how the ASP.NET platform integrates both the C# (application code) and the HTML and CSS (presentational code).

And good luck!

flesh
+2  A: 

I've helped several people go both from previous languages (like C++) as well as no experience to using C#.

Definately learn C# before you try any particular kind of development (like Web stuff). It will only confuse the newcomer.

If you already know a language, reimplementing a small application from the old language to the new language can help a lot.

Also there are often books for common language transitions - the C# for C++ developers books are good examples. I recommend reading them.

Here's my teaching plan (in short summary):

  1. Give an overview of C# language (types, methods, Main()
  2. Have students write Hello World from the console.
  3. Have students implement the "Simon Says" game from the console.
  4. Have students implement "Simon Says" in WPF. (Using the designer. This used to be Windows Forms, but WPF is a cleaner model)
  5. Give a survey of the more advanced features in C# - delegates, events, etc.
  6. Have students implement "Simon Says" in ASP.NET.
Geoff Cox
That looks like a pretty good plan to me. I've never liked the way that many books try to teach the language with a GUI. GUI programming is hard, and has various challenges which you really don't want while learning the core language/platform. GUIs can make it more "exciting" but harder too.
Jon Skeet
+2  A: 

I disagree about learning C# in a bubble. If your end goal is to do web development why start with developing anything but?

The one exception is the console. It's incredibly easy to learn if, for, foreach, etc. in the console.

Do you have any programming experience, web or otherwise? If the answer is no, I'd learn XHTML and CSS first. There are a million tutorials online and it is pretty easy.

If you already have web programming experience then learning C# and applying to the web shouldn't be very difficult. Make sure you read the basics of the two types of ASP.NET (WebForms and MVC) and pick which makes more sense to you. Go thru the tutorials on the asp.net and you should have a fairly good start.

That's how I did it anyway.

Kyle West
A: 

My suggestion would be to do both as if you are doing only web development, then console or Windows applications may not be meaningful to complete. Another point is that there may be parts of C# that are specific to Webforms such as AJAX functionality to name one example though the ASP.Net MVC may be another worth looking at to some extent.

I would start with the simple, "Hello World!" example(Which can be done in a few ways in the web case and it is worth knowing all of them, e.g. straight HTML that doesn't have anything fancy, a Response.Write in the .aspx file, a Response.Write in the code behind, and using the "<%=" and "%>" tags for the last form) and then expand on that by using storage in files or databases and work towards building up various skills around a core of seeing C# used within web stuff.

JB King