C vs. 4GL (was Re: Informix Evaluation)
Posted in 1995
> Subject: Re: Informix Evaluation > Date: 19 Feb 1995 10:24:14 GMT > Reply-To: peter@prospect.anprod.csiro.au (Peter Wiley - Poultry) > Organization: CSIRO Division of Animal Production, Prospect NSW > > >I4GL may not be God's gift to programming, but it's got to be wayyyy more > >productive than C! It seems to me to be neither buggy (tho there are > >bugs) nor sluggish. > > > >If you want to produce buggy code I'd pick C over a 4GL any day. > > > >--------------------------------------,------------------------------------- > >Kerry Sainsbury, kerry@kcbbs.gen.nz | THE INFORMIX FAQ > > IMHO, it is far easier to write incomprehensible C than Informix 4GL. I wrote > 10K lines of C++/Versant (an OODB) for one project. Could have done the same > thing in 2K lines of 4GL. I'm very careful in coding in C (or C++) not to get > too clever in what I am doing; some poor maintenance programmer (probably me) > will have to read/alter the code one day. > > C's bad rep comes from "clever" programmers, frequently academics, who think > it is a statement of how superior their intellect is to write code that no-one > else can understand. (Told one that if he worked for me and wrote code like > that, I'd fire him. I was doing a postgrad course there at the time :) ). I agree with all of the above views, but include them for context. > Inherently, 4GL probably does have more bugs than C. But it's far less easy to > create *new* ones. And it's a lot easier/faster to create or modify apps. As > for speed, most databases are i/o bound rather than compute bound so any > speed improvement by using C is probably marginal. I agree about the speed (both statements), but I disagree about the bugs. I think you are comparing 4GL to the wrong thing. It should be compared to the ESQL/C preprocessor and library(ies?), not to C (the language) and the standard C libraries. Like any non-trivial piece of code, 4GL and ESQL/C will both have some bugs. My impression is that neither is better or worse than the other. I suppose someone at Informix could compute some stats from their bug tracking database. 4GL makes it very easy and fast to write apps that look a "certain" way. It is harder to generate apps with a different look and feel in 4GL, but it can be done. I don't write in ESQL/C, so I can't say whether the facilities it provides tend to give a particular "flavor" to your apps. Obviously, you can write any kind of interface you want in C. Also obviously you can code logic errors in 4GL, but it is harder than in C. The C syntax is so loose that you can write syntactically correct statements that look okay at first glance but do not do what you want. The more restricted syntax of 4GL makes it harder to make some types of errors. For example, the END IF, END WHILE, END CASE, etc. make it harder to get your control nesting wrong, compared to nothing but } characters in C. > C/C++ is great for writing code to interface with physical devices (modems, > serial devices such as load cells, scales, bar code raders etc) but 4GL is > better for DBMS apps. > > Peter Wiley Certainly. Heck, with 4GL you can't even read from a text file, unless you trick it by loading into a table with a long CHAR(nn) column. But 4GL lets you incorporate C functions very easily (compiled) or sort-of easily (RDS), for those cases where you need some extra functionality that 4GL does less well or not at all. Regards, Alan +---------------------------+-----------------------------------------------+ | R. Alan Popiel | Internet: alan@den.mmc.com | | Martin Marietta, SLS | Voice: 303-977-9998 | | P.O. Box 179, M/S 3810 | Standard disclaimers apply. Cutesy ones, too. | | Denver, CO 80201-0179 USA | Your mileage may vary. Void where prohibited. | +---------------------------+-----------------------------------------------+