Slashdot Mirror


Rapid Application Development with Mozilla

Matthew Morgan writes "Mozilla's strengths as an application platform often go unrecognized for lack of good documentation. Nigel McFarlane sets out to change that in Rapid Application Development with Mozilla. McFarlane describes his book as "a conceptual overview, reference, and tutorial" for building applications on the Mozilla platform. But does he have room for all three in one book?" Read on for Morgan's answer to that question. Rapid Application Development with Mozilla author Nigel McFarlane pages 770 publisher Prentice Hall PTR rating 7 reviewer Matthew Morgan ISBN 0131423436 summary A good overview and tutorial for building applications atop Mozilla, though not a comprehensive reference.

The Basics Rapid Application Development with Mozilla (hereafter RADM) centers on XUL, Mozilla's XML dialect for describing GUIs. Other Mozilla components, like XBL and RDF, are described mainly in terms of how they plug into XUL. Each chapter presents and explains a component, then shows it in action by using it in an example application (a web-page annotator) developed throughout the book. Chapter conclusions take the form of debugging hints; as McFarlane ruefully notes, most errors cause Mozilla to silently do nothing, making debugging a chore.

The first half of RADM covers basic XUL use -- the usual complement of widgets with CSS to style them and JavaScript to manipulate them. McFarlane does assume previous exposure to basic HTML, JavaScript, and CSS, but extensive experience isn't required. At each step McFarlane does a good job explaining what's similar to HTML (e.g. most DOM stuff) and what isn't (e.g. the layout model). A few components have no real analog in the HTML model, like Mozilla's command dispatch system, so they're presented from the ground up.

The Back End

The second half of the book leans more toward the back end: using RDF for registries and template data; piping data into XUL with overlays, templates, and XBL; using and implementing XPCOM components; and deploying applications built on Mozilla.

McFarlane's RDF tutorial is one of the best I've seen. He starts off on the right foot by introducing things in terms of a directed graph, with lots of examples and diagrams. Only after eighteen pages of that does he introduce the RDF/XML syntax. His explanation of RDF/XML is unusually lucid, quite a feat considering how hairy RDF/XML gets. (Disclaimer: I've had past experience with RDF, so I wasn't reading this as a beginner -- in other words, YMMV.)

In the succeeding chapters, RDF is applied within the various Mozilla arenas, like XUL overlays and package installation, where it's used to store config information. The centerpiece of RDF in Mozilla, though, is in its use to create data-driven XUL files through XUL templates.

The chapter on templates runs to sixty-plus pages, and it's worth it. McFarlane covers things I haven't seen covered anywhere else. For instance, he describes the algorithm the RDF query engine uses to evaluate queries, so that you can better understand what kind of queries you can construct. This is crucial information because the query syntax allows a lot of queries that are logically reasonable, but won't actually work.

This points to a strength of RADM: McFarlane doesn't hesitate to criticize Mozilla where necessary. Throughout the book, he flags incomplete features, buggy implementations, and other gotchas, such as security restrictions surrounding RDF that make it all but useless for remote scenarios.

(Incidentally, McFarlane explicitly disclaims coverage of Phoenix/Firebird/Firefox, sticking to Mozilla 1.4, but in practice everything I've tried has worked fine in Firefox 0.8.)

Two Out Of Three Ain't Bad

So, does RADM manage to accomplish its goals of being a conceptual overview, tutorial, and reference? I'd give it two out of three.

As a conceptual overview, RADM shines. McFarlane is at his best when comparing and contrasting closely related components, like overlays, templates, and XBL, all of which extend XUL but do it in different ways. I was left with a good picture of what can and can't be done in Mozilla.

As a tutorial, RADM is solidly useful. The example-application sections cover a surprisingly large amount of ground -- more than enough to get a developer new to Mozilla up and running. McFarlane chose a good subset to present as examples; still, all of his clear writing can't paper over the fact that Mozilla is really complicated, not just internally, but in the interface it presents to developers using it as a platform.

As a reference, RADM stumbles. The index is slim -- a mere eighteen pages after 752 pages of content -- which makes small chunks of information hard to find. This is mitigated by a detailed and well-organized table of contents. After a few weeks of use, I find myself turning to the contents first, and only trying the index if I have to.

Fundamentally, though, RADM isn't really a reference book, and definitely not a "quick reference." You'd be better off using a good site like XULPlanet for quick what-arguments-does-that-method-take checks, and reserving RADM for in-depth explanations.

Conclusion

RADM is published in Bruce Perens' Open Source Series at Prentice Hall under the Open Publication License. After a few months of letting the book sell on its own, they'll post the PDF of the entire book online. Is it worth buying in print? Given that it's more of a sit-down-and-read book than a quick-reference guide, I'd say so.

If you're considering Mozilla as a platform, I'd recommend RADM for its reasonable balance that shows Mozilla's strengths and weaknesses. If you're already sold on Mozilla and just want to wrap your head around it and start building an app on it, RADM is the book for you.

You can purchase Rapid Application Development with Mozilla from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page

21 of 249 comments (clear)

  1. Bugs by Fiz+Ocelot · · Score: 3, Insightful

    I'll take less bugs over rapid development any day.

  2. It's time to embrace XUL by darthcamaro · · Score: 4, Insightful

    I think its time for the dev community to embrace XUL as a cross-platform development tool. Too much is made of Qt and GTK - both are great, don't get me wrong..but XUL just doesn't get it's due respect.

    1. Re:It's time to embrace XUL by hot_Karls_bad_cavern · · Score: 2, Insightful

      Sounds great.

      Now for the question that determines whether or not i choose to believe you: why XUL over others?

      Please explain.

    2. Re:It's time to embrace XUL by OmniVector · · Score: 5, Insightful

      I don't deny that XUL is a good cross platform development tool, but Qt, GTK, and XUL are all very differnet things. Qt is a comprehensive C++ API, including networking, threading, images, GUI, and more. GTK is strickly a GUI toolkit, plus it's written in C which allows it to very easily be linked with almost anything. XUL is not a toolkit, but a platform-independent GUI description made with XML. This allows you to write XUL apps that look like native os x apps in os x, native windows apps, and well crappy skinned apps in linux. They are all different things really. So one can't mutally replace the others (i.e. XUL replacing Qt).

      It would be an interesting proof-of-concept though if someone wrote an XUL based desktop environment. So far XUL is really missing a killer-app (besides mozilla).

      --
      - tristan
    3. Re:It's time to embrace XUL by arkanes · · Score: 2, Insightful
      GTK is just a toolkit but it sits on top of glib, which is a C api to a bunch of that other stuff - the whole GTK family has basically all the stuff that Qt has, it's just seperated out more.

      As for XUL - as far as I'm aware, the only XUL-based application out there is Mozilla and XUL is tied very tightly to it - are there any XUL libraries for other, more native toolkits? There's at least a couple other XML based layout languages - wxWindows has one, Gtk has one, and I think Qt uses one now also. Whats the gain from XUL?

    4. Re:It's time to embrace XUL by ciroknight · · Score: 3, Insightful

      XUL would shine as an application development environment in exactly the same way Visual Basic shined under Windows. You may argue that Visual Basic is a very weak language, but it was intended as such, and it was intended to be easy so that anyone could learn it quickly, and be developing apps quickly, therefore speeding up everything.

      What's more, XUL should let us do fairly easy localizations and the like. Not that this has been a problem in Linux since every major project has implemented some api to get around it, but for smaller projects that want to become bigger projects, it's nice to already have features like localization at your hands.

      I think it would be a fairly impressive, and quite snappy, user environment. With SVG coming to age and XML being embraced *even though I hate it*, it's good to see an actual Good Use (tm) of it.

      Furthermore, doesn't Mozilla require GTK libraries? I was under the impression that it used some code from GTK, but didn't actually render it's widgets and the like with it. I'm most likely wrong about this, but it's still interesting.

      --
      "Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
    5. Re:It's time to embrace XUL by bwt · · Score: 2, Insightful


      My problem with mozilla is not XUL, which I think is great. It's that javascript is the only language with built-in support. Sure you can add others, but unless they are there by default that is too much of an administrational burden and you can't rely on it.

      Mozilla needs to do one of two things (or both):
      a) include a java VM that can run apache BSF
      b) work with the parrot people and build it into Mozilla

      You can rest assured that Microsoft is working on multiple language support through a marriage of IE to .net.

    6. Re:It's time to embrace XUL by yerM)M · · Score: 2, Insightful
      XUL isn't reliant on Javascript. You can program xul in python through XPCOM and through Java with luxor among others.

      Komodo is written in XUL with xpcom+python.

  3. Web-installer.... by kevlar · · Score: 4, Insightful

    The single feature that I wish I could get with my applications is the web-installer that Mozilla has for its install. It allows you to stop and resume a download and it would allow people with crappy dialups to download large files without having to restart after every disconnect.

    If I could build an installer with mozilla that would let me do this with _any_ application, that would be golden!!

    1. Re:Web-installer.... by Syberghost · · Score: 4, Insightful

      It allows you to stop and resume a download and it would allow people with crappy dialups to download large files without having to restart after every disconnect.

      You realize FTP has had that capability since like 1985, right? And that Postel didn't invent it, either?

    2. Re:Web-installer.... by kevlar · · Score: 1, Insightful

      You do realize you completely missed the point of my posting, right? I am fully aware of the capabilities of FTP. The problem is that when you have end-users who do not use, nor never will use an FTP client, FTP is useless. What I need is a web installer that'll download large files via whatever "resume" capable protocol and install my application. It all needs to be as simple as clicking on the executable. FTP Clients do _NOT_ offer this.

      But thanks for the condescending insight anyways...

  4. Forbidden!! by Anonymous Coward · · Score: 2, Insightful

    RADM is published in Bruce Perens' Open Source Series at Prentice Hall under the Open Publication License.

    Doesn't look like a very open license to me.

  5. um. by Run4yourlives · · Score: 1, Insightful

    Why?

    Just because you can do something, doesn't mean you should.

    So why exactly should I use Mozilla for RAD?

  6. Re:Support of large corporations by DebianRcksLindowsLie · · Score: 3, Insightful

    Looks like it's time for me to stop shopping Home Depot and supporting Lowe's! Thanks for the tipoff.

  7. Support of large corporations-Ahead of the critics by Anonymous Coward · · Score: 3, Insightful

    And for those who've forgotten recent history. Remember all those people berating mozilla for all their cross-platform work, and just give us the browser. Now here we are with a rich toolkit that can run up against anything Microsoft can produce.
    Something that either would be behind, or none existant if the developers had listened to their critics.

    This is one of the reasons developers shouldn't pay attention to armchair critics. Critics more than anything else, are working from incomplete, or inaccurate, or just plain wrong information. just look at the binary vs open source drivers issue with the Linux kernel.

  8. Re:Quick Question by DdJ · · Score: 2, Insightful

    Personally I'd like to see the application logic live in web services (as in WSDL/SOAP), with WS-Security support for authentication.

    Then the presentation layer could be done in something like Mozilla/XUL on Linux, .Net Windows Forms apps on Windows and Pocket PC, J2ME on PalmOS and java phone devices, AppleScript Studio on MacOS X, and all sorts of other things (eg. our portal has a RAD framework for portlets, and it can slurp up web services with no trouble, and I'm sure there must be at least one BREW dev environment with support for them).

  9. Re:Quick Question by bwalling · · Score: 2, Insightful

    Mozilla/XUL on Linux, .Net Windows Forms apps on Windows and Pocket PC, J2ME on PalmOS and java phone devices, AppleScript Studio on MacOS X

    Uhh, Mozilla/XUL runs on Linux, Windows and MacOS X. Why would you develop three different times when you could do it once?

  10. It's time to embrace XUL-Remotely. by Anonymous Coward · · Score: 1, Insightful

    Actually there's always one thing I've wanted to know. Can you remotely deliver these XUL's to the browser, so when you start up it pulls it off a server somewere. Or is this strictly a local thing?

  11. stand-alone XUL by Anonymous Coward · · Score: 1, Insightful

    Like everything else I've seen on XUL, the intro this book hypes how you can build standalone apps with XUL, which don't need to be Mozilla extensions.... and then says "but we're not going to do that."

    Hi. THAT'S THE PART I WANT TO LEARN. The rest is just syntax, it's XML and javascript and it's really not that hard, if you keep a reference handy (and XUL Planet seems pretty nifty for this) you can make it up as you go along.

    But how do I get started building a standalone app? Where do I get just the mozilla libraries? HELP.

  12. Re:Quick Question by DdJ · · Score: 2, Insightful
    If you could have an app that looked and acted exactly the same on all desktop machines, and appropriately differently on palmtop devices (but the same across all such devices), would that be enough to make you want to avoid duplicating all those presentation layers?
    Actually, no. That's exactly what I do not want. I want an app that conforms to each platform's UI guidelines. The UI guidelines of the different platforms are incompatible with each other, though. An app that behaved exactly the same on each desktop platform would be able to conform with guidelines on one platform, but then it would be jarring for folks who don't use that platform.

    But back to the rest of what you were writing...
    There are a number of JVMs available for Pocket PC devices, either as MIDP, J2ME Personal Profile, or its predecessor Personal Java, the latter two being Java 1.1.8 compatible and capable of running applets. The exact versions available depend on the underlying processor, but Creme, Jeode and IBM's J9 are ones I've encountered.
    Could you post a more specific pointer to IBM's J9 one? That's what I'm running on my Tungsten T3 already, and if I could run that on my iPaq h4350 (ARM-based PocketPC 2003), I can do a real comparison and see if it's suitable for our applications.
  13. Re:Rapid Application Development, what does it mea by jesser · · Score: 2, Insightful

    Firefox is much faster and slightly more featureful than the browser component of the Mozilla suite. Saying XUL is slow because Mozilla is slow is like saying C++ is slow because your insertion sort code sorts slowly.

    --
    The shareholder is always right.