Qt vs MFC
Philippe Fremy writes: "I have just published and translated into English a comparison between Qt programming and MFC programming, which was written by Pascal Audoux (a fellow coworker). I am interested in feedback and would love to add quotes from developers that have used both toolkits." Here is the English version ("Qt vs MFC") as well as the French one ("Qt contre MFC").
.. when MFC is much faster and has been industry proven.
Slashdot admits the truth here.
As we already know open source programmers stink, both at their jobs, and in general. Take RMS for instance. He can't get a job as a real programmer so he starts the FSF. He also hasn't taken a bath or shower in over 20 years making him stink in general. Living in a dark cave doesn't help either. I don't want to know what is crawling around in his hair.
I'm sure there are people at your office who are just like RMS if they can hold their jobs. You know they are close because you can smell them. You are spending hours of overtime fixing their code.
For anyone reading this post none of this is a suprise. However, Slashdot is a bastion of open source programmers. That is why the code is so bad, and its the only website that you can smell over the internet because it reeks!!!!
What was suprising to me (and to you I'm sure) was that Slashdot admitted in the above linked article that open source programmers stink.
I commend Slashdot for admitting the brutal yet honest truth.
A Linux user goes back.
/etc/fstab file so that it always automounted when plugged in. I was very impressed.
/dev/null, once I find where that actually is.
By Tony âoekNIGitsâ Collins.
Introduction...
In much of today's online news, we hear of how many people are migrating to GNU/Linux. What we don't seem to hear much of, is users going back to their old operating systems. The reason for this article is to say that I've done just that.
Yes, I've gone back. After three and a half years of trying to make GNU/Linux work on the desktop, I've decided that it's simply too hard for the average home user. Before I go into my reasons for going back, let me outline what I believe an 'average' home user is. Mr Joe Average is someone who wants to install their OS, boot it up, and it works. He wants to be able to upgrade his PC , and have the hardware work in a few short minutes. He wants to read email, browse the web, talk to his mates online, and play some games. Feel free to disagree with me, this is merely how I see myself. Note: I'm not referring to Grandma using Linux, or even my mum using it. I'm referring to average users who know a little about their computer.
Three and a half years; that's how long I've been trying to make Linux work on my desktop computer. Right about now, I'm sure that you are now screaming that I didn't try hard enough, or that I'm just plain stupid. Let me assure you that this is not the case. Stupid users don't doggedly stick at something for three and a half years, trying distribution after distribution in the hope of finding the holy grail of Linux desktops. They give up in less than a few hours of trying to (unsuccessfully) install RedHat Linux. Hear now my sad tale of why Linux isn't suitable for my desktop.
Some background...
The year is 1998. I've had my Windows '95 computer for around six months. Frustrated with the constant crashes, I desperately asked an online mate for help. Even though he was a windows user, he calmly suggested that I try something I'd never come across before...
âoeLinux, eh? Never heard of it.â
âoeOh, it's a free OS that you can download. Apparently it doesn't crash much. Just do an online search for it.â
Armed with this meagre knowledge, I set out on my quest for the ultimate stable operating system. I searched online, and found places where you could even buy copies of Linux! So, I left the comfort of my warm study, and returned forty minutes later with my first Linux boxed set â" RedHat Linux 5.2. After initially balking at the very basic installer (and few false starts), I had it up and running on my lovely AMD K6-233. I even got X working in no time at all. Then the system booted up for the first time.... and it was dead ugly. I had a very stable new OS, but I didn't even want to look at it. I was happy that I had several installed interfaces to choose from, but none of them appealed to me whatsoever. Wanting to download a nicer interface led me to my next problem.
I had absolutely no idea how to even get this nice, stable OS onto the internet! After reinstalling windows and RedHat in a dual-boot configuration, I got the help I needed by using Windows and USENET. Strangely enough, I can still remember the name of the long-suffering person who helped me get RedHat online, but that's another story. After looking around online, I discovered KDE. Only up to version one, it was the closest thing I had to a completely useable Linux system. I downloaded all the KDE packages for RedHat 5.2, only to discover another distro called Mandrake, that came with KDE preinstalled and configured. Back to my local distributor, and I was set.
Mandrake with KDE was exactly what I needed at that stage in my Linux using life, and I stuck with it for over a year and a half. Always seeking the 'perfect' desktop OS, I followed releases from version 5.3 all the way through to 7.0. Eventually I became dissatisfied with Mandrake, and briefly tried a number of other distros until I finally settled on Debian. I was impressed by the simple power, configurability, and the ease of upgrade that is apt-get. I felt good about being among the uber-elite Debian user community. Needless to say, I learned a lot about how to configure hardware under Linux during my time with Debian. I learned to sift through the old HOWTOs on Linux Doc until I found something suitable and accurate, I learned to utilize the power of USENET and IRC. Life was good.
Right now you must be wondering; âoeWhere is this leading? This guy seemed quite happy with Linux!â. True, I was. After a while, I decided I didn't want to have fine-grained control. I wanted something simple. I was getting tired of the 'stable' Debian release being so out of date, and the 'unstable' distribution being so... well... unstable. I got tired of having to recompile my kernel every time I got new hardware. I got tired of using command line to talk to my PC. It was time for a change. I had good experiences years ago with Mandrake, so I figured I'd try it again. As good as Mandrake 8.1 was, it wasn't what I was after. SuSE Linux 8.0 Professional (boxed set) was installed onto my PC instead.
I have to stop at this point, and say that SuSE Linux 8.0 (Pro) is the best Linux distribution that I've ever used. It has an easy installer, reasonable hardware support, and comes with the very good KDE 3.0. The box contains seven CDROMS, one DVD and three decent books that would help even the most inexperienced user get up and going. YaST2 is a decent graphical system configuration tool. When (not if) I go back to Linux, I'll definitely try SuSE again. However, there are quite a number of things that have improve (or change completely) before I'll consider going back. Read on for my brief list of things that must must get better before I'll switch back from the Microsoft camp.
Where GNU/Linux needs to improve...
X11
The X Window System is an awesomely powerful, network transparent graphical subsystem. It's perfectly suited to running applications from remote servers. However, this is NOT what a home user needs. My experience with X is that it's too big, bloated, slow and unstable to be any good to the home user. Most crashes that I ever experienced with Linux have been X's fault. My servers don't run X, and they never crash.
What home users need is something small and fast, so they can run local applications efficiently. I would like to see the X Window System dumped in favour of a hardware accelerated framebuffer, running something like directFB or Qtopia. Home users need a small, fast graphical subsystem, with built in 3d support. BeOS seemed to be on the right track before they went under.
Fonts are truly awful under X. Most distributions ship with appalling fonts, and there is no standard way to add additional (nicer) fonts to the system. Even after extra fonts have eventually been added, many applications (eg Abiword, Staroffice) refuse to use the new fonts anyway. Perhaps the framebuffer-based graphical subsystem I suggested could incorporate decent font support, and use a readable naming scheme as well.
Drivers
While having access to the latest version of the kernel is a good thing for developers, for home users it can be a nightmare. Got RedHat Linux 7.3? Perhaps you run SuSE 7.3 or Debian 2.2. You'll have to download a binary package specific to your distro. (I'm assuming that home users won't change their default kernel, but if they did, that binary package wouldn't even work!) Hardware manufacturers should be able to provide one single driver that works on all minor versions of a major kernel release. This way it would work will all current distros, instead of having to provide multiple binaries or source code. Hardware manufacturers don't want to give out the source, as this often gives away trade secrets about how their hardware is designed.
The solution seems to be to make binary drivers work on a variety of kernel versions. I'm not sure if this is even possible with the way the kernel is designed (I'm no kernel hacker), but it would go a long way toward making Linux more accessible to the home user. Even if the kernel needs to be redesigned to support this, then in my opinion, it should be done. Linux users are always clamouring for drivers... perhaps if the kernel had something like this, it might one day become a reality.
Hardware setup
While SuSE Linux 8.0 gave me some good experiences with hardware detection (such as automatic download of NVIDIA drivers), it also let me down as in this area.
The good: I recently borrowed a digital camera from a mate at work, to take photos of my case mod. Imagine how happy I was when I plugged it into my nearest USB port, and it was automatically configured (as a SCSI device) and mounted! SuSE even added it to my
The bad: Along came my new IDE CDRW drive. At AU$99, I couldn't pass up the purchase. Plugging it in gave me no joy. I was very disappointed that a device so common couldn't be detected and automatically configured under a modern operating system. The instructions on the SuSE support site said to add lines to lilo.conf and reboot. While this is a perfectly acceptable way to get hardware working for a geek familiar with *NIX, I believe that a home user shouldn't have to do more than plug it in. It's an IDE device, it's not that complicated!
The ugly: Once the hardware was finally working (as a pseudo-scsi drive), the next hurdle was to find decent graphical tools to burn and copy CDs. I finally settled on CDBakeOven, an above average KDE application. It burned CDs from data on the hard drive, but for some reason cdrecord (the command line backend) refused to allow me to copy a cd directly. Yes, it was installed SUID root. CD copying is such a basic function nowadays, why is it so hard to do under GNU/Linux?
Software distribution
I'll put this simply. I'm a home user, not a programmer. Why on earth should I have to compile the software I want to use? I know that having the source available is a good thing, but I'll say it again: I'm no programmer. I just want to install software and run it.
This leads to another point. Although having package databases (such as the rpm and deb systems use) is great, there should definitely be seperation between system packages and additionally installed software. There needs to be a standard installer and database for user-installed applications such as word processors, email clients and games, and it should be seperate from the rpm or deb databases used for system software such as lilo, init and cron. This will make it much easier for home users to know what applications they have installed on their PC, and to easily uninstall them if necessary, without knowing some arcane commands and weird package names.
Support
There is a huge wealth of knowledge among the thousands (millions?) of people that run GNU/Linux around the world. If you have a problem, odds are that someone out there can help you, often for free. This is one of the linux platform's greatest strengths. However, Linux users are also its greatest weakness. This may not apply to most of the community, but there is a very vocal minority that gives Linux a bad name. To every Linux user that has ever helped a newbie, I thank you. I have been helped by many a guru, often when I've been asking the simplest of questions. It's the remainder that are a problem.
I once heard a song by Three Dead Trolls in a Baggie called Every OS Sucks, where Linux users were described as 'elitist nerdy shmucks'. Sadly this is true for much of the 'community'. Too many consider themselves better than the rest of the world because they run Linux. Can you believe that? It's just a computer operating system, but somehow they think that it makes them better than those people who run systems such as Microsoft Windows! Elitism drives people away, as does saying âoeRTFMâ or belittling people who choose a different distro from yourself.
'Nuff said about that.
So what now?
Well, I decided to go back to a Microsoft platform. Initially being paranoid after reading things about DRM and spyware, I bit the bullet and installed Microsoft Windows XP. Like every OS, it has good and bad points; most of which you can learn about from online reviewers. I'll just point out several things that make me want to keep using it instead of GNU/Linux.
Fast graphical subsystem: Windows has lighting quick graphics, both 2d and 3d. There's no denying it. When I move a window, it refreshes so fast that I don't miss X11 at all. While not quite as nice as some other operating systems, font support is outstanding compared to XFree86.
Drivers: Point and click to install (as a superuser, of course). Windows warns you if the driver isn't likely to work properly, and can roll back to working drivers if you deliberately choose to install one that hoses your system.
Hardware setup: My CDRW worked right away, without a hitch. I am able to drag and drop files from the Explorer file manager to the CDRW icon and they get added to the list of things to burn. A quick install of Nero Burning Rom, and I was able to make a backup copy of my game CDs. (I don't like taking originals to LANs where they can get destroyed or stolen).
Software distribution: All windows software comes in binaries, either with an installer or in a zip file. I hope to never compile an application ever again. Software designed for a different version of windows is 99% guaranteed to run, but if not, there is always 'compatibility mode'. One thing to note, however: Applications designed for single user versions of windows usually only run properly as a superuser, and this includes 3d games. I expect this to be rectified as the rest of the Windows world catches up to a multi-user environment.
I can't comment on the Windows using community yet. I've not yet had a problem that a simple point and click couldn't fix. However, I will say that my original concern with Windows '95 has been addressed in Windows XP. The stability is finally there.
Final Notes
In conclusion, I'd just like to make it known that I haven't completely abandoned the Linux community. My home server still runs Mandrake, and IPCop on my gateway/firewall. There is no way I'd ever put any form of Windows on my server, nor would I ever connect a Windows PC directly to the internet without a *NIX gateway in between. Microsoft has a history of poor security, so I protect myself the only way I know how; using Linux. I will continue to advocate the use of GNU/Linux in the server arena. This is where its strength lies at the moment.
Because of their history of spreading virii, I don't use the applications that Microsoft has provided with Windows XP. My wife and I use Mozilla for web browsing and email, OpenOffice.org for word processing, and Psi (Jabber client) for instant messaging. All of these are true multi-user win32 programs, and are perfectly interoperable with their Linux counterparts.
I expect that the Linux community will have something to say about this article; I welcome comments and constructive criticism. Flames will be automatically sent to the Windows equivalent of
By Tony âoekNIGitsâ Collins
- posted by poopbot: providing truth in a deceitful world
2TloJkTYEM Post #348
Well, that's obvious. From the article:
;-)
The conclusion drawn from our personal experience is obvious. Qt is far better than MFC. You'll produce better programs with less hassle.
I do agree though.
DNA is the ultimate spaghetti code.
In Qt, objects are always open. There is not "Create()" function. What is when opening fails in the contsructor, does Qt use exceptions? If yes, then correct Qt code has to use "try {...}" on every creation of widgets. In other toolkits, "Create()" returns a BOOL, and you must use "if (Create()) {...}". I think the KDE developers admitted they didn't like exceptions. There's no problem in using exception, but if you write a Qt program, and derive classes from Qt classes, your classes will also throw exceptions in their constructor. Not everyone writes their code like that, and proting existing C++ apps may be difficult for that reason. The other way around, if a library uses "Create()", then wrapping around your own code which calls Create() in the constructor is not hard.
-- 1.e4 c6 2.d4 d5 3.Sc3 de4: 4.Se4: Sd7 5.Sg5 Sgf6 6.Ld3 e6 7.S1f3 h6 8.Se6:
Perhaps the most useful of all would be a comprehensive somparison of all the various toolkits/libraries.
Everything in the Universe sucks: It's the law!
I've been doing lots of Qt, GTK and Java programming, a few months ago I needed to start hacking on a MFC project. I tell you, never ever again. I'm now having a cronic headace, thanks alot MS. And what is it with those API's on Windows, do they have to typedef _everything_ for every different occasions, I'm sure I encountered 20 different typedef s for "unsigned int" just browsing through some MSDN pages. Not to mention the joy of unwinding a structure so you can get to business. Theres a structuer with a structure, member, with a member,with... And they each have members of type unsigned int, WORD, p_WORD, uint32. If somone know how to make apis and code even more unreadable I'm sure there is an open job somewhere near Redmond.
This is a bit of a strange review:
...
I always thought that comparisons had to be done with some kind of objectivity, if only for the purpose of decency... Apparantly this is not the case: MFC was produced by hordes of rabid monkees while God himself came down and Created Qt.
Even not a C/C++ developer myself, I don't see a lot of proof / illustration to the MFC side and way too much positive adjectives on the Qt side: "genious", "excellent",
The best one was probably:
"One of the stated goal of Trolltech is "The product and the documentation should be so good that no support is needed".
QED...
Qué?
----
--
[insert witty one-liner here for your own pleasure]
While I wholehartedly agree with the conclusion, I must say that the article is a mess and feels like it was written by a 16-year old. It's barely comparative, sticking to the format that feature X is messy in MFC and much easier in Qt, and here's an example of just how easy. He doesn't give any MFC code examples, mainly limiting himself to explaining the horrors of Unicode and resources. An objective reader could hardly take this for a serious comparison of the two frameworks.
Besides, it's really comparing apples and oranges. Anyone who's used the MFC at all knows that it's hardly OO. A much fairer comparison would be that of Qt to Borland's VCL. In many respects they're very, very similar, but it seems that the nod of more consistent OO design would go to the VCL. I base this mainly on the event-handling semantics of both toolkits. While Qt falls back to straight C (or possibly even a macro? shudder!) for connecting an event handler to a component, the VCL stays faithfully OO, implementing event handlers as method pointers (exposed as properties) on components.
Continuing the example used in the article, Qt reads:
connect( button, SIGNAL( clicked() ), SLOT( action() ) );
while the VCL would read:
button.OnClick = action;
Anyway, as I said, while I support the conclusion of the article, based on its lack of maturity I wouldn't use it to try to convert existing MFC programmers.
This guy doesn't seem to understand much of what he's talking about.
The most glaring clue is this:
For example, to swap two variables, the author used the non commented following line:
a ^= b ^= a ^= b;
This is a cool hack which does not belong to a professional product.
If you don't recognize this, you probably need to go back to school. It's fast, and it doesn't require a temp variable.
Any time you look at low level libraries, you're going to see things like this. They NEED speed. They NEED low memory impact. These things are going to get called in tight loops with a million iterations. Look at QT's code, and you'll see the same thing.
Also telling is the fact that he has nothing positive to say about MFC. I've run across some VERY talented developers, and while I haven't heard them singing MFC's praises, they do have some nice things to say. Advocacy really needs to show balance. Acknowledging MFC's strong points is important.
When he's talking about an add on library called 'codejack', he mentions that tab views are impossible in MFC, yet codejack provides it. Apparently it is NOT impossible in MFC then. It probably isn't a prebuilt widget for the developer to use (which is unfortunate, I'll admit)
QT is a good library, I have no doubt. But please learn how to find good things in other libraries. It will only make your code better. It will only make your advocacy better.
Zapman
That is one thing i have to disagree with the article. MSDN is quite good. And if you are using MFC, then you are using VC++. That means help is usually just an F1 click away.
As others have mentioned, the article is really badly written. I cannot comment on the merits of Qt, since I've done practically nothing with it. But I've done my fair share of MFC, and it's quite ugly - I find it hard to believe that *anything* solving a comparable problem can be much worse.
But my main point is this: When dealing with stuff like MFC you need to factor in the quite helpful development tools that the Visual Studio suite consists of. I have yet to see something of that quality from anyone else (except possibly Borland), and so far I've found only KDevelop to be reasonably useful. The MFC library (I flatly refuse to call it an object model) is ugly, but to some extent this is ameliorated by the IDE. I *know* this is not the way it should be done, but it's there and it DOES help...
Black holes are where God divided by zero
See question 3.3b.
Q
W
E
R
T
Y
U
I
O
P
A
S
D
F
G
H
J
K
L
Z
X
C
V
B
N
M
Q
W
E
R
T
Y
U
I
O
P
A
S
D
F
G
H
J
K
L
Z
X
C
V
B
N
M
F
U
C
K
!
You heard me. I was going through security at Fort Lauderdale airport, and this guy was really scrutinizing me. Fine, I had no problem. Until he reached down my pants. He said it was because of my belt buckle. The problem is, the security screeners barely speak English. For people who do this all day, they are pretty bad at giving clear instructions. He mumbled something, and I thought he was telling me to sit down. So I sat down. Then he said "no no no, stand up." He went over me with the wand, and my belt buckle set it off. Then he asked me to undo my belt, and he stuck his hand down my pants! So I said, "What the hell are you doing?" He didn't have an answer, he mumbled something. Fucking people responsible for our security should not be illiterate perverts. I think it's about time to dump the bar. I am sick and tired (and tired always follows sick). But that's a small thing in the end, I guess. Right now, I'm waiting to find out if I have to do the jury duty thing. I won't find out until 11:00 or so. Until then I can "entertain" you guys with my weekend. Bear with it. There's light at the end of the diary... So, Friday night felt like a complete clusterfuck. I was down a man (a family reunion in Abilene, poor guy) and training 2 new guys. It just felt like everything that could go wrong went wrong, but that wasn't the real topper to my weekend. Friday night, one of my Underlings (specifically Jigsaw, frequently referred to as Underling1) told one of the managers and told me that he would be calling in on Saturday and wouldn't be coming in. You see, Jigsaw asked me a couple of weeks ago to get Saturday off for a family thing. I couldn't give it to him because the other guy who was off asked first, gave me more then a month's warning and I could only spare one person. So Jigsaw just decided to "tell" me that he wasn't coming in. Specifically, he said that no job was worth disappointing his family. Noble sentiment that was going to piss me off. So Saturday night, I had one experienced person, two newbies and myself working. It was a little packed but manageable for the first couple of hours until "They" arrived. And by "They," I mean Vinny and Dimebag from Pantera. That's when the pooch got screwed. People started calling all their friends to come to the bar because Vinny and Dimebag were there. People started drinking because they were hanging and being bad asses with Pantera. Truth be told, I couldn't give a fuck about them, but when celebs show up, it's my job to take care of them. Being a man short made that job difficult, but doable. Being another man short made it next to impossible. But the real topper was that there was a fight in another part of the club and I didn't even find out about it until it was long over and done with. Turns out that one of my Underlings went to toss a guy, and the guy turned on him and none of us (Security) was there to back him up because we were spread so thin. So a couple of the bartenders came from behind, got the guy out, told him to go away, got swung at and chased him into the street to get him gone. I played no part in this at all because while all this was happening, I was at the door carding people. If Underling1 had been there, I wouldn't have been at the door. I would have been able to go where the trouble was. I was not happy at the end of Saturday night. So I took Underling1 off the schedule for a couple of days. Did I act hastily? Maybe I did, but I'm not going back on this decision. I could say some kind of thing about people being the fingers of a hand or the cogs of a machine, but all that's crap. What it comes down to is one of my people let me down. It wasn't even because he was sick or something. I know it was a family thing, but I have bent over backwards to accommodate him and his family. I figure just because I don't have a good relationship with my family doesn't mean I should begrudge him his. But I've done it far too many times. And he's just going to inform me that he's not coming in? Well, I can inform him that he's not coming in also. Truth be told, I should have fired his ass, but unfortunately, I need him because we're already short of people and he's going to fuck up and get fired eventually because he's done it before. The thing that really pisses me off is that his absence kept me from doing my job as well as I could. And that's why I should probably drop the bar. I can't do the job as well as I would like because I'm only working there two days a week and it's not worth the money or the risk to my person. That and I have a lot of trouble caring about some facets of the job, too. But I seem to have an overdeveloped sense of responsibility. I don't want to leave them in the lurch. I've already had people tell me that when I leave, they think things will go back to shit. I don't have the hubris to think that the entire place will fall apart without me, but I know that I do a lot there and they'll never get another person like me anytime soon even if the double what the position pays. I should be replaced and soon. I did get one uplifting thing this weekend. A friend of mine and his wife finally legally changed her son's last name to his (and her married) name. They finally gave him a middle name, too. And the named him after me. Aeren Marcellus Throgmorton. I was and am completely touched. That just kinda makes all the other stuff just not matter doesn't it? This is without a doubt the biggest honor of my life. Heck, this even beats when Bob asked me to be his Best Man. I rule. I really do. In this essay we shall explore an alternative to the use of vector algebra for representation of physical objects in the sciences. It is not the purpose of this essay to make converts of the readers. It is enough to demonstrate how geometric algebras can be used to do many of the same tasks as the vector algebras along with a few additional ones usually reserved for other mathematical tools. In a previous work, the topic of how we choose to represent physical objects in our theories was discussed. Three postulates were laid out defining the concepts of completeness, rendition, and identity. This work will focus mostly upon the second term by offering geometric algebra as an alternative to vector algebra and matrix algebra. A Brief History The concept of a geometric algebra can be traced back to 1797 to a Norwegian surveyor named C. Wessel who interpreted the unit imaginary number as a directed line segment perpendicular to the unit real number. Making the complex numbers geometric has proven to be quite fruitful in a number of fields In 1843, W.R. Hamilton created the algebra of quaternions as an extension of complex numbers with the intent to represent three-dimensional physical objects. Around the same time, H. Grassman invented exterior forms. His algebra would eventually be developed into differential geometry. Both of these tools are powerful, but Grassman's contribution is better known today. In 1878, W.K. Clifford generalized and reinterpreted the algebras of Hamilton and Grassman. Some will refer to one of the algebras as biquaternions, but in their general form they are named geometric algebras. Clifford's algebras restricted themselves to simpler definitions for multiplication and addition similar to Hamilton's approach but including Grassman's exterior product within the general product. These operations were defined that way in order to obtain geometric meaning. Clifford died of tuberculosis a year later. Clifford's results have been rediscovered a few times by more recent researchers. Sauter, Sommerfeld, and Eddington all noticed that Dirac's gamma matrices were generators of a four dimensional geometric algebra with a space-time metric. These are the gamma matrices from Dirac's first order relativistic theory for electrons. Several other authors have noted that classical electrodynamics can be easily written in the same geometric algebra generated by a suitably defined set of gamma matrices. In the early 1880's, J.W. Gibbs wrote about his vector algebra. Gibbs' algebra and his notational approach were a limited form of Grassman's ideas. The system was adopted by those developing the theory of electrodynamics at the time and won the battle for the approach taught to students. The vector algebra taught to students today largely derives from Gibbs' system, though the notation has been changed a little. Between 1891 and 1894, in the journal Nature, long letters defending various notions can be found between the proponents of both sides of the representational conflict. On one side were Gibbs, and O. Heaviside. P.G. Tait supported the other side. By this time, the main creators of the quaternionic approaches were long dead. The creators and proponents of the vector algebra were alive and well. The actual argument in the journal was a little lop-sided but it went on outside the print media for some time. Anyone interested in what a 19th century flame war looks like is encouraged to do a little digging in the library for volumes 43 through 46. Gibbs first letter was published April 2, 1891 and Tait's first response appeared four weeks later. Definitions To start, we offer one formal and one informal definition of a geometric algebra. The formal one has a few parts and is meant for those readers with the mathematical background to understand them. In the truest mathematical sense, this definition could be made more formal. This version will suffice for this work. The informal definition, however, is the one most likely to help build an intuitive understanding of how to use these algebras as tools. Formal Definition of a Geometric Algebra 1. Binary Operation A binary operation on a set is a rule that assigns to an ordered pair of elements of the set some other element of the set. 2. Group A group is a set together with a binary operation on that set such that the following holds true. * The binary operation is associative. (a.b).c = a.(b.c) * There is an identity element in the set relative to the operation. * For every element in the set, there is an inverse element such that the operation on both of them always produces the identity element. (An abelian group is one where the binary operation happens to be commutative. a.b = b.a) 3. Ring A ring is a set together with two binary operations (called + and *) on that set such that the following holds true. * The set and the + operation form an abelian group. * The other operation (*) is associative. * The * operation is distributive over + from the right or the left. a*(b+c)=a*b+a*c and (b+c)*a=b*a+c*a 4. Field A field is a commutative ring under * with a unity element under * where all elements except the + identity have * inverses in the ring. 5. Vector Space A vector space consists of an abelian group under an addition-like operation, a field, and an operation (x) between elements of the field and vector space where the following holds true. * (x) produces and element of the group. * (x) is associative * (x) is distributive in the field AND in the group * There is an identity element within the field for (x) 6. Algebra An algebra consists of a vector space together with a binary operation (.) on the elements of the group such that the following holds true. * (.) is associative with elements of the group * (.) is commutative with the scalar multiplication of the vector space. * (.) is distributive with respect to the + operation in the group on the right and left. (Generators of an algebra are a set of elements such that all possible products produce a basis for the associated vector space. Linear combinations of the basis elements cover all possible elements of the algebra.) 7. Geometric Algebra A geometric algebra is a type of algebra with a set of generators where the following holds true. * products of two different generators under (.) anticommute * products of two identical generators under (.) are defined (The generators of a geometric algebra are the elements to which geometric meaning is attached.) That is a formal enough definition along with the terms that provide the underpinning that makes the definition work. There are two multiplication-like operations, a single addition-like one, a set of elements that starts this all off, and some rules they must all obey regarding commutativity, associativity, distributivity, and a variety of types of operational identity elements and inverse elements. This cloud of formalism is important in the mathematical sense. For our purposes, however, it is more instructive to approach the tool informally and discover these definitions through usage. Remember the existence of these formal definitions, though. Some of the seemingly magical qualities of geometric algebras discussed later can be shown to be obvious by the fact that they are designed into the tools from the start. Informal Definition of a Geometric Algebra Start with a set of objects we choose to use to represent directed lines. We will call them vectors later, but for now they are generators. With these generators, we shall construct everything in our geometric algebra. Note the following. 1. The number of generators in our set defines the meaning of 'dimension.' 2. The field for our algebra will be assumed to be the Real numbers unless otherwise stated. 3. Experience the reader already has regarding the operations + and x from vector spaces will continue to apply here. The concept of 'linear combination' still works here too. 4. We shall define (.) by providing the multiplication table involving all generators and their products. 5. All elements found on the (.) multiplication table form a set that is sufficient to span the vector space found within the algebra. 6. With (.) we introduce the term 'algebraic combination' as an extension of linear combination and allow both (.) and (+) operations. A two dimensional example. Let's call our generators X and Y. We need to define a multiplication table for the (.) operation to be defined. Here it is written out. X . X = 1, X . Y = XY, Y . X = -XY, and Y . Y = 1 With this list, we have a two-dimensional algebra where 1, X, Y, and XY span the related vector space. Elements of the geometric algebra can be represented as linear combinations of the set that spans or as algebraic combinations of the generators. Here is an example. (Remember that x is the scalar multiplication with the field.) M = (A x 1) + (B x X) + (C x Y) + (D x XY) 1 is interpreted as a point. The field element 'A' changes its magnitude. X and Y are interpreted as directed line segments. (The vectors) Remember that a directed line is a one-dimensional object with a sense of forwards or backwards. XY is interpreted as a directed plane segment. (A bivector) A directed plane is a two-dimensional area with a sense of rotation clockwise or counterclockwise. A three dimension example. Let's call our generators X, Y and Z. The multiplication table for the operation is as follows. (Assume a.b = -b.a where a, b are any generators.) 1.X=X, 1.Y=Y, and 1.Z=Z X.X=1, Y.Y=1, and Z.Z=1 X.Y=XY, X.Z=XZ, and Y.Z=YZ XY.X=-Y, XY.Y=X, and XY.Z=XYZ XZ.X=-Z, XZ.Y=-XYZ, and XZ.Z=X YZ.X=XYZ, YZ.Y=-Y, and YZ.Z=Y XYZ.X=YZ, XYZ.Y=-XZ, and XYZ.Z=XY XY.XY=-1, XZ.XZ=-1, and YZ.YZ=-1 XY.XZ=-YZ, XY.YZ=XZ, and XZ.YZ=-XY Elements in this algebra can be written as follows. M = (A x 1) + (B x X) + (C x Y) + (D x Z) +(E x XY)+ (F x XZ)+ (G x YZ)+ (H x XYZ) XYZ is interpreted as a directed volume segment. (A trivector) A directed volume is a three-dimensional object with a sense of rotation (left-handed or right-handed) around a parallelepiped. (The limitations of HTML or the author's knowledge of HTML in K5 articles makes this table somewhat hard to read. Imagine a square table with the eight elements running across the top and down the left. Fill in the products like one was taught to do with multiplication tables involving real numbers to get the table described above.) Other examples are possible and worth considering. The reader is encouraged to think about how the multiplication tables would change in both examples if X.X = -1 instead of +1. Such a change makes one of the generators begin to behave like a time-like vector instead of a space-like vector. A later example will show a four-dimensional algebra where one of the generators has a negative square. Such an algebra begins to behave like a Minkowski space, though it is geometrically richer. If both X and Y, in our two-dimensional case, were changed to produce negative squares in the two dimensional example, we would reproduce the algebra of quaternions. Why learn another paradigm? A reasonable concern for anyone currently using vector algebras and not familiar with geometric algebras is whether this new approach to representing objects is worth learning. The answer to this concern comes in two forms. The first is that an alternate approach to the representation of objects uncovers some of the techniques we use in rendering those representations. The second comes from the fact that some of the elements of our geometric algebras do not have analogs in the vector algebras commonly used to represent physical objects. These unusual elements may be worth exploring in case they help uncover new mathematical structures that imitate unexplained experimental evidence. Geometric algebras permit the sum of objects of different geometric rank. What is a vector + plane? Readers familiar with vector algebras know that such an object simply can't be constructed without violation of the transformation rules that maintain the concept of identity. Geometric algebras lead to no such violations, so there is a difference. Representation Techniques The interpretations for object within a geometric algebra depend on their rank and on their position relative to one of the operations. This is very similar to how we do things in other mathematical tools. A simple example will be shown for real numbers and then expanded to cover a three dimensional, Euclidean geometric algebra. Consider the equation (2 times 3 is 6.) The binary operation is the familiar one of multiplication of real numbers. This same equation could be written as times(2, 3) is 6. Any programmer would recognize the operator and the operands as distinct. However, because the operands of a binary operation are ordered, we could also write the equation with a unary operation as double(3) is 6. If the first operand of the binary operation were held constant, the unary version would be equivalent and more efficient to boot. This example shows that the operand can also be considered as part of the operation. This ambiguity is the one that leads to two possible interpretations for the same thing. One version treats the object as an input while the second treats it as an operator. In a three dimensional Euclidean algebra, we have three generators named X, Y, and Z. From these we can create 5 other objects using the multiplication operation alone. The objects are {1, X, Y, Z, XY, XZ, YZ, and XYZ}. Their interpretations as operands are relatively simple. Each is a directed element of rank n where n is equal to the number of generators it takes to represent the object. 1. The object '1' is of rank zero and represents points with magnitude. It is not the real number we usually label with a '1' symbol. 2. X, Y, and Z are directed line segments similar to basis vectors. 3. XY, XZ, and YZ are directed plane segments 4. XYZ is a directed volume segment. Note that no matrices are necessary for these interpretations. Each of these eight objects and their related interpretations is as 'real' as any interpretation of the unit imaginary number. The interpretation of these eight objects as operands takes a bit more work. 1. The object '1' is a scaling operation. By itself, it scales other objects by unity. When it is scaled by a real number from the Field, it transfers that scaling to the operand. 2. The generators are reflection operators if the operation is done in a bilinear fashion. Consider a linear combination of the generators. V = a x X + b x Y + c x Z. If you multiply on both sides by X, the result is XVX = a x X - b x Y - c x Z. Notice that the parts of V that were perpendicular to X changed sign after the operation was done from both sides. 3. If the generators are reflection operators, then the bivectors must perform two reflections. It is possible to write two reflections about different lines as a single rotation, so the bivectors when operated in a bilinear fashion are rotation operators. 4. The last one, XYZ, is a parity operator. All three generators get reflected, but the affect cancels out on the bivectors. With these two types of interpretation, we can address physical situations. Consider a room full of warm air. We could represent the temperature at every location in the room with a function of scalars (1's) that are scaled to match our readings. We could represent the movement of air molecules with a function of vectors (linear combinations of generators). The size of each directed line is linked to the momentum of the molecule. We could represent the spinning of each molecule with a function of bivectors. The magnitude of each directed plane is linked to the angular momentum of the molecule. In a vector algebra, we would keep these functions separate in order to avoid violations of the transformation rules that define identity. In a geometric algebra, this distinction is not needed. No matrix representation of the generators and the other objects is needed for the geometric algebra version as long as we keep the multiplication table handy. The matrix form can also be avoided for the vector algebra version, though it is seldom done. Our freedom to add objects of different ranks in a geometric algebra leads to some unusual constructs one does not normally encounter if one sticks with vector algebras. Consider the following objects. M = 0.5 x ( 1 + X ) and N = Y ( 1 + X ) The object M has the curious property that when squared you get it back again. The object N has the curious property that when squared you get the additive identity named 'zero.' M is an example of a set of elements of the algebra referred to as idempotents while elements that behave like N are referred to as nilpotents. These constructs are not possible in vector algebras, so if there is anything that could support or demolish the usefulness of geometric algebras as a representational tool in physics theories, it will probably lie with these constructs. Examples An example or three will demonstrate just how similar geometric algebra can be to the current vector algebra. The rendering of objects in both systems is very close and easily confused. The difference all rests in how the reference frame is written when rendering real objects. Example 1 Imagine our room full of warm air again. Each molecule in the room is moving around at some velocity and, therefore, with some momentum. Imagine tagging each molecule with a directed line segment representing that momentum. With a little sleight of hand we could pretend your tags actually referred to a small volume of some continuous fluid and avoid the discrete nature of the air. This step isn't strictly necessary, but it does make writing a function for the momentum of the fluid easier. That function would appear as follows. Momentum density P (position) = sum [coefficient of P x a basis element] where the basis elements are the eight objects that can be generated from the basis vectors. Obviously, most of the coefficients will be chosen to be zero in order to ensure that P is a vector density. That works just fine. In a vector algebra we would write the same equation as follows. Momentum density P (position) = {Px, Py, Pz} where the coefficients are part of a 3-space vector. The reference frame to which those coefficients apply is implied in the equations and usually gets described somewhere nearby in the text explanation. Some people will start with an equation that looks like the first one but limit it to a sum over only the vector coefficients. Then, when a calculation must be performed, they switch to the matrix notation for vectors and proceed. These people are living halfway between the two systems and probably find some intuitive advantage to the geometric approach whether they know they do or not. Example 2 For another example, imagine a planet orbiting the sun. That planet is at a distance R and moves with a momentum P. We shall write the angular momentum of the planet using both approaches. In the vector algebra, we would use a cross product defined by the right hand rule to get the following. L = R X P (R cross P) L is a vector defined as perpendicular to R and P at the same time. Since there are two possible directions for this 'vector', the right hand rule is used to choose the right-handed one. The magnitude of L is the product of the magnitudes of R and P times the sine of the angle between them. It turns out that the cross product defines a different kind of vector from R and P. It is important for users of this system to distinguish polar vectors from axial vectors, as they are not really the same thing even if they appear to be. In the geometric algebra, we would use the general product defined in the algebra to get the following. L = R ^ P = 0.5(R.P - P.R) (^ is the antisymmetric part of (.) in this case) The geometric nature of L is dependent on the (.) product and not defined to be a vector. As it turns out, L is a bivector. In a three dimensional, Euclidean space, L has the same number of coefficients whether it is described as a bivector or as a vector, but its nature under parity transformations is quite different. A little more exploration would show that all the axial vectors from the other system are bivectors in a geometric algebra. Keeping the polar vectors separate from the axial vectors is done automatically since they are of different ranks. Example 3 The last example involves an operator that rotates other objects. This example will be restricted to two dimensions in order to make it easier to understand. There is only one plane in two dimensions, so there is only one kind of rotation operator. Imagine a two dimensional vector described as V = A x X + B x Y. Suppose we want to rotate it by 45 degrees swinging the X direction up toward the Y direction a bit. The left sided operator that does this is as follows. R = cos(45) x 1 + sin(45) x XY Multiply them as follows. Vprime= R.V = * = (cos(45)1+sin(45)XY)(AX+BY) * = cos(45)AX + sin(45)AXY.X + cos(45)BY + sin(45)BXY.Y * = cos(45)AX - sin(45)AY + cos(45)BY + sin(45)BX * = [cos(45)A+sin(45)B]X +[cos(45)B-sin(45)A]Y Thus far, we have shown enough material to demonstrate how to use the tool for classical theories of physics. With a bit of practice, the reader could use geometric algebras to see why special relativity is built into the fabric of their solution space if they pick the right algebra and the right metric. For the physicists, though, this is not enough. A better mathematical tool to do what we already know how to do is only of pedagogical interest. Whether geometric algebras provide engineers and software developers more efficient approaches to writing solutions remains to be seen. For the physicists and physics students, then, we shall provide one more example that needs more work on a theoretical and experimental level. To do this, we must provide one more definition. 8. Left Ideal A left ideal is a set of elements from a ring that behave as follows. If M is an arbitrary element of the ring and L is an element of the left ideal, then M.L is an element of the left ideal. Our geometric algebras are rings, so a left ideal in one of them has the property that any element multiplied from the left with an element of the ideal is still in the ideal. This has the curious property of ensuring that operators that can be written in the same algebra as the operands will not take you outside the left ideal if you start there. Why this is interesting to the physicists is best shown by an example in a four dimensional algebra with a space-time metric. Example 4 Consider an algebra whose generators are CT, X, Y, and Z. Let the first generator have a negative square while the others have positive squares. Also let the algebra be defined over the complex numbers for the field. From this algebra it is possible to write an idempotent that looks as follows. I = 0.25 (1 + iCT)(1 + CTXY) or = 0.25 (1 + ip/m)(1 + E5.S) where p is a time-like four-vector, S is a space-like four-vector and E5 is the quadvector. It turns out that if you try left multiplying any element of the algebra against I you will not cover all the possible elements in the algebra. Only a subset can be reached through left multiplication, so I can be said to generate a left ideal. In a four dimensional algebra, we start with four generators and create sixteen basis elements through multiplication. This sixteen-element set is the basis of the more familiar vector space associated with the algebra. If we use our idempotent described above, we can create a smaller vector space spanned by four elements that can be written as follows. Basis elements of the left ideal are 0.25(1 +/- ip/m)(1 +/- E5.S) Anyone with any exposure to early relativistic quantum theory will recognize this ideal as having the same 'states' as a four-component bispinor. Since these elements span a left ideal, left-sided operations on them from other elements of the algebra ensure the resulting element is still in the ideal. This is very much like saying that an electron is an electron no matter what state you happen to find it in. Therefore, the left ideals ARE renderings of the particles that an algebra can describe. No appended spinor space is required to get spinor-like behavior from these algebras. The behavior is already there. The really cute thing is that spinor-like behavior can also be found in the classical theories written with these algebras. There is no way to get it out, really. Future Work The bulk of the work that is occurring today using geometric algebras is being done at the post-graduate level by academic researchers. Their results get discussed at conferences and published in peer-reviewed journals. As a consequence, it is not that easy for someone outside the immediate field to break in as a beginner and learn to be productive. This is mostly due to the fact that the physics problems being research are complex, post-graduate problems. The usage of the geometric algebras is not all that complex. There are two open source projects managed by the author that make use of geometric algebras. The first supports the creation of a java library to be used much like a library that supports matrix and tensor objects and their operations. The second project is a solar sail simulation application that makes use of the library from the first project. Anyone curious about the topic of geometric algebra is invited to check out these projects and see geometric algebras in action. Clados Project = http://clados.sourceforge.net SailAway Project = http://sailaway.sourceforge.net References Representation of Objects: http://www.kuro5hin.org/story/2002/5/7/1345/25152 Clifford Algebra Society: http://www.clifford.org D. Hestenes Book: New Foundations for Classical Mechanics. ISBN 90-277-2090-8 D. Hestenes website at ASU: http://modelingnts.la.asu.edu/GC_R&D.html Cambridge Group: http://www.mrao.cam.ac.uk/~clifford/
Qt is a wrapper around the native calls (Windows API, X API, Macintosh WindowMgr/ControlMgr API, etc).
So why is it bad for MFC (where you go from EnableWindow(window, verb) to window->Enable(verb)), but good for QT?
Perhaps I deserve it for not previewing and seeing that the formatting was all screwed up :).
Beaten... why? I think it's fun :-}
You're right on both counts. See this Usenet post for a little more detail.
It's always a long day... 86400 doesn't fit into a short.
I don't think there are many Windows programmers using MFC for new development. A comparison of Qt and .NET would be more relevant.
We had an MFC vs wxWindows discussion, where Qt and others were of course brought up, and it was MUCH more informative. See here.
I personally use QT, its feature rich and the cross platform ability is obviously a large benefit.
As a previous poster mentioned the VCL is really nice too, its just a shame that I have to use Object Pascal to use it I hear a C++ version is coming to Linux though.
As for MFC I don't really like it, it just doesn't feel object orientated enough!
However, MFC isn't that bad. If you're developing a Windows application in C++, and you're forced into using MS only technology cause your boss won't pay the $1000+ per developer license for QT, and your choices are between using MFC and the base Win32 API, then MFC is the way to go. Granted, the Document / View Architecture is uh... well it's *odd*, but once you get the hang of it you can whip out a reasonably good GUI quickly.
MFC does do some nice things for you, mainly serialization and treating controls as objects, and the Message Maps are a vast improvement over the 10 page switch statements for Message Handling in Win32..
However, since MFC is "dead", I'd rather see a comparision between C# and Windows Forms vs. C++ and QT.. (and a lot of this I posted on Microsoft's own news groups.. hehehehe)
Seriously, If you want to see something that's godawful, look at C# and Windows Forms.
The below is from a post I submitted to Microsoft's own news groups.. to date, I have not gotten any kind of response from Microsoft. A couple of "Wait for Borland C++ Builder.NET" responses.. but nothing from Microsoft. Since MFC is "dead" and .NET is the "way" for Microsoft now, it makes sense to post this..
Especially if you have an option between QT and .NET... PICK QT FOR THE LOVE OF GOD.
While trying to develop a dockable tool window (much like the ones found in Visual Studio.NET) I've done a lot of research and had a lot of grief. Out of the box, you can't create a dockable window.
No one seems to know of any royalty free, open source solutions, and the .NET Magic library doesn't count. Look closely at the source and
you'll find that there's an awful lot of Win32 API calls being made
via PInvoke, which, per Petzold on page 237 of "Programming Windows
with C#", is "no longer writing managed code, and certainly not
platform-independent code."
So for the .NET Magic library users, what's the point of even
bothering to use C# and Winforms if all you're using it for is to wrap
Win32 API calls? Why not just use C++ compiled as a Win32 app and get
the performance increase and greater toolset? I know that making it a
dockable window is just a window style, (FWS_something, too lazy to
look it up right now, which you would think would just be a property
of a Control type, since Control seems to Map 1 to 1 to a Window.)
Which brings me to the largest gripe I have about the .NET framework:
The Winforms really suck. The overly simple UI controls it exposes are
simply not acceptable in today's enviroment. First, I'll give
Microsoft credit: Visual Studio.NET's UI is absolutely stunning, and
the C# language has some nice features....
However, it is seemingly impossible to create any form of advanced UI unless you derive your own controls or use PInvoke to create GenericPane window classes. And according to Spy++, those nice dockable, resizable windows are of Window Class GenericPane. Seriously, take Docking toolbars for example - we've been able to do this in MFC for years, so using "pure" C# really seems like two steps back instead of the leap forward the PR machine would have you believe. For any kind of advanced UI are we really forced to pony up money for third party libraries or roll our own? (And again, for the goal of "pure" C#, using PInvoke doesn't count.)
What's really maddening is that there's so many other language / RAD toolkits that do this much better. C++ / MFC, C++ / QT (for cross platform), Java / Swing, to name a few.
Even the Menus aren't dockable / moveable. What's the point of using managed code if the only applications you can quickly produce look like crap?
(my apologies to Wired Magazine)
Tired: MFC
Wired: System.Windows.Forms
Anyone creating an app from scratch right now, or porting an app not written in MFC, should _not_ be even considering MFC. New MFC enhancements are usefull for maintaing the (large) base of MFC apps written in it over the last ?10? years. It's time is over though.
-Malakai
A Dragon Lives in my Garage
I don't know why everyone is claiming MFC is no longer in the picture after .Net. It's like claiming Newspaper was dead after TV came out. Here is an excerpt from MSDN:
.NET, MFC and C++ developers may be feeling left out. But don't worry--with the upcoming release of Visual Studio .NET, not only do developers using Visual C++® get a brand new IDE with tight integration for server-side development and a much improved C++ compiler, MFC and ATL have also received significant new features. The clear message is that MFC continues to be a great framework for developing sophisticated, rich client applications for all Windows® platforms. In this article, we'll provide you with a survey of the new features that you can use in your MFC applications.
It has been three years since the last major update to MFC and ATL. With all the press on Microsoft®
There's a new MFC DLL (MFC70.DLL) that is no longer backward binary-compatible with MFC42.DLL, but your source is still compatible (although message maps have been made more type-safe, so that may break some code).
MFC and ATL are much better integrated, and common classes such as CString are now shared between the two libraries.
Header files are synchronized with the latest Platform SDK, supporting UI features in Windows 2000 and Windows XP such as themes and manifest resources, Active Accessibility®, and new common dialog boxes.
Many new UI classes have been added, including support for using DHTML in dialog boxes and enhanced bitmap support with CImage.
New utility classes can be used in both MFC and ATL applications, such as regular expressions, performance counters support, and security.
Now there's support for consuming Web Services in MFC applications and writing Web Services and applications with ATL Server classes.
High-performance access to databases has never been easier using the new OLE DB attributes and classes.
STL has been updated.
I haven't used QT, but my experience with MFC has been:
D FC' scattered all over it. And you can just pull values out of a dialog box; you have to use this thing called "Direct Data Exchange" that I never really figured out, and you have all these magic cookies that get defined in some header file somewhere and you don't even get to write main() and all the functions have weird names and at least we have a good String class but all the classes start with the letter 'C' and everything is in hungarian notation and all those weird macros and WHERE DO I DRAW STUFF IN MY WINDOW?! and BLAH BLAH BLAH!!!
MFC is the most confusing, bloated, needlessly complex, poorly-designed API in the world.
First, you use this little program called 'AppWizard', that asks you a few question like if you want toolbars, if you want database support (database support?), if you want OLE, etc. Then it spits out this hulk of code that has all these weird constants and macros in them with names like '__AFX_DEFINED_DDLXCI_AXWEC_UBER_MACRO_EXCHANGE_D
I write in Java now.
I can't help feeling that, whatever its position on MFC, the article was unjust in its uniform praise of Qt. Some of the container classes there (QMap?) appear to be somewhat inferior versions of the STL equivalents, in case the C++ library in use doesn't support the STL parts properly, but doesn't support all the template guff required to use them(?!) To their credit, they do at least try to support the standard interfaces so you can use their containers with standard algorithms, which is a definite improvement over MFC.
The article also seems to praise QString, which is yet another string class with a Big Bloated Interface(TM) (doh!) that thinks using only mutable strings is the way forward (double-doh!) and reference counting/copy-on-write of a mutable string is a Good Thing (double-plus-doh!). These are well-known design flaws with both approaches, relating to efficiency, thread safety, etc. If they wanted an improvement, they should have provided an immutable string class with a suitable set of operations, and a string-building framework to go with it where it's genuinely the appropriate tool. Oh, and being in native Unicode isn't particularly clever. Why not just use std::wstring, anyway?
As for the graphics, sometimes I want to lay out my dialog controls in exactly the positions I decide to put them in. Dynamic generation can be a good thing, but don't mandate it, because sometimes it's simply wrong.
I also have quite a bit of experience of i18n, and I'm all-too-familiar with the pain of translations, etc. For those who don't know, l10n (the opposite to i18n, i.e., making your location-generic application work in a specific locale) is about 10% translation and 90% integration, fixing up all the dialogs, ensuring that your UI can cope with reordered sentences (hope you don't like the IOStreams approach; printf had it right years ago) and so forth. A simple tr() function is not the silver bullet here, contrary to what the article seems to suggest.
Don't get me wrong, I think Qt is a nice library, and much better than many of the alternatives. But some of the claims in the article are just downright false.
If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
I assume from the rest of your post that you're advocating using .NET instead? Why on earth would any development team of sound mind do that?
MFC, OTOH, while kludgy and less than well-designed, has a developer base of zillions across the world who know how to work around its kludginess and get the job done. It is tried and tested, so at least you have a pretty good idea where the bugs are. There is a lot of truth to the old saying "Better the devil you know".
If I had a new development team starting on a Windoze app, MFC certainly wouldn't be my first choice of tool -- far from it -- but it would be waaaaay ahead of anything to do with .NET.
If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
Would that be the same Don Box who wrote about how COM was wonderful for years, but now says it's crap and we should all use .NET?
You should be very careful when listening to two-faced Microsoft weenies, particularly when they're demonstrably wrong. MFC was used in writing Visual Studio itself for a long time (though never, AFAIK, in writing things like Office).
If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
I agree, there's also ATL i think that's even worse!!! I found it far easier to write using straight windows API.
Fortunatly I wrote my own Windows wrapper before MFC came along.
MFC might look good in comparison to Visuial Studio which must be one of the worst Dev environments I've ever used, I'd never take a job where Visuial studio was a requirement.
thank God the internet isn't a human right.
here
borland has Just released Kylix 3with C++ and Object Pascal support in one product.
/. yet?
Don't know why this hasn't made it to
thank God the internet isn't a human right.
Microsofts help was ok when it was in plain help files It just got shit when monkey soft switched to HTML help forcing everyone to install IE.
thank God the internet isn't a human right.
The Microsoft Foundation Class (MFC) is a graphical toolkit for the windows operating system. It is a more or less object oriented wrapper of the win32 API, which causes the API to be sometimes C, sometimes C++, and usually an awful mix.
The only non-C++ you could complain about in MFC is the use of some Win32 API structures without containing classes/accessors. Under the circumstances (given the number of them!) I don't think this is too big a deal.
MFC programming requires the use of Document/View model and templates.
No, it doesn't. If you don't want Doc/View, you can just use the MFC-dialog-application template.
I've never seen the other problems you mention:
- you can probably ditch the document/view model (I've never tried) but you can easily bury it if you don't like it and I've never found it inflexible enough to be a hinderance. Cite an example?
- I wouldn't be surprised if splitting a window to show two different documents probably violates the windows UI design guidelines. You can get equivalent function using an MDI app (although I think the guides have deprecated those) or implement a 'document container' class or something. You probably don't need too much imagination.
MFC is a kind of object wrapper allowing access to the windows API,I'd consider this a plus - lean (or as lean C++ as you'll get), efficient (ditto) and feature-complete.
And there are nasty tricks, without any consistency. For example, if you create a graphical object, it is not created until the Create() methods has been called. For dialogs, you must wait for OnInitDialog, for views, you wait for OnInitialUpdate,
No. This *is* consistent and logical. And OO.
- When you create a CDialog, you create a container class for a window handle with dialog-like methods. You may set up the initial state of the dialog, member variables of the container class, etc. But because you have an empty handle you can't actually play with the dialog yet.
- You Create() or DoModal() your CDialog object. Now the windows is actually generated on the desktop and the window handle is filled.
- You're called back in the OnInit* method to set any state on the window as it is created. You may now call methods that require a window handle.
I don't think MFC will crash - I think it'll give you a useful debug assert. But I haven't fallen into that trap for a while.MFC is full of these nasty tricks. And it is hard to debug.
'nasty tricks' is a little extreme. MFC integrates very well with Visual Studio's debugger and is relatively simple to debug. You're provided with the source code to step through if you need it. I've never had any trouble.
Qt is based upon a powerful callback mechanism based on signal emission and reception inside slots.
This sounds exactly like the Windows message model that you've just slammed (!). I don't see any problems with the windows message model - but then I'm familiar with the API.
The interface creation section: DDX and IMPLEMENT_DYNCREATE (why do you need that for your UI?) are relatively easy to understand - maybe try Prosise's book if you need enlightenment. You don't need to touch the message loop - it's buried in the MFC DLL and covers all cases. You can quite happily manufacture dialogs at run-time by calling Create() on control objects in the OnInitDialog() method.
Qt designer lets you do things that are not possible in MFC, like creating a listview with pre-filled fields, or using a tab control with different views on each tab.
Pre-filling a list view should be done in OnInitDialog(); the interface is quite simple.
Tabs are a different matter; you need to create child dialogs for each separate pane. This closely reflects what's going on in the OS API. It's not too difficult and there are good sample applications. Alternatively, there's a very simple interface to create complex property pages already provided.
Visual's documentation, MSDN (for which you must pay separately) is huge, on 10 CDROM.
It's no more than 3 CDs. It's bundled with Visual Studio. It's available online at http://msdn.microsoft.com/library/. And it's very good, complete documentation.
MFC's unicode is very easy. If you need to change the entry point of your application then you're doing it wrong; you probably need to change
If you're given non-unicode third party library then the third party ought to be able to supply a unicode version by changing a few flags and rebuilding. I'd be surprised if many vendors couldn't supply Unicode libraries if you asked them.
Resources and string-tables are part of the Win32 API. I find them useful and easy to program for. You have to try quite hard to load resources from the wrong DLL; all resources are indexed on exe/dll module handle as well as resource ID.
Latest MFC DLL: you should always ship the one you develop and test against! Win2K+ allows you to install a copy of the DLL local for your application. Alteratively, there are simple-ish mechanisms to auto-download the latest MFC from Microsoft.
To address some of your list of QT advantages,
- Controls... MFC uses native OS widgets which is arguably an advantage for Win32 programs: correct look and feel and always do exactly what a Windows user would expect.
- MFC does provide classes for network and database access
- Memory management shouldn't be a problem; if you create controls as members of the containing dialog class then they'll be destroyed automatically too. MFC's debug memory allocator is good, too.
I've never used CodeJock.Do people really have to look any farther to figure out why today's software is so buggy? The more subtle "gotchas" in a language, the more subtle bugs in the resulting products.
I understand the lure of mastering reams of arcane trivia. In fields like medicine, this is valuable. But, when you have to do so just to use a man-made programming language because of how often things are not what they appear, it is a stinging indictment of the poor design of the language.
"Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."
1st download a trial copy of CBuilder or Delphi and give there IDE a go...
.....
...
Here's my top hates....to the point of frastration.
1: (this is trully evil) the MDI interface.
2: Dialogues have loads of tabs but arn't resizeable.
3: Options arn't natural, e.g. right click on a project and I get
4: (part of 3) Options are hidden all over the place.
5: MSDN HTML help is shit (not the use of HTML for help, but the way MS have used it)
Here's a few things in CBuilder Delphi (as an example) that are farrrr superior.
1: No evil MDI
2: Options are quite easy to find
3: Fully RAD
4: Code compleation is highly typed e.g.
int a =
only lists things that can return or be cast to an int.
5: The help is generally quite good.
6: The api for extending CBuilder/Delphi is great and easy to use (easier than Visual Studio).
thank God the internet isn't a human right.
So you'd rather have a 'grown-up' but non-OO and kinda ugly language than one with a flexible and powerful object model, RTTI, inheritable message-handling framework, copy-on-write strings, etc., etc.?
All the current hype over .NET is old hat: Delphi has had most of what .NET has to offer for years (not surprising given who wrote them both ).
Object Pascal makes me much more productive than C++ ever did, and I'm not talking about GUI gubbins here, but the 'invisible' back-end stuff.
What's interesting about qt is that its easy to get an app to run both on the desktop and then have a smaller screen version for qtopia.
Check my site out for ogg vorbis music produced with linux.
And i got rejected
* 2002-07-23 13:28:19 Kylix 3 out soon (articles,news) (rejected)
grrrrrrrrrr
The best exposition I've seen was a set of three articles on "Reference Counting" in Herb Sutter's Guru of the Week series. You can find articles 43-45 on his web site, and as he notes there, an updated version is available in one of his books. You could also search the history for the Usenet group comp.lang.c++.moderated, where GotW is posted, to see more discussion on the subject. You might also want to check out the most recent GotW (questions but no solutions on the web site, but check the newsgroup history) for a few thoughts on why string classes tend to have overbloated interfaces.
If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
The main problem with QT is this thing called MOC, some kind of preprocessor you need to run. Then of course, there's the license fee for use in any commercial software. Other than that, there's just the use of Expose events in X11 making it slow and ugly.