views:

135

answers:

2

I am a student and after taking some introductory programming courses in Java, C, and just finishing up a book on C++, I would like to start developing applications for Windows.

I have done my best to page through google and find the answers I need, but I seem to be at a loss.

When would I need the Windows SDK over just the regular API? And what is .NET and why would I need it? What is so special about C# and should I use that over C/C++?

Thank you so much, any help would be appreciated!

A: 

Windows SDK is a low-level framework for developing applications specifically for Windows. You could use it for your development. However, the APIs are low-level and a little difficult to use and maintain.

Alternatively, you could use .Net. .Net is a framework that includes runtime support for your application. It has many packages, I am sure you will find something useful in .Net. .Net needs a runtime for executation and is not compiled natively to the platform. However, it is easier for software development mostly because the APIs are higher level.

C# is the recommended language for Windows specific programming, specially on .Net. Not that it is the only language, you could also use C/C++, but they are not supported by Microsoft actively. For example, if you use C#, creating a GUI application could just a few mouse clicks. Using C++, you would need to manage your windows instances.

Typically, you would only use C/C++ for Windows programming if you are doing cross-platform programming or some low-level stuffs.

Kinderchocolate
"Typically, you would only use C/C++ for Windows programming if you are doing cross-platform programming or some low-level stuffs." - I have to object to this statement, as people (including me) use C++ for application development (and other things) extensively.
In silico
Also, there is no such language as C/C++. They're two different languages. Also, C++ is in fact supported by Microsoft actively. The Visual C++ team have their own blog (blogs.msdn.com/b/vcblog) and have released Visual C++ 2010 that has partial support for C++0x, the latest version of C++. If you're comfortable with C++, it's more than fine to use C++ for Windows programming.
In silico
"Using C++, you would need to manage your windows instances." - I also have to object to this statement, as there are C++ techniques that allow you to not worry about managing resources using idioms like RAII.
In silico
"Windows SDK is a low-level framework for developing applications specifically for Windows." - This I **don't** object to. :-)
In silico
Visual C++ is not the same as C++.
Kinderchocolate
Well, anything that you put on C++ to encapsulate low-level stuffs, for example the RAII that you put on is not a part of the language. You still have to do it, but just hidden somewhere.
Kinderchocolate
What is the difference?
Andrew Guenther
The syntax is similar, but Visual C++ is designed for Windows. It has things like handles not available for C++.
Kinderchocolate
@In silico: I'm sure what he meant by C/C++ is C or C++.
Paul
@Kinderchocolate: Visual C++ is an IDE, not a programming language. You're most likely referring to Managed C++ or C++/CLI.
Paul
Yeah, sorry, I meant Managed C++.
Kinderchocolate
Oh, okay, I misunderstood that part.
In silico
a very biased answer towards C#, a programmer wanting to embark on windows programming should be given the facts and allowed to make their own decisions on what suits them best.
freefallr
@Paul: Visual C++ is the compiler, the IDE being Visual Studio :) </nitpick>
snemarch
+6  A: 

When would I need the Windows SDK over just the regular API?

The SDK includes headers, libraries, tools, etc., that give you access to the API (and to .NET, for that matter). For example, a typical API-based program will start with #include <windows.h> -- but without the SDK, you don't have a copy of Windows.h to include. Likewise, the SDK includes the compilers (the same actual compilers included in the current version of Visual C++), linkers, debuggers, etc., necessary to actually build an API-based program.

And what is .NET and why would I need it?

.NET is a couple of things: a virtual machine that executes code in what Microsoft calls "intermediate language" (IL). It's also a (large) library of code in IL for everything from window management and drawing to communications, system management, etc.

You'd need it primarily if you were writing code in a .NET-based language such as C#, VB.NET, etc.

What is so special about C# and should I use that over C/C++?

C# is Microsoft's favorite flavor, so to speak. It's a language they invented themselves that they generally promote over most of the alternatives as the primary language for use under .NET (and, although rarely stated directly, at least by implication, for any new development). While there were originally accusations that C# was little more than a rip-off of Java, it's actually had a few features for which Java had no counterpart (e.g., delegates) and has since added more (e.g., language-integrated query).

As to whether to use C# over C or C++, that's likely to depend heavily on the sort of code you write. C# gives you access to the .NET library, which contains a truly huge amount of pre-written code. If the things you need to do in your application(s) fall almost entirely within the range supported by the .NET library, being able to use that code may make your job substantially easier. A few features of C# have no direct counterpart in C or C++ either, so if your code can benefit greater from those features, C# might make such a job a great deal easier. Finally, Microsoft concentrates a great deal of effort in their support infrastructure on C#, so many of their tools (including, but certainly not limited to, Visual Studio) are basically written to support C#, and tend to do less to support other languages.

OTOH, if you want to do things for which .NET does not provide pre-written code, the situation can change quite quickly. C# does support a mechanism (called P/Invoke) to let you use things like operating system functions for which .NET doesn't provide wrappers. Unfortunately, P/Invoke tends to be fairly painful to use -- if you have to use it very much at all, there's a good chance that C++ (or maybe even C) would be more productive.

I should also mention that while it appears Microsoft has dedicated more resources to new development of C# than other languages, they're still clearly doing new development of C++ and their MFC application framework as well. There's no question that in terms of sheer quantity of new code, they're clearly doing more with .NET. Nonetheless, some of the new developments in MFC happen to be in areas that they have not developed in .NET, so MFC has a few capabilities for which .NET provides no counterpart.

Jerry Coffin
+1 - nice answer. I think "flavor of the month" is a bit dismissive given we are now at .Net 4.0 - this is more than just a fad at Microsoft, it's their strategic direction for enterprise development, replacing Win32 for all but the most specialized usage. To contrast: .Net Remoting was "flavor of the month", now they want all to use WCF, for example. btw Windows SDK combines Platform SDK and .Net Framework SDK into a single package.
Steve Townsend
@Steve: fair enough -- modified.
Jerry Coffin
Thank you so much! Your answer was amazingly helpful!
Andrew Guenther