RE: New to application programming... Please HELP!

From: Jim (anonymous_at_discussions.microsoft.com)
Date: 03/25/04


Date: Thu, 25 Mar 2004 14:16:07 -0800

Well, hello there Mr. Newbie... Let me see if I can answer your questions as succinctly as possible:

Q: Is programming Windows using the API the best way to go?

A: If you understand the basic gist of how C language works (functions, arguments, and return values) works, then you need to understand that Windows is, for lack of a more in-depth explanation, a program. The API, or "Application Program Interface", therefore, are simply pre-compiled C language functions (C is the predecessor to C++). Everything that runs under Windows uses the WIndows API, no mater what language it is written in.

Some languages will attempt to "wrap-up" or encapsulate the Windows API to give it a more object-oriented look and feel. With a GDI and event-driven environment like Windows, doing this makes it a LOT easier to program than natively programming the API. Depending on what you want to do with your programs, you will may or may not care to have direct access to the API (and from what it sounds like you want to do, you really won't). If you're writing things that are very resoruce intensive, such as games or other high-performance software, you may need a LOT of direct access to the API. On the other hand, if you're writing very ordinary Windows programs, i.e. simple user interfaces, or the back-end for web aplications, you will need little or no access to it.

C++ is, by far the language of choice for those who consider themselves "real" programmers. That is because of C++'s extensive use of operators and data types, and it's object-oriented structure, lend it well to doing almost anything. There is nothing you cannot do with C++, and that is not the case for some other languages, such as Visual Basic (which, for example doesn't handle moving memory objects around very well... Not that you need to all the time, but it's nice to have that flexibility when you need / want it.)

For all of it's object-oriented look and feel, Windows, and the WIndows API is in and of itself NOT an object-oriented thing. In fact, for a new programmer, the task of programming Windows via its native API can ofte times seem convoluded and non-intuitive. If you thought understanding pointers for C++ was rough, and didn't quite get the whole thing with main() and why it had that "int argc, char* argv[]" thing in there, then have a look at the WinMain() function of a prototype Windows application and you'll see just how deep the rabit hole goes....

In an attempt to make programming the API easier, moer intuitive, and to provide a standard by which to make applications more consistent and extensible (maintainable), Microsoft introduced the Microsoft Foundation Classes, or MFC. MFC dosn't contain any executable code, per se; it is a hierarchical "application framework" of C++ classes that was designed to present the most useful functionality of the Windows API in an object-oriented way. MFC makes it (with some argument) considerably easier for the C++ developer of average skill level to venture into the rather ominous world of Windows programming. MFC is not a programming language; as I said, it's simply a set of pre-defined C++ classes, from which you inherit and then extend with your own code to develop WIndows programs.

Are you still there? :-) Okay...

Q: What about all these languages? Which one is the best? Which one is the right one for me?

A: Languages are tools, and as your granddaddy told you "Son, use the right tool for the right job..." C++, as I said, is an extension of a language called "C", and C language has the virtue of (according to tis original designer, a fellow named Dennis Ritchie with Bell Labs) being a language developed "by programmers, for programmers." Again, as I said before, most people who regard themselves as "real" programmers are programming in C++, or at the very least C++ is where they cut their teeth in the world of real programming. Having said all that, C++ is not the end-all-be-all of languages...

Visual Basic, for example, is the (very, very, very, very, very, very) extended version of an old personal computer language called "BASIC" (Remember your old Commodore 64? LOL... I still have my TI-99/4A <smug grin> ) Visual Basic, while barely recognizable as BASIC by those old standards, has the virtue that, being very object-oriented, it is extremely easy to use, relatively powerful, and easy for even non-programmers to lean <gasp>. Visual Basic (VB, as it's called) is a good language for putting together a functional program in a big hurry. Ad hoc programmers like VB, and it's also useful as a prototyping tool even for "real" programmers, when you're only concerned about getting the mock-up of an interface going, for example, and not too terribly worried about al that stuff under the hood until later in the design phase. The major drawbacks to VB are that, because it's so easy to use (even for those (cursed) non-programmers), it encourages sloppy design. Throwing something together in a hurry is se
ldom ever a good way of getting the job done, especially if you think you're gonig to need to go back and extend or modify its functionality later. VB is also somwhat limited in the things it can do. It's use of operators and data types is somewhat restrictive, and as such, some tasks (such as memory management and dynamic memory allocation) can be tedious if not impossible.

Java, a language which you're at least vaguely familiar with, I gather (even if in it's watered-down JavaScript form for the web), is Solaris' answer to the problem that C++, being a platform independent language, either needs platform-specific extensions or a lot of work on the developer's part to make it integrate well with modern GDI's, among other things. Java takes the best functionality of C++, wraps it up a pre-defined set of classes that are cross-platform compatible, and does a good job of providing a language that can do a lot of things, whether you're on a Linux, Novell, Solaris / Sun, AS400, Mac, or MS-based system. It accomplishes this with something called a JIT ("Just In Time") compiler, that actually waits until you run the program for the first time to finish compiling it. The JIT fine-tunes the program's compilation process to meet the needs of the platform its running on. Java, however has some of the same limitations of VB. When you're working within the Java pre-defined classes to d
o things, yuo're fine. While you "CAN" go out and get access to things like the native Windows API, when you do so you're (as they say in JavaSpeak) "playing outside the sandbox", a practice which is not recommended and kind of out of the spirit of Java programming. Java is a good language, but it never took off as well as some other implementations, such as MFC and Borland's OWL ("Objects With.... um.... "Links", I think...) did. (OWL is Borland's own C++ framework to encapsualte the Windows API. I have never touched it, and know nothing about it.) The C+ and Java camps really kind of did a lot of head butting several years ago, as Microsoft decided to invent their own flavor of Java, called J++ (and enter JScript, and the obscure and almost totally unused J#). I think the widespread exisiting support for C++ and the uncertainty over the exact future of Java have doomed the language, at lest on the MS paltform, as a development language and has banished it to the realm of JavaScript, which in contrast
 has quite a presence on the web as you know. :)

Q: What's all this .NET this and that stuff?

Wow... I actually out-typed the limit for a post... LOL Never had that happen before. Does this mean I have to charge you $19.95 for my "e-book"? LOL... I'll pick this up in the NEXT post... :-)

JIM