Is C# 3 too big to learn from scratch?

I’ve been looking at C# 3 in a fair amount of detail recently, and likewise going over the features of C# 2. (I hope to be able to be less coy about all this soon.) I’m beginning to think that while it’s all great for existing C# 1 and C# 2 developers, I feel sorry for someone wanting to learn C# 3 from scratch. It’s becoming quite a big language – and of course the framework is big and getting bigger (more on that in another post).

I’m generally a fan of small languages whose functionality is provided by libraries. This is still the case with C#, but the compiler is now being smarter in various ways to allow for a lot of the neat features in C# 3.

It’s often been said in the newsgroups (usually when someone has been moving from another language to C#) that C# itself only takes a few days to learn, but the framework takes a lot longer. The “framework takes longer” part is still true, but what about learning C# in a few days? I’m sure it depends on previous experience: someone coming from a functional background is likely to find the C# 2/3 changes to do with anonymous methods and lambda expressions significantly easier than someone moving from C or Java.

The interesting thing about the new features in C# 3 is that aside from query expressions, they’re really fairly easy to describe. There’s a big difference between reading the description of something and really “getting” the feature – and I’m not even talking about best practices and applicability, just sheer “understanding what’s going on when you see it in use”. Generics in C# 2 work almost the other way round – they’re quite complicated to describe in detail, but you can largely get on with using them and deal with details later. You end up with surprises such as the lack of type parameter covariance, but there will always be new things to learn with virtually any feature.

So, if you were learning C# from scratch, would you be daunted? As a rough indicator (and one which genuinely doesn’t have much to do with my writing at the moment) how big a book do you think it would take to learn C# (without Windows Forms, etc – just enough of the core libraries to understand iterator blocks, IDisposable etc)? I suspect it would be hard to do it any sort of justice in less than about 700 pages, which is a pretty off-putting size (at least for me).

I’m not sure whether it’s useful for an incoming professional developer to start off learning C# 1, then learn 2 when he’s comfortable with 1, and then 3 afterwards. It would be quite hard to be productive either working on new code or maintaining old code without being able to understand the syntax that colleagues are using.

Maybe there are enough existing C# developers and enthusiastic newbies who are willing to make such a significant commitment. Maybe I’m completely wrong about how hard it is – let’s face it, it’s always hard to gauge the difficulty involved in learning something after you already know it. I am concerned though. How does everyone else feel?

8 thoughts on “Is C# 3 too big to learn from scratch?”

  1. Not really a problem – people will just need to read your book!

    How many of the ‘cool features’ in C# will really be used in practice? A lot of run-of-the-mill developers only tend to you a small subset of a language anyway, and stick to doing things the same way that they’ve always done them. You’ve seen the quality of C# developers in interviews your done.

    Like

  2. Have you looked at Java recently? The cute little pup which counted 4.000 classes back in 1.2 days now counts 16.000 classes in a mix of deprecation and inconsistence. I started writing Java around 98′ and I still continue to be amazed how much is needed to be productive in this environment.

    So I would definitely claim that C# 3.0 still is in better shaped for the future than certain other languages, having real generics in place, a strong component model, plenty of free bytecodes left, operator overloading, a preprocessor etc. makes some pretty solid building blocks.

    Like

  3. I think someone coming from a procedural background will have to do a lot more work to learn C# now than they would have in the days of C# 1, and I think it will be very difficult for them. (That’s not to say I am not eager to take advantage to the new stuff.) A related concern is When is it going to stop? Are we going to add some Prolog style imperative programming in C# 4? How about embedded IL code? Will it ever end, or will the language just become too big to use someday? (Like C++ with its 10 ways to say “int”.)

    Like

  4. Haha, I like that embedded IL code idea Mr Whitledge. All of a sudden every egotistical C# programmer with more technical skill then common sense would start gleefully destroying the readability of every project they’re a part of.

    And the “Helpful” comments they’d give to new developers… oh, if I did this as a hobby instead of a career, it might be almost worth it for the laughs.

    “No no, if you write that method in IL and rework the logic for a maxstack value of 1, you can save a couple of bytes compared to what is normally emitted by the compiler. Obvious, geez, what a noob”.

    Oh yes, the fun times we’d have.

    :-)

    Like

  5. Depending on your background I think “learning” C# 3.0 is reasonably straightforward (different than 2.0 and more difficult than 1.0). The difference is becoming proficient writing and designing code in C# 3.0; of which I believe it has nuances that make it harder to become proficient in than previous versions.

    Like

  6. Depending on what you are doing much of the libraries you will never see and others you will have a few uses and then for special cases.

    For the basics that are used everywhere a 500 book would work for those with previous programming knowledge.

    The thing I really miss from Java is the better documentation. With Java I could do a search and get multiple code examples for all those rarely used classes. With C# you are lucky to get one good example

    Like

  7. C# 3.0 is a bit of a monster to learn from scratch – we’ve taken the approach of focusing on existing developers who are familiar with the basics of C# (earlier versions). For those folks, we’re trying to get them to learn the most important new features for any C# 3.0 professional developer to master:

    * Anonymous types
    * Object and Collection initializers
    * Extension methods
    * Auto-Implemented Properties
    * Lambda Expressions
    * LINQ Extension Methods with Lambda Expressions
    * Basic LINQ queries
    * Advanced LINQ queries

    I’d say start with these and get your head around the new version of C# in that way.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s