Sun 16 May 2004
About 4th Dimension
Category : Technology/4D.txt
We've used 4th Dimension for much of the last ten years. It's been good to us, so I wouldn't knock it. I believe that, in many ways, 4D was ahead of its time. So, while my kid's still having his nap (when he wakes up, he's going to climb all over me to take him out, and it looks like it's going to be a wonderful Sunday evening), I'm trying to see if I can do a comparison of my experience using 4D, against what I'm currently seeing using Xcode, Cocoa, and Java on Mac OS X.
Firstly, in the old OS 9 days, 4D sat in the middle of the spectrum, with FileMaker Pro at one end, and MPW and Code Warrior at the other. It's significantly harder for an end-user to build stuff using 4D than with FileMaker Pro. But you can build a lot more useful applications, more quickly, and with database access built-in, than coding with the lower-level languages in MPW or Code Warrior.
And it's a good complete software development platform. But I haven't used it for almost two years now, so I've gone and take a look at www.4D.com to see if the tools we've used are still there, and I think they are.
It's important to mention the 4D suite of applications because it was the way they were put together - 4D, 4D Server, 4D Insider, 4D Compiler, 4D for Oracle, etc. - that contributed a lot to our own productivity.
For example, with 4D, you can do development on a standard 4D standalone set-up. Or you can use the Server edition, and immediately be able to do development as a project team. While the server makes sure that you are not able to make changes on a piece of the project that another person is working on, you're very much working the same way as if you're working on your own.
I think 4D Server is a superior piece of technology. Even now, I'm trying to think about how we can duplicate this functionality using Java. 4D Server is an application server. You load the application you have written on the machine running 4D Server, and the users access the application from their machines, using an application called 4D Client. Everytime you need to give the users a new version of your application, you only need to go to the 4D Server machine, bring the system down, replace it with the new version, and when the users log in again from 4D Client, they all get the latest revisions. It's a real time-saver. If you have, say 50 or more users, you'll appreciate not having to go to each of their machines to do a new application system release.
Then there is the 4D Insider application. It gives you a very nice ability to look inside and analyse your application - e.g., you may need to know how many other methods or sub-routines are calling on a particular method or sub-routine, so that you can anticipate the kind of problems you're going to be facing when you start making changes to things.
Finally, 4D Compiler allows you to build really fat binaries, versions that will run on Mac (OS 9 and then X, but I hadn't use 4D with OS X much), as well as Wiindows, all from the same piece of code. This is something I miss. It was what allowed us to keep our Macs while working with PC-using customers all these years.
So, in summary, I want to say that 4D is a very expressive language, in the sense that you can express difficult concepts using it (in exactly the way that FileMaker Pro isn't), and you can build very powerful applications using it.
Oh, I forgot, it also has built-in multi-threading, even though OS 9 didn't. It allowed us to build applications where each window ran within its own process. 4D programmers ought to take advantage of this power because, once you've written a procedure and launch it within its own process, e.g., within its own window, you can continue to launch many other similar windows based on this same procedure, and not having to worry about variables being overridden, etc.
And it's this multi-threading mechanism which allowed third-party 4D plug-ins like Christian Quest's Internet-Toolkit (ITK) to work its magic. By the time the Internet came out, we already had a substantial body of code in 4D (about 50 to 70 MB of code - it was a large insurance application). Using the extra functionality that ITK added to the 4D language (and the fact that 4D was multi-threading), it was possible to build a very effective, fully functioning web server with only 600 KB of code. Joining this little piece of code to the larger application, we were then able to re-purpose the whole 4D application for the web, with just two months of added work (in other words, the insurance company we were working for was able to do transactions over the web, in just two months after we discovered and tried out ITK).
We should have gotten hero status for this particular piece of magic (the users were indeed delighted) but we somehow seemed to have drawn the ire of the corporate IT department - they seemed to have a problem with the fact that the web server wasn't Apache or something like jBoss, or WebSphere (you mean you wrote your own web server? what a waste of time.) So that's for another story but the system did well enough, from my point of view, for quite a while yet.
Which brings me to the point, why switch away from 4D, then? Actually, I have not yet decided if this, indeed is a final switch from 4D. It's still pretty good. Being years ahead of their time gives them that little bit of longevity, in terms of relevance.
But I'm finding that we're having too many battles to fight with corporate IT departments. First there's the Mac that we're fond of using. It's been tolerated but there's a suspicion that we'll go on proselytising and in no time Mac pockets will spring up all over the place and out of control (of the IT deprtment, that is). Also, no matter what the 4D corporation does to distance itself from the Mac (I think it tries to do that sometimes, and if that were true, perfectly understandable), I get questions like these from the IT department, when our system was considered for a wider use within their corporation :
"Was 4D originally written for Mac or IBM compatible hardware?"
What kind of a question is this? Why does it matter? I thought - I give up and wrote "4D came out initially on the Mac platform, just like Microsoft's Word and Excel. At that time, the PC was still in the character-based mode; so it broke new ground in its use of the graphical user interface, just like Word and Excel." And died on my own sword. I guess I should have done better.
So, we're doing Java to fight one less battle. As far as we're concerned, the hardware is non-negotiable. It's either the Mac, or get out of IT altogether, and a lot of this weblog is trying to work out why we can take such a strong stand on this utterly stupid position.
But I know we're more productive on the Mac. If I had an actual business that I'm running, rather than being the software developer or the consultant, I would still (most definitely still) be using the Mac.
But I'm finding that using Java, and showing some stuff on the Unix command line, does help break some ice with the mainstream IT people because we can quickly get beyond the sectarian issues and move on to grounds where we share common interests, like building write-once run-many applications, the power of object-oriented design, the potential of web services, etc. The IT guys, they're not all bad, just like not all the guys on the Apple side are the good guys. There are various shades of greys.
I'm supposed to compare 4D with the use of Xcode, Java, and Cocoa, but this piece is already the longest I've ever written at one go, and the kid's waiting and there's not much sunlight left. Perhaps the next time.
Put your Mac to Work