tags:

views:

939

answers:

26

Is it possible to learn C# as your first computer language without any knowledge of the other three languages it combines?

I learned objective-c without knowing c first, but assuming I know nothing of C# or any other language is it possible to learn as a first language?

+1  A: 

Yes of course and IMHO it's a good choice.

Brian R. Bondy
+2  A: 

You have to start somewhere. C# is as good a starting point as any.

Justin Niessner
+20  A: 

Yes. It's possible to learn C# as a first language.

It doesn't really "combine" other languages. It takes some inspiration from other languages, but doesn't use C or C++, etc, directly. C# is its own language, with its own syntax and rules.

You can learn ANY language as a first language.. Some are easier than others, and use different concepts. Personally, I think C# is a decent choice for a first language, since it has a good development environment, a great community, and is flexible enough to provide good growth and usage in almost any environment, but easy enough to not be overwhelming.

Reed Copsey
Please don't learn BF as a first language. It's admittedly somewhat easy to understand (how the language works, not the code written in it), but even so...
Brian
@Brian: LOL! True, some choices are much better than others for a first language - but technically, you could learn any language as a first, if you so chose to.
Reed Copsey
Yes, but learning is a broad concept. Starting to create GUI applications, for instance, while you even don't master the basic syntaxes of the language can make learning very difficult; try proportionally learn stuff, not all at the same time.
Pindatjuh
@Pindatjuh: that may be true for some. However c# provides the means to learn the syntax without creating guis. Creating a console app in C# isn't really an issue :)
galford13x
A: 

Yes. The fact that it has syntactic roots in the C family of languages doesn't require you to know C, C++, Java or whatever: you can treat that as a historical curiosity.

itowlson
+1  A: 

Yes, C# is a perfectly valid language to learn first.

Taylor Leese
+1  A: 

Yes it is a reasonable choice. Knowing the languages that came before it is interesting and useful, but is not a prerequisite.

See also http://portal.acm.org/citation.cfm?id=948843

Erv Walter
+4  A: 

Many computer science curricula are using Java to introduce programming. C# is in many ways very similar to Java, so I would think a student could be pretty successful starting out with C#.

If your question is, "Is C# the best language to start out with?" then I think I'll leave that alone - the answer is going to be very subjective.

jwismar
A: 

Sure, just because it's like another language doesn't mean that you have to know the other language to learn C#.

Heads First C#

Kevin
+1  A: 

It was my first, still using it 99% of the time today, 8 years later.

leppie
A: 

I'd go so far as to say that learning another language as a halfway step is more likely to leave you with bad habits than to reduce your C# learn time.

Russell Steen
That depends. I absolutely would start with a C#-compatible subset of C or C++, e.g. int main() { int i = 4; return i + 5; } before introducing "class" or "static" or "namespace" which are obligatory to make the C# compiler happy (ok, it's just barely possible to do without "namespace").
Ben Voigt
+10  A: 

Yes.

....also (trying not to blow Microsoft's trumpet) Visual Studio is a very good IDE so that + the language will help any newbie get into the swing of things quite quickly

djhworld
VS is great - I am still thrilled at `F12` and `Ctrl-minus`, after many years.
RedFilter
@OrbMan Have you tried ReSharper, (it has a trial period and) it takes your C# programming in VS.NET to a whole new level. There are other (free) plugins as well that resembles that one.
Patrick
@OrbMan Defo try ReSharper it will help out no end, just interfaces to implementations in a shortcut has saved me loads of time. @Patrick was skeptical about resharper before we got some licenses and installed it ... don't leave home without it now after 2+ yrs :-)
WestDiscGolf
Re ReSharper - tried it (and CodeRush) and it didn't stick. I appreciated the power, but it slowed down the IDE, and I could not bear that.
RedFilter
+2  A: 

Of course. C# does not combine languages!

It's a completely self-sufficient language that of course has roots/draws inspiration from Java, C and C++, but that does not mean you have to learn them.

Or do you need to learn Latin before you start learning Spanish?

Michael Stum
I think you mean "Or do you need to learn 'German ' before you start learning English?" as German is not a latin based language.
galford13x
@galford13x Whoops, you're right. I should know the origins of my native language better :) I've changed it to Spanish, which is a descendant of Latin.
Michael Stum
+1  A: 

Certainly. But learn at least one other language too - it will make you a better programmer.

Charles
+5  A: 

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC. As potential programmers, they are mentally mutilated beyond hope of regeneration.” (E. W. Dijkstra)

IMHO, the importance of a first language is often overstated. E.g., people like to slag BASIC as a terrible first language. However, I was introduced to many fundamental concepts via BASIC (flow control, subroutines, etc.), as well as some more interesting things like:

  • direct access to and manipulation of memory via PEEK and POKE
  • self-modifying code! many cool things were done with this
  • optimizations such as storing data at the end of the code, which taught me a bit about how interpreters work
  • my first (and, oh, how I wish my last...) infinite loop (10 GOTO 10) - terrifying and beautiful at the same time!

That spurred interest in interrupts and soon I was doing assembly. Later I got into OO via JScript in classic ASP, and then more formally with C#.

I guess what I am saying is, is there is no one true language, and any of them is enough to open the door a crack, enough so you can see the big room filled with light beyond. So, yes, by all means, C#.

RedFilter
andras
Every language teaches you *something* about flow control. But was my life somehow better for having learned GOTO first and not apply/eval? I don't see how.
Ken
I am sure Djikstra would have been closed for "subjective and argumentative" with that one.
Mathias
+1  A: 

Yes, C# would be a fine first language. You can easily learn spanish/french/english without knowing latin.

C# is rather high level, so it will be easier to start with, and cuts out a lot of the crap you have to deal with with earlier languages (NOT because those langauges are bad! C# owes much of its beauty to its predecessors).

C# will also teach you Functional Programming early, which is becoming increasingly important in our industry as multi-threading becomes omnipresent.

CrazyJugglerDrummer
Why will C# teach you functional programming? C# is primarily an imperative language.
Charles
C# implements delegates, which allow passing (as arguments) and returning functions to other functions, without dealing with pointers. Furthermore, C# 3.0 introduced lambda expressions, which allow a compact representation of "on-the-fly" simple functions. Stuff like passing a comparer function to a sorting method is quite commonplace in recent C# code; and being able to pass it as somethig like (x,y) => x.SomeField.Compare(y.SomeField) (to compare values based on a given field) is really handy. To top it up, LINQ makes a quite original use of these techniques.
herenvardo
The fact that you can have delegates doesn't make C# any more of a functional language than C (where you can have function pointers). I don't expect to see (for example) first-order functions in C# (even though you can technically do it).
Alun Harford
@Alun, yes you're completely right, C# isn't a complete functional language. But I do think it gets you thinking 'functionally' a lot *more* than java or C++, where lambdas are nowhere in sight. At least you CAN write somewhat functional code if you want.
CrazyJugglerDrummer
As I said, C# allows functional approaches *without dealing with pointers*. Not saying that pointers are bad, but in C/C++, to implement functional code you need to keep the pointer concept in your head all the time, while in C# you can focus much more on the functionality concept itself. Of course, it's not the same as in Python or others, but all that C# needs you to care about is delegate types (after all, it's a strongly typed language). And, to top it up, lambdas are a quite nice plus.
herenvardo
+1  A: 

Sure. One of the things that you learn about programming languages is that there isn't really that much difference between them. Once you learn one or two pretty well, you should be able to pick up others in a matter of hours or days - the syntax may change, but the concepts don't. What's challenging is getting the right mindset for programming in the first place and learning the API for getting things done with a particular platform and language.

C# is a perfectly good place to start because it maintains most of the features of more advanced languages while keeping away the most complex parts, and still allows you to develop full-featured GUI applications.

Mason
Yep, and it's pleasantly surprising that JavaScript and Actionscript share similar syntax. That creates it;s own problems but once you get the syntax and understand what an object is in OOP then everything else gets easier.
robault
A: 

Start with Scheme ..that's what they teach in school first.

yogsma
+1  A: 

IMO, the ideal learning order should be:

  1. A wide background on Math (strong arithmetics and algebra, good formal logic (a.k.a. Boolean algebra), and optionally some set theory).
  2. A solid background on digital electronics.
  3. A good background about hardware: what a computer has, what can it do, etc.
  4. Machine code/Assembly, because it (machine code) is the only thing the machine really handles (and assembly is the only "sane" language close enough to it).
  5. Some low-level language; probably C because of it's prominence at that level (does anyone build systems with something else than C/Assembly?). This includes going down to interfacing with your platform of choice (for example, building some GUI through the Win32 APIs).
  6. Any OOP language, ideally C++ (because .Net languages and Java normally use intermediate bytecode).
  7. A good interpreted language, like Perl or Python.
  8. Anything you want.

While I really thing this is the best learning order (the knowledge acquired through that path always builds upon the preceding steps, and ends up covering most of the aspects relevant on modern computing), it'd be an utopia. I didn't follow that path (although I have dealt with most of the languages listed), and it's not practical to follow it on modern times: it may involve years of studying before you can take profit of your skills.

Recently, I started private classes on programming and I'm teaching maths (as needed), pseudo-code, and C#. Sincerely, I think C# is the sanest choice as the first language: it takes you quite early into nowadays' most used stuff: GUI, DB, Networking, etc, and it isn't as aberrational as alternatives like VB.

It would also be advisable to dive a bit on other languages spanning different paradigms, just to get a bigger picture about programming. I'd suggest Assembly (preferably on a virtualized system, because bad things happen) and Python or Perl.

Just my opinion.

herenvardo
+1: Nice list - I would add SQL in there somewhere, probably 5a.
RedFilter
Touché. I don't normally see SQL as a *programming* language, although some variants are even turing-complete. SQL as a programming language would go, IMO, grouped in 7 (that entry is intended to broaden the picture about programming, so it's a good fit); SQL as just a query language wouldn't be a programming language, so it wouldn't go on the list at all. While it's good to know SQL, I limited the list to programming languages so I wouldn't have to mention HTML, XML, LaTeX, and many others.
herenvardo
Almost want to downvote this for your #1.... what do you mean by a "wide background in math"? Solid arithmetic and algebra is needed, especially when it comes to understanding concepts of order of precedence. Anything past that, it really depends on what you're doing. One of my peeves with the US tech education is way too much emphasis on math. Calc 3 seems more important in many educators minds than actually teaching software engineering principles or how to build an effective UI.
Jim Leonardo
That's quite what I meant, I'll clarify it to prevent misunderstandings. Thanks for pointing out the issue.
herenvardo
How come that Java and .NET languages aren't compiled??
Tomas Petricek
@herenvardo: you can shoehorn SQL into programming if you think of it as a flexible data structure :)
RedFilter
@Tomas: corrected. The idea of #6 is to introduce OOP, and to show how it maps to machine-code. My statement about compilation was an over-simplification. And yes, I know that CIL is normally JIT-compiled at runtime, but inspecting the machine code is quite more tedius than opening the output of a C++ compiler on an hex-editor or dissassembler.@OrbMan: still, I think it's place, if included, would be at #7: the reasons are the same as in my previous comment. Even so, SQL is more often used as just a query language, so I'd rather keep the list simple while I can.
herenvardo
Thanks for the correction. However, I still think that your approach isn't sensible - you seem to propose that one should learn all the background before starting programming. I doubt anybody ever learned programming this way. I think you need to start with something that is simple and fun (in these days Python or F#) and then explore the related topics (functional programming and math, object-oriented programming and UML, C and assembly, ...)
Tomas Petricek
this would be a great ideal path, but I think 99% of all people would be scared to death by assembly as a first language and never want to program again...
CrazyJugglerDrummer
Indeed, starting with something funny would be... more funny. Maybe I should have stated this more clearly: what I listed is an ideal path *in theory*, but I already admitted it's not practical at all. OTOH, with so much competence out there, maybe scaring competitors is not a bad idea <evil grin>... In practice, it may be Ok to reduce steps #2 to #7 down to the core concepts, learning what the machine can actually do on itself and then seeing how everything else is built on top of that. [Continues...]
herenvardo
[Continuation... I hate size limits]It's annoying to see how so many self-called "professional programmers" have no idea about what a message loop or a stack overflow is, or think the compiler must be bugged because their cute WinForms UI freezes when in response to a button click the code attempts to read several MB through a socket in the main GUI thread... Most of the walls recent programmers find would fall like sheets of paper when faced with a decent background.Have you noticed how many "great" products out there ask for obscene prices while their "trials" often BSoD your PC or worse?
herenvardo
@Jim Leonardo , Thank you!!!, you took the words out of my mouth... I was never good at Maths and it stopped me from getting into computer programming courses at college and university. I finally got a place at University for a computer science degree and came out with a FIRST CLASS, so screw the 'wide background in maths' crap, yes programming involves math but you do not have to be amazing at math to program!!!
Dal
Of course, you don't need to be *amazing* at maths. But having a good grip on the concept of "function" and decent understanding of boolean logic are essential; skills in mathematical analysis are valuable for efficiency check/optimization; Set Theory can give you a far wider view on the concept of "data types"; and quite more depending on the purpose of what you are building (graphics, scientific and financial apps, for example, require a good deal of maths). Also, understanding what's going on behind the scenes is always a plus, and that involves some maths 99% of time. *ideal* != *must*.
herenvardo
A: 

In my opinion may be it's possible to learn C# as your first programming language, but it's very difficult (I should say impossible) to learn programming using this language. Using any mainstream (may be it's better to say industrial or production) language. This languages are overloaded by different programming concepts, syntactically complex and has enough "dark places" to confuse newbies in programming...

And it's not only my opinion (of course). Take a look at what Niklaus Wirth thinks about it.

So you can choose another road and learn Component Pascal for example. The only problem on that way is the lack of books. It seems that this book is the only option.

Anyway, good luck!

kemiisto
As far as I can tell, Wirth's main objection is that C-derived languages use `=` as the assignment operator.
Gabe
A: 

I'm a C# convert and I freakin' love it when coupled with Visual Studio Intellisense and autocompletion. It's basically the nicest programming language/IDE combo.

I would say that C# is probably one of the best first languages as it teaches you some lower level, C-like programming but gives you an easier to use and manage object/memory platform.

Nick Bedford
A: 

I learnt C# as my first "serious" language (I knew a bit of PHP and actionscript before, but nothing serious)
And while it wasn't horrible, I'd strongly recommend combining learning C# with learning C.
I learnt C# in school for 3 years, and then learnt C for a year, and came back to C# knowing how everything works MUCH better.
Especially recursion, arrays, pointers, etc. Just like assembler helped me understand C better.
To sum it up: It's not a horrible language to begin from, it's pretty noob friendly, but for deeper understading I'd learn C aswell.

Rubys
A: 

It's a nice, clean language with good software and community support, and I wouldn't say it requires anything a beginner wouldn't have.

That said, I was faced with this question recently in helping a teenager learn to code. I decided in the end to steer him towards VB.Net instead; not because of any preference on his or my part - he didn't ask for anything specific, I use both - but I felt its increased verbosity was beneficial to a beginner. With less symbols and more words, I think most complete novices would find VB.Net a less intimidating starting point for no great difference in results.

eftpotrm
A: 

Absolutely it is possible. I taught my son C# as his first programming language so that he could do a science fair project. He was 13 at the time.

Malcolm Post
A: 

I think C# makes a great first language for someone who will go into more serious programming or computer science. There has been a movement towards Python as a first language recently, and while I love Python, I think it's a poor choice for a first language because it lacks data abstraction. C# on the other hand, has excellent support for data abstraction (properties is one place where it shines compared to competitors like Java).

It also has a huge standard library behind it that enables beginners to write functional programs that do cool things early on (which is essential to keeping a beginner motivated).

After the student masters the basics of object-oriented programming, C# will also let them add other paradigms to their repertoire without having to learn a whole new language.

smehmood
A: 

C# is a really good language to be learning first... However having learned C and VB .NET at first, in my opinion will give you significant boost :)

Ranhiru Cooray
A: 

I think languages like: C, C++. Are the best languages for beginners - they help you understand how the system works - what is memory, how to use it, allocate, and so on. C# and its garbage collector allows you neglect this things.

Alamo