PL/SQL koolaid

jdavidb on 2003-02-11T14:06:38

Stephen Feuerstein and Bill Pribyl are enamored of PL/SQL. I guess that's what makes them such incredible wizards. They've authored Oracle PL/SQL Programming, Learning Oracle PL/SQL, and I don't know how many other titles from O'Reilly. PL/SQL has a lot to recommend it, but some of the features of PL/SQL they get ecstatic about are things I expect out of any language: block structure, modularity, and so on. I'd almost expect them to be just as ecstatic about a Turing machine, since you can build all these features on top of it. It's not as if PL/SQL has closures, continuations, built-in hashes, or any of the other things I think can make a language exciting. It only recently got object-orientation and inheritance, and to be honest, I never was that thrilled with inheritance.

Perhaps most telling is Pribyl's dormant attempt at starting an online repository of open-source PL/SQL code. Not surprisingly, he references CPAN for inspiration, suggesting, "[while looking at CPAN,] if you’re not familiar with Perl, marvel at how much more readable PL/SQL is than Perl." Bill, I hold the deepest respect for what you and Steven have done with PL/SQL, exceeding Oracle's wildest dreams by far, but you have been sheltered and apparently just don't "get it." Please ... learn some other languages like Perl and Lisp. Don't let your talent go to waste; stretch it in every direction. It'll make you better PL/SQL programmers, and enrich the collective body of PL/SQL knowledge.


Builtin hashes

Matts on 2003-02-11T15:37:08

Of course PL/SQL has builtin hashes. It's a table with two columns.

No I don't know whether I'm being sarcastic or not either.

Re:Builtin hashes

jdavidb on 2003-02-11T16:29:05

Touche. You win. :)

Re:Builtin hashes

jdavidb on 2003-02-11T16:39:10

My point is that they appear to get excited over non-features, like the syntax for a PL/SQL block.

We used to take a vacation out west every summer, camping most of the time, but stopping every few days in a hotel to clean up and reconnect with civilization. In the states at least, there are certain things expected at a hotel. I remember gawking at hotel signs that advertised "air conditioning" and "color television," because every hotel I ever stayed at had these. It was like advertising that the rooms were filled with breatheable oxygen; you expect to get that as part of the price of admission. Noone would get excited, in the 1990s, that a hotel had color television, and noone would get excited, in Arizona in July!, that the hotel had air conditioning (On the contrary, if the air conditioning did not work, you would ask for your money back, leave, and inform your credit card company not to pay them. We did it on occasion.)

Similarly, I remember an AOL commercial awhile back that infuriated me because of a little line about "Want to send some email? It's easy; just click here." They were implying that the ability to send a simple email was something special and unique to their service, an offering above and beyond the competition, rather than a basic component of the product they were selling. (My fury came from imagining computer illiterate Americans watching the commercial and being tricked into thinking email was hard or impossible unless you had AOL, and thus choosing AOL as their first internet provider.)

So, I'm glad Feuerstein and Pribyl are so excited about PL/SQL. I'm glad they push it to its limits, know more about it than anyone on the planet (probably including Oracle employees), and share that knowledge in the beautiful orange books on my desk. I just keep hearing things that indicate their horizons aren't as broad as they could be, and thinking, "They're scary now ... imagine how dangerous they could be if they really applied themselves."

Re:Builtin hashes

billp on 2003-02-12T16:42:10

DECLARE /* requires Oracle9i or later */
    TYPE hashtable_t IS TABLE OF RAW(128) INDEX BY VARCHAR2(12);
    string_hash hashtable_t;
BEGIN
    string_hash('observation') := '6C6F6F6B73206C696B65206275696C742D696E2068617368696E6720746F206D65';
    string_hash('signature') := '62696C6C2070726962796C';
END;
/

Re:Builtin hashes

jdavidb on 2003-02-12T17:03:55

Hi, Bill. Welcome to the site. I'm honored to have attracted your attention.

Thanks for the books! I'm learning at breakneck pace. The combined experience you and Steve bring to bear is priceless. I recently completed Learning Oracle PL/SQL and was thrilled at all the things I was exposed to; many of those items I would probably never have seen. (And if you search my recent journal entries, you'll find one that amazed some of my coworkers and made me rather popular.)

Thanks for the hash example. I see hashes are indeed built in to Oracle, but they are not built in in the same way they are in languages like Perl, Python, or TCL. I was really only using Perl's hash tables, built into the language from the beginning, as an example of a great language feature.

I hope you didn't find anything I said here harsh; it wasn't intended that way. You and Steve show incredible mastery of PL/SQL, but as we all know, PL/SQL hasn't always had the best way of doing things. I can see references particularly in Feuerstein's writings about the days when DBMS_OUTPUT didn't even exist. You guys have sunk into every nook and cranny of the language, working around problems and showing how to get real work done.

I used to work with a dBase IV expert. He was never a trained programmer, but he worked in dBase for years until he could do anything he wanted. At the time of his retirement, he'd spent a couple of years slowly discovering how much easier a lot of what he was doing was in shell script. Going through them chronologically, his programs show a progression as he works with better and better tools. Learning shell script made him a better dBase programmer. I would love to have seen where he would have gotten if he hadn't retired. ;)

I've got some reading material I'd like to point you at, by a Lisp programmer named Paul Graham. I don't program Lisp, myself, but I want to some day. I keep hearing better and better things about it that make me know that mastering it will make me better at what I do, even if I don't use it directly. Here's an essay about running a business with Lisp programming as the prime product by Paul Graham. Very interesting.

different audience, maybe ?

tinman on 2003-02-12T05:22:36

Oracle DBA is a full time job, and you rarely get time to do more than the odd shell script for automation.. Maybe its an unfair generalization, but for non-programmers, the cleanness of PL/SQL code is probably a big deal..

I doubt many people are interested in TIMTOWTDI if it can just get the job done..In the same way that my parents dont really care about the mechanics of email so long as they can mail their friends from time to time :)

Re:different audience, maybe ?

jdavidb on 2003-02-12T15:30:28

Oh, I think Feuerstein and Pribyl are all about TIMTOWTDI. They're just missing a lot. They are programmers, btw, not DBAs.

Currently I take issue with anything that describes PL/SQL as "clean." :) That may change once I speak like a native, though. When I pointed out Pribyl's comment that PL/SQL was more readable than Perl, my point was that he was wrong (though probably for the same reason I don't think PL/SQL is clean: he doesn't speak Perl). Of course, good programmers can write COBOL in any language.

Re:different audience, maybe ?

tinman on 2003-02-13T06:06:57

FWIW, I think I speak PL/SQL better than any other language, and I think it is cleaner..

To me, PL/SQL is like Modula-2 (a Pascal-like language that I learnt in uni).. It forces you to concentrate on certain things and the core language itself is very simple.. Perl, for me, is different.. yes, you CAN write code that is as ordered as PL/SQL, but you dont have to.. Consequently, its more powerful. (rule breaking is a good thing, at times)..

I didnt know that they (Fuerstein and Pribyl) werent DBAs first and programmers later.. Maybe that's even a good thing (sometimes I get frustrated at how small and seemingly limited PL/SQL is compared to other languages.. try using UTL_File for example)

What makes PL/SQL neat, though, is how closely its bound with Oracle SQL.. (note: not any old SQL variant, but Oracle SQL).. you have decode, connect by and lots of other neat little tricks which are very hard to duplicate in other languages

/me stops rambling and gets back to work.. ;)

Re:different audience, maybe ?

jdavidb on 2003-02-13T14:06:59

Thanks for the insight. Ask me in a year or so, and I'll be able to offer a more educated opinion as to whether I really think PL/SQL is clean or not. I think what makes me feel it isn't clean is that it's so verbose. Just seems to have tremendously long keywords and a tremendous number of required ones.

I am pretty certain they are primarily programmers, not DBAs. O'Reilly's DBA books are written by other authors. Feuerstein, I know, was doing Oracle for McDonald's (contract work, I presume), when O'Reilly caught him to do the first Oracle PL/SQL Programming book and revolutionize the world. I presumed that meant primarily programming, though I suppose DBA could be involved there.

Yes ... being bound with SQL, and with Oracle SQL in particular is particularly neat. And that's one of the things they're excited about. Me, I just have to get past my fear of proprietary feature lockin. :) But I appreciate the SQL itself now, and will appreciate the Oracle extensions in the future.