8
votes

If someone were starting out with the .NET framework, what is the most feasible template to start with? And by the feasible I mean the one that has the lowest learning curve and the highest gains.

Start with:

  • Command Prompt applications in C#?
  • Web applications using ASP.NET?
  • Silverlight applications in XAML/C#?
  • WPF/Winforms Desktop applications?

I don't want to focus too much into one particular domain at the moment, instead learn a little bit of everything in .NET Framework 4.0. In which order would it be better to learn .NET?

10

10 Answers

12
votes

Console applications are obviously the starting point: user interface is a vast forest, and there's no sense trying to get through it until you've developed the ability to find trails in the wilderness. Also, there's nothing that you will learn doing console applications that's not applicable in everything else you do in C#.

The next step after that is to learn how to build user interfaces. I would take issue with those suggesting that you pick up WinForms: Yes, there's a lot of information out there about how to use it, and there are plenty of tools, and at its simplest it's pretty easy to understand. But there are two problems with WinForms.

First, a lot of the things that WinForms makes so easy are actually extremely poor programming practice. Mixing business and presentation logic in the same class is the norm in WinForms programming, and it takes a fair amount of effort to break that habit, especially since data binding - a key tool in decoupling the data model from the presentation - is fairly marginal in WinForms, while it's central to the architecture of WPF. There's a lot more to learn with WPF - a lot more - but you end up writing much better programs.

Second, WinForms is approaching the end of its life. You're not going to see Microsoft pouring more resources into improving it. They're done. This hardly means that it's not going to be useful well into the future - it is - but its overall penetration in the software-development ecosystem is, right now, as large as it's ever going to be.

Another reason to go with WPF is that most of what you learn working with WPF is also applicable to Silverlight, which opens up a door that is going to be forever closed to WinForms.

As far as ASP.NET is concerned, it's something that you don't want to learn until you need to.

3
votes

Command prompt is probably the very easiest since you can ignore messages and similar things but you're of course very limited. Next would be WinForms which is fairly easy since you can easily keep track of the state.

But it probably depends on your current experience, if you already have some web experience, WebForms might make more sense to you than WinForms for example

2
votes

Do you have an application you need or would like to develop?

If you have, try to define it in some detail and then you'll have a set of goals you need to achieve.

Once you have these goals you can then work out what's the best technology that will solve the problem.

For example if you've got a fairly static UI WinForms will probably be OK, but if you want to incorporate animations and other visual effects the you should be looking at WPF/Silverlight.

2
votes

Start with command line / console applications.

why ?

Very first thing is the implementation for your object oriented concepts which are the base but without getting into the complexities of web application / windows application / services or what ever.

Programming using a Console application template will keep you away from unnecessary complexities and and you could concentrate over inner workings of framework and feature.

When done with that and have explored features / libraries like say System.Collections etc you should then choose from the vast development domains on the bases of your interest and previous developmental experience.

i-e Web application development / Desktop developmet or else.

This will help you decide what technology to peruse further, parallel with your interests. Like, if you are interested in Web-application development you can go for Asp.Net WebForms / Asp.Net MVC etc and donot need to waste time over Windows Forms or WPF

hope this helps

1
votes

If I were teaching someone new (completely new to programming) then I would start with console applications. This would give you the opportunity to teach basic OO programming concepts without the added complexities of GUI development or the potential complexities of the ASP.Net page lifecycle.

I would then move into WinForms development and work on event-driven programming and GUI.

1
votes

What programming environments do you already know?

I would start off with a standard windows application (winforms) as you can easily drag and drop visual components on to a window and create some interactivity fairly quickly and easy.

Although most projects can be easily created and run straight away, web applications require a bit more infratructure and knowledge about the web.

1
votes

"And by the best I mean the one that has the lowest learning curve and the highest gains. I don't want to focus too much into one particular field at the moment, instead learn a little bit of everything in .NET Framework 4.0."

If you've been programming in .NET for a while you know that the above 2 sentences are an oxymoron if I ever seen one LOL.

Last time I checked .NET contained: Assemblies y = 15.1x + 17.3 108

Namespace y = 51.6x + 51 361

Types y = 2249.3x + 626.9 14123

Members y = 21343x + 7951.3 136009

So even if you've been programming with .NET fulltime for a while you will barely scratch the surface! You didn't even mention if you were proficient in C# yet but if not you can read the Petzold free ebook to get up to speed since that is the language most used for Silverlight, ASP, WinForms programming. If the command line bores you like it does me then I suggest the "Head First C#" book which will give you a gentle intro to C# and what .NET is capable of.

0
votes

For the very first steps, I would recommend command line applications.

For everything else, follow up with WinForm apps. They have a broad web coverage in turorials etc, and offer a wide range of problems and solutions that cover basic and advanced C# features.

ASP.NET, Silverlight and WPF are further extensions of those basics (Console and Winforms), which actually add another set of framework libraries. Those are the icing of the cake that you can address once you managed the basics.

Don't get me wrong, you can also learn the basics with Silverlight or WPF apps. But WinForm is known to almost anyone who ever developed in C#, so you are much more likely to find good answers to difficult problems you might encounter on the web (on SO or elsewhere). There are a lot of people here much more knowledgeable than me, who can help you explore the depth of the .NET framework

Once you have mastered these parts, feel free to explore new territory - and soon you will be the one to answer my questions on WPF, which I know nothing about ;-)

0
votes

Here is my evaluation based on the criteria you specify:

  • Command line is very quick to learn, but you can't really do much but print text, so after playing with a few simple programs you'll quickly want to move on.

  • WPF/Silverlight is the second-easiest after command-line as long as you begin by working through a few examples that use DataTemplates and ItemsControl. Once you are comfortable with these you can focus on learning the intricacies of C# and the NET Framework base class libraries, or you can explore the graphical elements of WPF.

  • WinForms is to be avoided because it is more difficult to understand than WPF/Silverlight: In WPF/Silverlight you create your data objects and then draw up a view that displays them, plus WPF/Silverlight handles all the positioning and layout. In WinForms you have to manually transfer data back and forth between your data objects and your UI objects, and you have to explicitly position everything. Other strikes against WinForms are that it is rapidly becoming obsolete, and it forces you into some very bad programming practices.

  • Without a doubt ASP.NET has the highest learning curve of all the technologies you list, and I would do my darndest stay away from it as long as possible!

When you're ready to graduate from command line (which will probably be within a week), it doesn't really matter much whether you pick up WPF or Silverlight. WPF is slightly easier to deploy, and the skills transfer well so I'd probably start there.

Start by creating a simple WPF application that has a single window with a Button, a ListBox, and a TextBox or two. Create properties in your UserControl and bind them. Then start playing. There are many walkthroughs that will help you get started. I've found Adam Nathan's book "WPF Unleashed" to be a fantastic resource for beginners.

Get a copy of Expression Blend if you can. There is a 30 day trial version you can download. It is very helpful in playing with the UI aspects of WPF and learning how they work, especially resources, templates and animation.

One final tip: If you ever find a book or blog that contains code like this, run for your life:

for(int i=0; i<10; i++)
{
  Button b = new Button();
  ...
  panel.Add(b);
}

(Unless, of course, the author only uses code like that to show you what NOT to do.)

0
votes

I would recommend building simple command line programs just to get the feel for the language + .NET framework. However this can be a little unsatisfying in a UI driven world. A lot of the UI based technologies will introduce you to the concept of integrating with an external framework, which is a key experience in itself. Often this is very rewarding as someone else has done has done the hard work and you can simply have fun.

Personally I would recommend ASP.NET last - it is just a little weird and you will develop bad habits.

Based on that recommendation I would recommend WinForms next up, it will teach you more about events and UI interaction, but there is still no strict coding pattern. In my early days I wrote some shocking WinForms code. You have a lot of power but little guidance.

I have seen some good work with WPF, but it requires a lot of reading up front. As a starting point at least you can generally make some advanced designs with little code - there is less to go wrong and you can grow into it.

My first UI recommendation, after playing with a console app, would be the ASP.NET MVC framework. It is easy to code, has a reasonably strict design pattern so you can't go too wrong, and you can build quite good website in a relatively small time. I personally picked it up very fast compared to the other technologies, yet have found the extensibility points great for keeping me interested.