
Is learning C# as a first language a mistake? - yitchelle
http://programmers.stackexchange.com/questions/100488/is-learning-c-as-a-first-language-a-mistake
======
tolmasky
I only recently started using C# (Mono) about a year ago due to Unity, and I
have to say that I've been pleasantly surprised. I think it is a much better
functional programming language than JavaScript (thanks to the combination of
types, a saner lambda syntax, and generators) and ObjC (obviously, and the GC
makes ARC seem absurd), the two languages I would say I'm an "expert" in and
would have previously considered my "favorites". I couldn't believe that I was
actually looking into how I could host a C# server for our backend (I ended up
settling on node just because heroku is so easy to get up and running).

For some context, I use SubEthaEdit, and thus have no auto-complete or fancy
IDE features, so my opinion is purely language based. With all three of these
languages, my "style" more or less ends up turning them into the language I
want to program in anyways (no subclassing, shying away from mutability,
etc.). All in all this fits my long held belief that the worst programming
language is whichever one you are currently using.

------
wsxcde
A lot of people recommend C because it presents an abstraction very close to
the hardware. This is useful but in today's world, it isn't really a
substitute for actually learning how hardware works.

On modern machines, C doesn't even expose some of the more important issues
related to hardware. I am referring to things like the memory consistency
model, cache coherence, different abstractions for multiprogramming and how
they are implemented in hardware - GPUs vs. shared memory MIMD vs. MPI vs.
clusters running MapReduce and so on. I'm not saying these programming models
can't be implemented in C. I'm pointing out that learning C won't
automatically teach you about the tradeoffs between message passing and shared
memory systems. You still have to go out and learn that stuff. I'd argue that
in today's world this is about as important as learning what malloc and free
are doing under the hood.

Fred Brook's notion of classifying the complexity of programmable systems into
essential and accidental complexity is useful here [1]. No matter what
language you start with, you'll need to learn to deal with the essential
complexity of software systems. In that regard C# is as good as language as
any other. In fact, it might even be better than C because you get to focus a
little more on the essential complexity because it _is_ a higher-level
language than C.

I think the advice of learning C first came in an era when hardware
abstractions were simpler and so simply learning C would go a long way towards
helping you understand how your computer _really_ worked and thus in one sense
helping you cope with the accidental complexity of software. But I think that
advice might need to re-thought now because both the hardware and the software
systems we build and use today are so much more complex. Just learning C alone
might not get you very far in terms of understanding what really happens on
your machine when, say, your webbrowser is making a HTTPS request to
google.com.

[1]
[http://faculty.salisbury.edu/~xswang/Research/Papers/SERelat...](http://faculty.salisbury.edu/~xswang/Research/Papers/SERelated/no-
silver-bullet.pdf)

~~~
carterschonwald
Well said, C is not a good model of modern hardware! Memory models,
vectorization, and all those fun things aren't easily exposed/understood via C
(at least not without lots of compiler intrinsics ).

~~~
alanctgardner2
You can do OpenCL in C, that's pretty bare metal in some areas.

------
alanctgardner2
As someone on SO pointed out, the most important thing is to not be dogmatic
about "your language". You can start out on C#, Pascal or Erlang, but don't be
closed off to looking at or building toy projects in other languages.
Especially if they feel weird or difficult, it probably means you need to look
at the problem a different way. Learning new ways to solve the same problem is
useful for a programmer, and it keeps your brain engaged.

------
tobinharris
C# was my first language. I call it "home" because it's an awesome language
that ships with an awesome framework.

13 years later I only have a few regrets.

1\. Microsoft tools are very very clever and very very good. You could become
dependent on them. You could think you need them to be good at your craft. You
could also be tricked into thinking that intellisense & autocompletion are key
to your programming productivity.

I agree with what some folks here and on Stack Exchange say... Broaden your
horizons and try a couple of languages/development environments. Perhaps learn
Objective-C, Ruby, Node.js or Python at the same time. You could discover that
programming is little to do with the IDE.

2\. Reusing other peoples code is a good thing. The Open Source community
means you can reuse 1,000,000's of man-hours of work for free. And also
contribute your own stuff back to others. Last time I looked, the mainstream
.NET and C# community didn't really "get" Open Source. And in turn they didn't
really get "reuse", so we missed the benefits of open source.

T

~~~
ams6110
I learned C# using csc.exe and wrote my code in Emacs.

The book _Microsoft .NET for Programmers_ is a great (if somewhat dated,
today) intro to C# and .NET for people who already have some programming
background. It doesn't assume you are using Visual Studio so you get to skip
all the smoke and mirrors that adds and just focus on C# and the .NET
framework.

------
computerslol
There is a lot of depth to C# that most of the .net developers I've met have
never seen (and even when they've seen it, they do not fully understand).

The .net framework comes with __tons __of classes built-in that can be
arranged to do most anything that you 've seen elsewhere with very little
work; so it's understandable that with so much done for you beginning and
intermediate programmers might skip learning how to build components from
scratch, how to optimize, and how to create complex algorithms that solve
novel business needs; however understanding of these topics is expected of
senior developers everywhere I have worked.

I can see the point in suggesting one doesn't start with c#. I can also see
the need for books that give you a proper ground-up understanding of what's
going on. C# 5 Unleashed is an excellent example.

I don't think learning C# immediately is a mistake, but I do think it gives
you an easy excuse not to learn the fundamentals that __should __be very
important to you. It 's up to you as to whether or not you skip important bits
and risk your career; but it will catch up to you someday.

------
bbarn
Why is no one mentioning the job market for C# developers? I love lots of
languages, but what pays my bills is a day to day C# 9-5 Senior Dev job. It
leaves me with the financial stability to play around with ideas in other
languages at home, without having to fight for a relatively small job market
comparatively.

REALLY learning C#, understanding what happens when you drag and drop the
aforementioned gridviews and sqldatasource objects onto pages, is also super
important, but I do wonder what percentage of other platform developers really
know what's going on in framework calls they use?

~~~
hackula1
This is a pretty important note. Especially on the east coast, C# is by far
the easiest language to jumpstart a career in for young devs, and is a very
safe bet for veterans as well. Java jobs are practically non-existent in many
mid size east coast cities. I am now 100% node.js and python, but I probably
would not have made it in the door if it was not for C# when I was starting
out. The job market heavily favors devs, and the tooling makes it possible for
self taught people to gloss over the fundamentals until they have enough time
to go back and learn them. Also, if you think Stackoverflow is useful as a
dynamic language dev, you would not believe how much more useful it is as a C#
dev. I have no idea why, but SO seems to heavily favor C# over everything
else. This is not to say that other languages get no love over there, but John
Skeet alone has probably answered more obscure C# questions than all the other
languages combined. I am only being half hyperbolic here.

~~~
mortyseinfeld
C# is in high demand in many cities around the country.

------
macspoofing
C# is great. But it really doesn't matter what you learn as your first
language. Programming is a craft. You're expected to keep yourself up to date.
You're expected to read-up on new techniques, and all the goings-on outside of
your day job programming language. You're expected to perfect your craft.

------
Amadou
I wouldn't do it, for the simple reason that it is, _for all practical
purposes,_ a vendor-specific language. There is plenty to be said for the idea
that the concepts of programming translate into all languages. But that's an
academic perspective. From the perspective of having employment flexibility,
I'd be looking for a language that didn't lock you in to one specific
platform, as big as that platform may be.

~~~
jsmeaton
I'm going to be a bit nit-picky, but C# isn't a vendor-specific language.
There is also the mono implementation which is very very good, and doesn't lag
too far behind the .NET implementation. Xamarin is a decent example of writing
C# and targeting multiple platforms.

That said, there are better languages for cross-platform development, but that
might not be a concern for a large number of companies and people.

Locking yourself into a single language is the wrong thing to do regardless,
and is what most of the answers in the link suggest.

------
fleitz
Is learning french as a first language a mistake?

~~~
crpatino
No... unless you happen to pick Spanish as your second, Italian as your third,
and then go around trying to shoehorn Japanese, Swahili or Finish into your
(unknowingly) narrow definition of what a language should look like.

------
math
For me, C# / .NET / Visual Studio / Resharper is the most productive general
purpose development environment I've encountered. I've made a number of very
serious efforts to move away from it (to diversify knowledge / due to it's
image problems), but always come back because my productivity is just so high.

For operations, I don't like Windows - Linux is far superior for scripting,
how-to information more widely available, it's open source, cheaper etc. So I
tend to always deploy using mono. There are incompatibilities, but I have
found them to be relatively minor based on my experience working on some very
large systems.

------
grdvnl
I have been thinking about a similar question. What is the best way to learn a
language? Or how does one equip oneself to pick up any language to start
coding up the basic tasks[ignoring the intricacies the language provides].
Does learning one kind of a language help with learning other languages?

I started learning programming with C and little bit of C++, before I started
working on real life projects in Java and C#. Since then, I have dabbled in
Python, ML, Racket and more recently Clojure. So what did I learn from all
this? It is best to learn any language by learning the concepts or the \ how
the language implements/solves that concept.

For example, teaching the general concept of "environment" some declaration
resides in helps understand any languages "scoping" behavior more easily.

So, the bottom line is teaching any language by way of 'programming language
concepts' and just using the language to realize those concepts would go a
long way.

~~~
MichaelGG
I've been thinking about this too. It appeals to me to start off with
something like Scheme, then learn asm and C to understand how machines work
(at least conceptually). That way the basis of proper functions and computing
is in your mind, and you're not overcome with the hardware details first.
OTOH, I look at my own path, starting on BASIC, C, ASP and then onto assembly
and functional - and I wonder if it would have been easy for me to start off
where I currently am. As an "expert" now, is my viewpoint so warped that I
mistakenly think that old-me would have immediately picked up ML and
functional concepts?

~~~
matthewbadeau
Going from Scheme to asm and then on to C would take a lot of personal
dedication into learning how computers work. Much of the interest to learn
programming is to make something cool. I made a small game in Delphi when I
was younger. I toyed with Basic to ensure that my gorilla's bananas would
always destroy the computer's gorilla. It was basic, simple and I learned a
lot of new concepts. I'm sure you did the same thing.

I wish I learned asm and C when I was younger but honestly, I don't think I
would have stuck it out. So while my first thought right now would to say
"learn C as it will help you understand many other programming languages," my
honest advice would be to "make something in any language you want, just have
fun."

------
na85
I'm going to go against the grain here and argue that yes, it's a mistake.

An awful lot of novice programmers take years to progress from their "mother
tongue" to their 2nd and 3rd languages, if they even progress at all.

I think marrying yourself to a proprietary language like C# is a mistake, not
because of any particular C# language feature, but because it's yet another
product of Microsoft's extreme case of Not-Invented-Here Syndrome (see for
example netbios, active directory, etc etc etc). They have a compulsion to
create proprietary, non-compatible versions of things that already exist, and
you'll be handicapped if you only know C# and ever need to work on Not-
Windows.

C# is basically Java with some minor differences (differences that will be
immaterial to the novice) and Java has a far better degree of platform-
agnosticism and would be a far better choice for a first language than C#,
IMHO.

~~~
fleitz
Really?

Linux, Windows, Mac, Android, iOS.

Considering that Java won't run on iOS (nor can you deploy java apps to the
app store), I'd say C# is far more platform agnostic.

~~~
Alphasite_
Well, there is RoboVM, and Java (or derivatives) run on just about everything
wether it be you sim card or credit card to high end clusters.

~~~
fleitz
Same with C#
[http://www.adafruit.com/products/336](http://www.adafruit.com/products/336)

To be honest though anything non-x86/ARM is pretty esoteric these days, and
realistically if you're going embedded C is a far better bet than anything
else. (except maybe forth)

------
yodsanklai
To me, any language with a well defined semantics, consistent syntax,
understandable error messages, strong (preferably static) typing is a good
choice to learn programming. Also, it's important that you don't need to
introduce many concepts to do simple things, which is typically the case with
C# or Java.

For instance, consider Hello World in C#:

public class Hello { public static void Main() {
System.Console.WriteLine("Hello, World!"); } }

you have either to explain several difficult concepts or tell the students
that there are some magical things going there that they'll understand later.
To me, it's not really satisfying. In the end, it will work, but with extra
confusion and risk of losing some students along the way.

compare this with "hello world" in ocaml: print_string "hello world"

I'd much prefer to teach programming to a newbie in ocaml, python or pascal,
rather than C#, Java, C++ or C.

------
hanleybrand
A friend told me recently that they liked Python because it was an easy
language to start a project with, but they loved OCaml because it was an easy
language to finish a project with.

My point? The best language to learn first is the one you are most likely to
be able to finish a project with, and the best approach to figure out which is
which is to start learning whichever one seems like the right one. If you're
wrong, the good news is it's much easier to learn a second language, and a
third, forth, etc.

I started with pascal, and it was the incorrect choice. I'm still not sure
what the correct choice would have been, but from here it looks like
lisp/small talk, neither of which I have bothered to learn yet. Go figure!

------
Vektorweg
I started with C++ 6 years ago. 3 years ago, my religious view on C++ ended
and i finally realized, that C++ is not enough. I saw Java, Lisp, Prolog, C#
and others but got stuck in Haskell, because Haskell is the way, i want to
write programs.

Independent to a language, i recommend to start without a IDE. C# and Visual
Studio is in this case a bad combination.

------
dizzystar
I started with Python, then Lisp, then I had my first job working with C#. I
honestly don't think C# would make one iota of sense to me if I did not have
any background in programming.

I think that there is something be said about learning the value of all the
libraries and working at a high-level view when your aim is production, but
for learning, peeling away all the abstractions and forcing yourself to learn
the fundamentals first is more important, with a much larger payoff once you
are exposed to working with higher-level concepts. The dichotomy is that being
productive is somewhat at odds with learning the fundamentals, but being
productive in C# requires some intuition and knowledge about _when_ to use a
tool as much, if not more so, than _how_ to use a tool.

I think that the entire .Net ecosystem is a terrible place to start. The first
reason is Visual Studio. There is immense value in learning how to compile a
program, using real REPL, learning how to design your file tree, and many
other issues. I also think that a language that basically requires you to use
code-completion is bad for your discipline as a programmer and doesn't enforce
one of the major tenets of LCTHW, which is that typing and accuracy are highly
valuable skills and depending on code-completion is akin to doing copy-
pasting. Typing forces you to consider the "why" of your actions.

I also think that C# is generally much slower to develop on because far more
verbose than other languages. It is better, IMO, to just focus on the problem
at hand. Having a program that is 3x longer than Python can't be good for a
beginner. Too much to focus on. Just get to the point and focus on it.

There aren't many learning resources about C# and using it for programming
fundamentals. The advice can often be highly confusing and at odds with what
you are ultimately attempting to accomplish. There is something to be said
abound step-by-step and simple and straight-forward when you are just starting
out.

I think C# is fine as a second or third language to learn. The reason is that
there are many wonderful ideas and concepts in there, but they won't make a
whole lotta sense without something to refer to in your own mind.

I hope the above isn't interpreted as a bash of the language or .Net as I
believe that C# is a beautiful language with some amazing concepts. With that
said, I'm sick and tired of seeing slow sites with the .aspx extension. If
people with years of experience get bogged down in the complexity of the
framework, what will happen to our beginner?

------
znmeb
Yes, unless there's a paid development position at the end of the course. ;-)
But seriously, your first programming language should be one where there are
numerous entry-level programming jobs in companies where you live. Network,
network, network!

------
ams6110
Some of the better CS schools (used to?) start freshmen with Scheme. Not sure
if they assume its a "first" language but for at least some of them it is.

~~~
zachlatta
Berkeley's CS department starts with Scheme.

~~~
wcummings
As does WPI. Good move, imo, starting with functional programming Just Makes
Sense

------
dpedu
I don't think there is such thing as a bad choice for a first language,
barring obscene languages like Brainfuck.

------
foohbarbaz
No, unless you want to shut yourself out of non-Miscrosoft ecosystem.
Considering that learning a language is a long term investment and MS's star
is waning, it's probably not a good idea.

~~~
adamnemecek
If only C# programming skills (and programming skills in general) were
transferable to other languages. Oh wait.

