C++ Books (What's "MFC"?)

konichiwa

Lifer
Oct 9, 1999
15,077
2
0
I was just in Borders and I naturally gravitated towards the computer section. I don't know if any of you remember, but a few days ago I posted a thread basically asking whether I should start my journey into programming with Visual Basic or C++.

The general concensus was that if I learned VB first I would probably get some lazy habits that, when I delved into C++ would kill me. So I decied what the hell, I'll just dive in the Pacific with no thermal gear, air tank or shark cage and learn C++. ;)

Where was I? Oh yeah...Borders. Wrox books. I saw a book by Irov Horton, Beginning C++ and sat down to start reading it. In the aformentioned thread a couple people highly recommended Wrox books...and this one happened to be published by Wrox. The first chapter really caught me and I like it a lot, it seems like a good book to learn by.

So finally, to the question (yikes that's a lot of lead-in) ... after reading the first ~20 pages (plus forward, intro, etc) of this Beginning C++ book I looked up to the shelf and noticed a Beginning Visual C++ 6 book by the same author, same publisher.

Therein lies my question...since Visual C++ 6 is most likely going to be my C++ program/compiler of choice, am I better off going with this book or the generic C++ book? If anyone has read either of these books and can tell me whether the former is too generic or the latter will teach me too much about one specific program and not the general language I'd greatly appreciate it.

All in all I guess I'm just trying to figure out whether I should get the C++ book or the C++ book aimed at Visual C++ 6.

Thanks, and sorry for the longwindedness. :)
 

Pretender

Banned
Mar 14, 2000
7,192
0
0
That's a tough question. The following advice is based solely on my experience with C++/Visual C++ books, and might not be necesarily true in this case-

C++ books will give you the basics on the language (how to write functions, how to work with variables and stuff), while Visual C++ books will only tell you how to write Windows programs using Visual C++, but will skip all the language basics. Considering how you're starting from scratch, I'd start with a C++ book (or if you want, try to read some basic C++ beginners guides online), then move on to the VC++ book(s).
 

EmperorNero

Golden Member
Jun 2, 2000
1,911
0
0
here's a c++ book recommendation (my comp sci teacher recommended it to me): object oriented-programming in c++ (3rd edition) by robert lafore. what you should do is go to amazon.com and read reader's reviews for books you're interested in. it received 4.5 stars out of a total of 29 readers:

here

now onto the question of c++ vs vc++. like pretender said, the c++ book will actually teach you to program in c++ while the vc++ will only show you how to use the program and MFC. for starters, get the c++ book. in that book, you'll learn the basics of c++ by programming in console mode. and to do that, you'll need to know how to make console programs in vc++ (if you plan to us vc++). the steps are pretty simple, so ppl here can help you with setting up the console mode.

to wrap it up, you want to learn to program c++, so get a book on that. then when you know the basics of c++ and feel like you're ready to make graphical windows program, then buy the vc++ book.
 

Oh my, must... remain... neutral ...

MFC are the &quot;Microsoft Foundation Classes.&quot; MFC is an <cough>Object-Oriented framework for building Windows applications.


 

I have been know to bash Microsoft technologies from time to time. Like everytime I post about them :)
 

Pretender

Banned
Mar 14, 2000
7,192
0
0
Some people dislike when certain large multibillion dollar companies making things somewhat easier to program for. Some just dislike microsoft in general. Some just dislike MFC because it's a pain in the rear end to use at times.
 

denali

Golden Member
Oct 10, 1999
1,122
0
0
konichiwa:

The problem with MFC is that they are really just a C++ wrapper to C functions. MFC was not designed/implemented in a truly OOP paradim. The Qt
cross platform toolkit on the other hand was designed/implemented entirely in the OOP paradim.

As others have stated you would be much better off getting a C++ book that does not use MFC. I assume you are running MS Windows if so you might want to consider using
Cygwin instead of Visual C++.

I would say the biggest factor in deciding what tools to use is what types of programs do you want to create.
 

konichiwa

Lifer
Oct 9, 1999
15,077
2
0
Okay so let me see if I understand this correctly...(I'm sure I don't :))) so feel free to correct me)

MFC is an &quot;extension,&quot; so to speak, of C++ designed by Microsoft to make programming for/in a Windows environment easier? Right? Close to being right?

If that is close-ish to what MFC really is, then why do you hate it so much (without going into great detail or using lots of programming jargon and technical terms)?
 

konichiwa:

MFC is not an extension to C++. It does not enhance the language in any way. It is simply a library of objects used to make Windows programming easier.

It does use a minimal set of C++ functionality to make things easier. Microsoft has referred to it as using a &quot;sane subset&quot; of C++ functionality.

It sounds great until a)You lose your mind dealing with all the message maps and arcane data type mappings or b) Use a &quot;real&quot; OO framework like QT or Java and realize that MFC was written by a bunch of morons.

I knew I could not make the post without dissing MS. Sorry :(
 

denali

Golden Member
Oct 10, 1999
1,122
0
0
You are basically correct that MFC is an extension of C++ but all it does is hide the underlying C code from you. The main reason that I don't like using MFC and Visual C++ is that you are pretty much forced into using MS tools. If you want to use a different editor for example it's very hard. Also trying to maintain/debug/modify programs using MFC/Visual C+ is very hard.

Also if you want to run your programs on a non-MS OS you are SOL if you use MFC, this might be fine with you. Also you will have a much better understanding of the C++ language if you don't use all the visual tools. The real money is not in programming but in doing the design and here is where a good underlying foundation in C++ will be most useful.
 

konichiwa

Lifer
Oct 9, 1999
15,077
2
0
Thanks for all the help so far, guys. I really appreciate it. :)

As of now I think I'm going to stick with the general &quot;Learning C++&quot; or whatever it was called, because I think if I want to ever get somewhere with C++ (whether it's a) programming for the hell of it; b) getting a c++ job; c) learning (an)other language(s) that knowledge of c++ would make it a lot easier, IE Java) I should learn the basics first.

And after I learn the basics and become more familiar with them I'll (most likely) be able to make my own decision as to where to go from there...to aim mostly at windows and learn MFC, or continue learning C++ or choosing another language that has a lot of the same roots as c++, again, IE Java.

I'm still open to suggestions, but that's my thought process right now. Any other thoughts from you guys?
 

Sounds like a good move. Once you learn the C++ basics you can pick up Java in a heartbeat. Also MFC will be easy to pick up if you want to go that route.
 

EmperorNero

Golden Member
Jun 2, 2000
1,911
0
0
in laymen's term, MFC is the thing that creates GUI windows. for example, if your program runs in console mode, it just runs in a plain looking DOS window (under windows OS). as for MFC, you can create graphical windows, such as the browser you're using to read this.

I have a question: I've only been exposed to MFC, so what are some other alternatives to MFC?
 

Weyoun

Senior member
Aug 7, 2000
700
0
0
heh, program in OpenGL and make everything 3d.... :)

as for the actual thread... :)
I highly recommend learning the basics first, as programming straight out of a VC++ book will give you a very little amount of information, and you really wont understand what you're typing. As for me, I plan to do some OpenGL stuff later in life, eventually combining everything to create an ultimate detail level engine that can actually predict time (well that's the way the theory goes :) )
i want quantum computing and i want it now!! :p
 

hans007

Lifer
Feb 1, 2000
20,212
18
81
from my very limited experience with visual c++ and java, i'd say java seems more organized, so learn that. Visual C++ has like a billion headers. But these guys are right learn c++ first. Its probably easier to learn a taeching language like ada or something, but might as well learn a real language right?
 

denali

Golden Member
Oct 10, 1999
1,122
0
0
EmperorNero:

The following are alternatives to MFC.
1. From MS you can program using Win32 which is the low level functions that MFC uses.
2. Qt from Troll Tech this works on both MS Windows and X-Windows for Uxix/Linux/BSD
3. FLTK runs on both MS Windows and X-Windows for Uxix/Linux/BSD
4. GTK+ runs on both MS Windows and X-Windows for Uxix/Linux/BSD and BeOS
5. V runs on both MS Windows and X-Windows for Uxix/Linux/BSD and OS/2
6. paraGUI runs on both MS Windows and X-Windows for Uxix/Linux/BSD and BeOS and MacOS
7. wxWindows runs on both MS Windows and X-Windows for Uxix/Linux/BSD and MacOS

I'm sure their are others. You should notice the one thing in common between all of them except MFC is that the all work on multiple OS. I don't have that much experience programing on MS Windows but I became frustrated because not all of their functions worked the same way or were available on all of the different version of Windows.
 

konichiwa

Lifer
Oct 9, 1999
15,077
2
0
So if you want to program GUI Windows programs in C++, you have to use MFC? Or are there alternatives? denali, are the things that you listed other ways/products that can program to make a windows GUI program? Thanks again for all the responses. :)
 

FrogDog

Diamond Member
Jan 12, 2000
4,761
0
0
Koni:

The Visual C++ book wil teach all the basics. I have it and it spends the first ~6 chapters on the basics.

It doesn't just teach you Windows programming at all, there is a lot more than that. I'd recommend going with the Visual C++ 6 book, it's really good.
 

denali

Golden Member
Oct 10, 1999
1,122
0
0
konichiwa:

You don't have to use MFC to create GUI programs for MS Windows. You could just use Win32 which is a MS library that MFC uses. Win32 is C not C++ that is why in a previsou post I said that MFC wasn't based on the OOP paradim. MFC would be easier than Win32 but you have less control.

All of the products that I listed will allow you to create GUI programs for windows. Some are C based some C++, all are free for non-MS OS, and I think all are free for MS except Qt, I think.

I spend most of my time programming on Unix systems but have tried to do some MS programming. So I might be biased somewhat against MS. I know I don't like the GUI layout tools on any platform. I like to to all the layout by hand, guess I'm to set in my ways.
 

konichiwa

Lifer
Oct 9, 1999
15,077
2
0
FrogDog:

That may be so, but the Beginning C++ book spends 950 pages on pure code and programming...and I think it's important to have a strong foundation of pure coding knowledge first. I'll buy that one and then if I think the VC++6 book would've been better I'll exchange it. :)

denali:

Ohhh, I see. So MFC is just the &quot;product&quot; (per se) that Microsoft thinks everyone should use to create win32 programs. But there's many other ones out there...right? I think I understand. Thanks to you and everyone else for putting up with my beginner's-knowledge. ;)