views:

1920

answers:

27

I'm want to learn one of the above languages. I'm a PHP/HTML/CSS programmer and I would like to get into desktop applications. I need something pretty powerful and I would like to be able to create applications with Windows GUI's.

What would the Stack Overflow community recommend? Is there any knowledge I should have before diving into these languages?

+17  A: 

Take a brief look at C first, to the level of writing a few tutorial programs. C is small, well defined and the definite language definition (Kernighan & Ritchie - The C Programming Language) is only a couple of hundred pages long. Although getting your head around pointers and recursion can be a challenge the language itself is sufficiently small that it's possible to know the language completely. One of the pleasures of writing C is it's not too hard to reach the level where one can just code without having to continually refer to documentation to see how to use little know feature x or library function y. Think of learning C as putting the foundations in.

However to actually write useful applications you'll want to use C++ or C#. Which depends on what you wish to write. C# will probably score in most business-orientated cases because of garbage collection and general ease of use, but C++ would score for high performance, low level, or game domains. There's also vast amounts of C++ library code available which can be leveraged relatively easily (and pure C code too which is easily adapted). If your aim is to write something with a particular problem in mind then the availability of such could most likely offset the higher overhead C++ has in just getting things done.

By way of example on this I did a filtered search on 'image' on Sourceforge and returned the following project count

C# : 139
C++: 569

And even with something purposely more business-orientated C++ still scores higher - 'finance'

C# : 12
C++: 32

With anything mathematical or technical the score is heavily weighted against C# - 'fractal'

C# : 4
C++: 44
C : 24 <-- (C++ explicitly excluded)

This is a pretty crude analysis of course, but for example if my aim was to write a desktop fractal generator program then I'd pick C++ over C# as the extra effort involved in handling the UI in C++ would be easily offset by the plethora of example code available in C++. OTOH if I was writing a business application where there was no great advantage to having example code and lots of UI to handle then I'd go for C#.

Afterthought edit: Another reason for at least familiarising yourself with C first is that there's also Objective-C as the main development environment on the Mac and iPhone. Objective-C is C with a very thin wrapper and only really a first cousin to C++, so if you envisage that you might ever be in the position where you want to port code to or develop directly on the Mac then I think you'd find it less confusing if you at least have some feel for how C++ (or C#) builds on C rather than having to 'step sideways' across the tree.

Cruachan
It's always nice to learn C, but to make desktop apps?
Dave Van den Eynde
Oh sure, why not take your aircraft carrier on fishing trips?
annakata
annakata, if I could only vote up comments :)
Binary Worrier
Getting your head around recession? Does that make C the official language of the credit crunch?
Pourquoi Litytestdata
Haha. Freudian slip, fixed to recursion ;-)
Cruachan
I think this is good advice. You gotta crawl before you can run (stably at least), +1
Ali Parr
Funny. You think C is the crawling bit, and I think C# is.
annakata
+6  A: 

If you want to be a programmer, learn C.

C gives you an understanding of how the machine works, and gives you insights into what is actually happening in the JVM, in whatever language you're using.

It also gives you pleasure to use other languages (such as Java, VB.NET) afterwards, because you don't have to jump through all of the hoops that C makes you.

I learnt C, and I feel I am a better programmer for it. I understand more.

MatthieuF
This is a pretty obnoxious statement for all of us who are most definitely programmers who haven't learnt C.
annakata
"if you want to be a programmer, learn C"?wtf.
Andrew Bullock
I *did* learn C, and I still find it an obnoxious statement...
Marc Gravell
Pretty much obnoxious if you're just gonna state someone else's view without much explanation.
Dave Van den Eynde
Ditto: I also know C, and learning C gives you insights that may be harder to grok with higher level 3gls, but I know fantastic programmers that understand those things that have never learned C.
Binary Worrier
it is somewhat arrogant; but carries a often-forgotten truth: to be a really good programmer, you _have_ to know how it works under the hood. C is the easiest language that still works with that in mind.
Javier
There was nothing obnoxious meant. Of the programmers I know, the programmers who have started with C are amongst the best. You want to understand, you learn C, or assembler. Everything else is easy after that :-)
MatthieuF
Rob
I spent an entire class and a good deal of free time studying the book and course material for "The Elements of Computing" and I feel like I have a very firm grasp all the way down the computer abstraction stack. And nowhere did I even come close to touching anything close to C or C++. HDL for chip design. Ruby for creating an assembler. And C# for creating: a VM, compiler for a Java like language, and a mini-OS. Just sayin.
colithium
+15  A: 

"I need something pretty powerful and I would like to be able to create apps with Windows GUI's."

For rich windows GUIs, I'd be tempted to look at the "xaml" variants: WPF (full desktop) and Silverlight (like flash) - this will give you the latest tools etc, and a lot of styling power.

For this, C# would be the primary choice. Managed C++ is an option, but it's more work.

Marc Gravell
Managed C++ is improved a lot and it is C++/CLI now. Using WPF with it won't be a big work, IMO.
Appu
I wouldn't recommend Managed C++ to a noob in a million years, far too many layers will generate absolute confusion if you don't know what you're looking at (e.g. .net, stl, managed v's unmanaged, and classic c are all available to get tangled up in, far better to simply go with C# IMHO)
Binary Worrier
+5  A: 

C# is the highest-level language of these, which means that it's the easiest one to accomplish what you want.

Windows GUIs can be surely made with C++ and even with C, but it's harder.

Joonas Pulakka
+1  A: 

It doesn't really matter what kind of language you start with but if I were you I would do:

Start with the basics in C (It will probably be hard to understand) Move to C++ And at last C#

PoweRoy
+6  A: 

C# vs the others really solve quite different things but given your web background and it's rapid development approach, I'd definitely go with C#

annakata
So its pretty much an exchange of rapid development for a low level.
Sam152
yep - and in my experience, if you're writing a desktop app you just don't need to be that low level. My view is that C++ et al are serious tools for creating really high-performance apps, but the cost is slow-dev.
annakata
+1 - If you are trying to learn computer programming or architecture, then it makes sense to learn C or C++. For all but a few standard applications and *especially* for web apps, C# is the way to go. Marc's advice regarding WPF/Silverlight is good too.
Mark Brittingham
+2  A: 

I woudl recomend C#. It's not as powerfull as the other two, but for your needs I belive C# will be least painfull. C and C++ are low-level languages, so I think they will be a lot of work for GUI and stuff.

martiert
+1  A: 

Without C/C++/C# experience start with C. Edit: Ok, start directly with C# or C++ don't lose time. You cannot seriously code Windows desktop applications with C anymore, it's just to painful.

Then move to Object oriented languages to get something more powerfull.

If you wan't to stay far from windows plateform, C# is not the better option, or check out the Mono plateform.

IMO, C# is far more advanced than C and C++, you will build big application faster. WPF librarues will give you nice UI without windows style (but only on windows systems...)

Think Before Coding
+3  A: 

Save the C. To those people that advise learning C, please give arguments for that. I claim that it has absolutely no benefit to learn C rather than C++. I, unlike them, have arguments to back this claim up.

In a nutshell: C is already a subset of C++ for all intents and purposes, but it's far from the most interesting subset. It only offers a very limited insight into new proramming paradigsm. C++, on the other hand, defines a few very interesting new paradigms which, furthermore, are a generalization of all that C has to offer (i.e. iterators which are a generalization of pointers).

To reiterate: if the choice is between C and C++, choose C++.

Konrad Rudolph
I'm voting for C# myself, but this is a really nicely written argument
annakata
Totally agree.Why "taint" a fresh mind the procedural programming paradigm if he can dive right into the "real" stuff without learning bad habits somewhere else.Also, there's always enough rope to hang yourself no matter what language you use ;)
Tigraine
Tigraine: notice that I nowhere said anything against procedural programming.
Konrad Rudolph
But if you never intend to learn C++ and you just want to branch out C is faster to pick up and you will feel like you have learned something faster. C can be grokked in a few weeks to a few months. C++ takes years to truly grok.
jmucchiello
+1  A: 

I'd suggest you start with C#, but quickly progress to C++ as once you have learnt how to code generally, you should return to your roots. I'm currently studying electronics because I'm going back even further. The more you know about how and why, the better you can know about how best to get where you need to go. I think a C# programmer that doesn't know any lower level language is going to write rather sub-optimal code, but a low level programmer learning C# is going to be overly cautious of all the managed stuff. So, whatever you choose, you should consider doing both in the long run.

Richard Fabian
+3  A: 

In my opinion you should starting studiying C, to have a base knowledge about aspects like memory, file accessing. C is a low level languaje, this means that you will have more control over the way you access to operating system, but to create windows application you'll have to code a lot of lines of code. For this reason, after doing few things with C, i should start with C# with Visual Studio 2008. .Net Framework comes with a huge number of classes that makes your life easier.

Hope it helps. Kind Regards. Josema.

Josema
+56  A: 

edit:

A web programmer wants to create Windows applications and you recommend C?

What's wrong with you people?!

/edit

Obviously C#.

C# will be easier to get into and will let you build Windows applications using WinForms or WPF and all the new Microsoft toys in .NET. If you know your way around PHP, you should already be familiar with the syntax, object oriented concepts, exception handling, etc.

I suggest you don't complicate your life with C and definitely not with C++ if all you want is to create Windows GUIs. They do provide a good educational experience and they are useful for more advanced things (cross platform development using other toolkits for instance) but at the price of a steeper learning curve and reduced productivity.

Also, if you are a web developer, C# is the only language among the 3 options that you can (realistically, heh) use for the web. ASP.NET is not a bad framework and might be worth investigating too.

Tiberiu Ana
He didn't say easier to get into, he specified powerful, so the question is much more open than just the path of least pain.
Cruachan
He said he needed "something pretty powerful" and that sounds to me rather meaningless in the context of the question.
Tiberiu Ana
Like the edit ;-p
Marc Gravell
me too - I wish I'd thought about big fonts on mine :)
annakata
Well it depends what he means by pretty powerful I guess (can do stuff vs minimal lines of code to do stuff) but I still think *what* he wants to write, and the existing code base that can be accessed to support that, trumps actual language issues.
Cruachan
if he wants to go forward, C is a must. if just want to fool around and write some windows-only code, and not learn new ways of thinking, use whatever is easier.
Javier
@Javier, C is great, but it's a HUGE barrier of entry for anyone who wants to write Windows applications. Plenty of folks never learned C and "go forward" every day.
Robert S.
i agree with your answer. but why do you say "...and definitely not with C++..." ? sounds like C++ is worse than C for this task...
Johannes Schaub - litb
@litb: Well, I was thinking that C++ does quite a bit more on top of C, so it takes extra dedication to get into it from scratch. But true, plain C is not much of an option for doing Windows GUIs.
Tiberiu Ana
+1 Love the big letters and the sentiment. It's astonishing enough that C/C++ continued as long as it did for writing GUIs, and that's no reason to inflict that experience on anyone now.
Daniel Earwicker
+5  A: 

definitely first go to the basics: learn C.

then go to your real goal. if you want any chance of going multiplatform C# is discarded. you'd want to go with C++ and Qt, or wxWindows.

Javier
+3  A: 

C/C++ both allow low level programming. That means that everything is possible, but even simple things can be hard. If that's what you mean when you say that you want something powerful, you should probably start with C++. It at least gives you some decent GUI libraries (gtk+ with gtkmm or qt), whereas GUI programming with C is a pain.

If, on the other hand, you want to develop applications quickly (and that's what you mean by powerful), then C# is probably the way to go.

drby
+1  A: 

I would go for C#.

I've done my time (lots of it) with the other 2 and find C# 'cleaner'. You also get a rich library of all kinds of functions included in .Net. I assume that you're not interested in developing for other non-Windows platforms which might have been an argument for going for C or C++. I also assume that you don't need the squeeze the last drop of performance out of the system where C might have given you a slight advantage.

To those who say you ought to learn C in order to understand how programming really works I would say that you ought to learn assembler in order to understand how C works. I did and it does help but is it really worth the pain? To be a programmer you have to switch on your brain. Think about what you are doing and understand your tools!

My vote: C#

paul
+2  A: 

Although I agree that C is "useful" to know it is certainly no longer essential for the majority of programmers. For me these days it's main function is that it has given me an understanding of how the underlying hardware affects program performance and behavior but that's the end of it. I haven't used it in development work for the last 9 years.

In regards to getting to grips with object-oriented development I feel that both C# and C++ will give you a firm foundation but C++ is far more flexible (and harder to use correctly) while C# is more consistent and way to go if you're going to get into .NET development. I would therefore recommend learning C# and one of the "new" .NET-presentation technologies like Windows Presentation Foundation or Silverlight. Alternatively, learn Windows Forms first but it's a bit lacking in presentation.

The only case where I would recommend C is if you are going into fairly low-level stuff like device drivers, embedded controllers or similar but in most of those cases you could still use C++.

Hans Løken
+1  A: 

Learn C#.

Is good to begin with the basics, but better than begin with C I would begin with the basics of C#. This will give you a solid foundation with the fine points of C# basics and after you could move to more advanced topics.

For example you can take a look to Charles Petzold ".NET Book Zero" here.

DaniCE
A: 

With proper set of libraries memory in standard C++ can become as easy as managed (smart pointers). Some C++ widget libraries are as easy to use as C#.NET. However it will probably perform worse than C# due to several abstraction layers. And with C++ you need to learn non-standard libraries. With .NET most of the components that you need are standard.

C is ancient and does not have STL. It demands you to be smart, but I doubt the advantages of it.

Muxecoid
A: 

I need something pretty powerful and I would like to be able to create apps with Windows GUI's.

Well C is pretty powerful so that would would handle that criteria but something like C# and WPF would make life so ,uch easier if you're aiming to GUI apps.

Graeme Bradbury
+7  A: 

My suggestion is to learn C++. C# is good, but it will prevent you from writing portable code. If you learn C++, you got many choices. In windows you can use Windows Forms application or WPF with .NET framework. MFC is another good choice. QT is the other choice which works on multiple platforms. So by learning one language, you can write code for multiple platforms and you got a variety of GUI tookits. After learning C++, learning C# would be trivial.

All the best

Appu
If you want portability, mono is an ever-increasingly realistic option.
Marc Gravell
+2  A: 

Again, another vote for C# and against C. Sure C is interesting from a technical point of view and will teach you all the details, but the truth is, you don't need to know all the details to make an application. If your goal is to make something work, which it sounds like it is, it's C# hands down. C# is the highest level of the three, which means less time fighting the language, more time making stuff work.

It sounds to me like most people are recommending you learn C so that you can eventually make better C# programs. Why wait, go straight for C# and learn it. I do think C++ is an absolutely excellent language and one day you should learn it, but there's no reason why you can't make a quality C# language if you've never learnt C or C++ - many people do that every day!

Ray Hidayat
+1  A: 

I recommend::

First get into C. spend some time get use to it(but not too much)

Then get into C#. that's the way you can deal with GUI things more easyily. IDE like VisualStudio can help you a lot dealing with GUI.

If you wanna be a real good programmer of C/C++/C#, then it might be not the good way but I think you are not interested in being a Guru or something like that :)

Jace Jung
Do C, but leave before it makes you hard.Do C#, but leave before it makes you soft.And ALWAYS wear sunscreen!:-)
Peter Morris
+2  A: 

Having come up through the languages, first C on Unix, then C++ with MFC and then C# (starting with 1.0) I think that going back in time to earlier incarnations of the language is a bit like learning Latin. Oh, probably just stolen something from Paul Graham there but I would agree with it.

C is very good if you have to have a minimal object code size, very good for embedded stuff where it's one step up on the assembly language. I'm thinking of things like a Microchip PIC etc where you may only have 1K word of program space.

C++ is very good if you can have the larger object size but still need to be able to hammer the metal directly - so things like device drivers, network stacks, etc etc. The kind of glue program that sits under everything.

An OS could end up in either of these - or more likely a mix of the two depending upon the programmer, the age of the code, what it needs to interface with, the depth of the snow outside (just one more run and then I'll write that method!)

C# is really good at the higher level business focussed user layer applications. They could be web based, client based, a mix of the two - it doesn't really matter. The nice thing about the .net family is that you have a rich library, for this layer that is important, and it is being heavily developed to be richer all the time.

As computers become more powerful the cost of the developer outweighs the cost of the processor or memory.

Go with C#, ignore C and C++. By the time you are happy with C# you won't have any need to program in a lower level language for the speed increase.

Alan Mullett
A: 

Are you planning to make gui based applications for windows? Depending on what, I recommend VB. However, given your choices, I would pick C#.

Daniel
+1  A: 

There are a lot more jobs developing windows apps in C# than C or C++. Learn C#.

Rob K
+1  A: 

C# is a good place to start. You can get it for free and you can do some fun graphics using XNA studio (also free).

I would only learn C++ if you have a specific reason to.

If you are doing Windows programming I would recommend that you do the first few chapters of one of Petzold's Programming Windows books. It will give you a basic understanding of C and of how Windows works at the bare metal level. You don't really need to learn C. Charles Petzold holds your hand and gets you up and running in a basic C Windows program.

bruceatk
+1  A: 

Learn C#...if you want to develop desktop apps.