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

39 of 249 comments (clear)

  1. Rapid Mozilla Development by Hot+Summer+Nights · · Score: 5, Funny

    ln /usr/bin/konqueror /usr/bin/mozilla

    --
    Karma: Terrible - and proud of it!
  2. Bugs by Fiz+Ocelot · · Score: 3, Insightful

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

    1. Re:Bugs by Anonymous Coward · · Score: 5, Funny

      Within the first four minutes:


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

      > That should be "fewer" you tool.


      I guess he proved his point. His "rapidly developed" comment had a bug.

    2. Re:Bugs by Anonymous Coward · · Score: 3, Informative

      You obviously have no idea what rapid development means. It does not equal "cowboy coding with no testing". It means minimizing bureacratic overhead; iterative approach, building of prototypes. Iterative approach and prototyping make it LESS likely bugs stay there very long -- instead of having month-long painful integration infernon at the end of 2-year long waterfall death march, integration is done much more often, prototypes are reviewed, code is refactored, and code quality remains high.

  3. Download link by Anonymous Coward · · Score: 4, Informative
  4. Support of large corporations by sibdib · · Score: 5, Interesting

    Oracle is going to write their applications so that they take advantage of the rich client opportunities that XUL provides. They are going to use Mozilla as a platform in much the same way that the Komodo IDE is based on Mozilla. XUL allows developers to do much more than they could with just HTML.

    This is a great opportunity to show what Mozilla is truly capable of. In may ways Mozilla offers today what Microsoft is only planning to release with Longhorn. Not to mention the fact that Mozilla is Free Software and platform independent. It's made to order for developing and releasing rich client applications on a wide variety of platforms.

    1. Re:Support of large corporations by Anonymous Coward · · Score: 5, Interesting

      Proof of that support reared its (not) ugly head this weekend...
      I was in Lowe's home impovement this weekend, and noticed that the terminals appeared to be running custom apps based on Mozilla on Linux terminals (as well as some character based apps). The widgets appeared to be Gnome, but I am not positive.

      Brian

    2. 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.

    3. Re:Support of large corporations by great+om · · Score: 4, Interesting

      Loews has a IT policy that allows any operating system but Microsoft windows (all versions) into their store. Windows is forbidden

      --
      ------- Oh damn.... the Sigfile escaped... -Great OM
  5. 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 Deraj+DeZine · · Score: 4, Informative

      I think too much is made of Qt when compared with Gtk/Glade (Glade being the XML format for describing Gtk interfaces, not just a GUI GUI tool).

      The Glade XML format is kind of strange (it looks like XML described in XML; a pointless scheme), but Glade simplifies GUI development to a point that I have yet to see anyone improve on, in terms of simplicity (I've worked with Tk, regular Gtk, wxWindows, and web-based applications).

      --
      True story.
    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 duffbeer703 · · Score: 3, Interesting

      The problem is the XUL has been basically undocumented until now and very closely linked with Mozilla.

      Mozilla rocks, but it took them until 2001 or so to produce a better browser than IE.

      --
      Conformity is the jailer of freedom and enemy of growth. -JFK
    4. Re:It's time to embrace XUL by jrumney · · Score: 3, Informative
      The Glade XML format is kind of strange (it looks like XML described in XML; a pointless scheme), but Glade simplifies GUI development to a point that I have yet to see anyone improve on

      Then surely XUL improves on Glade, by being not so strange. On the otherhand, XUL's reliance on Javascript might give the lead back to Glade/GTK.

    5. Re:It's time to embrace XUL by rjshields · · Score: 4, Informative

      XUL is not an API in the same way that Qt and GTK (I infer that these are examples of "others") are. Rather, it's a standard for describing UI with XML. So, if you have a requirement that you might need to port your application another platform at some point, XUL might not be a bad choice.

      --
      In this world nothing is certain but death, taxes and flawed car analogies.
    6. 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
  6. 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?

  7. The 5 Linux platforms by aaron240 · · Score: 5, Interesting

    Nat Friedman recently identified Linux as 5 platforms:
    1) Gnome
    2) KDE
    3) OpenOffice.org
    4) Mozilla
    5) Eclipse

    Considering that each of these are at least marginally successful as platforms, a coherent platform doesn't seem to be in the cards for Linux. Many of us think that's perfectly fine.

    My only concern is whether Mozilla is at least viable as a platform. Can developers assume their apps will run well for many users if they build in XUL?

    1. Re:The 5 Linux platforms by OmniVector · · Score: 3, Interesting
      Eclipse? a platform? i think more specifically you mean:
      1. GTK
      2. Qt
      3. OOo's in-house toolkit
      4. XUL
      5. SWT

      as i said in another post in this thread, these are ALL different things. Each accomplishes different goals. These all share one thing in common: GUI. However each one encompasses other things. SWT for example is limited to java. Java cannot be distributed in just about any distro, so this rules it out as a viable platform. GTK is highly portable, but it is however horrible when it comes to any platform but linux. It runs in windows, without a windows theme to match. it runs in os x, but only via x11. Gtk's in a pretty sad state considering how "portable" it's supposed to be. Qt's one of the better-off toolkits, but it suffers from gtk's problems too. It's only good on linux. half-assed os x port (at least it's not x11 dependent) and the windows port is totally unmaintained (yay 2.0!). Openoffice is unskinnable, ugly, and requires X11 in os x. That rules it out. That really just leaves us with XUL. To be honest, XUL's not half bad. I've seen mozilla. it looks fantastic on all 3 platforms. can you say the same for any of these other toolkits besides SWT (which is java only and has licensing issues)? nope. XUL is WAY under appreciated i think.
      --
      - tristan
    2. Re:The 5 Linux platforms by dominator · · Score: 3, Interesting

      "GTK is highly portable, but it is however horrible when it comes to any platform but linux. It runs in windows, without a windows theme to match. it runs in os x, but only via x11."

      BS. I guess that I didn't write the Gtk-wimp theme engine, then. And I guess I'm not running Gimp, Gaim, Xchat, Dia, Inscape, and Workrave on Win32 right now... The gtk-wimp screenshots are out of date, btw, but are good enough to get the general idea across.

      GTK 1.2 has also been ported to Apple's Carbon framework. I have plans to do something similar for GTK 2.x.

      "Qt's one of the better-off toolkits, but it suffers from gtk's problems too. It's only good on linux. half-assed os x port (at least it's not x11 dependent) and the windows port is totally unmaintained (yay 2.0!)."

      Huh? Trolltech gets a lot of money from licensing QT 3.3 on Win32. I've licensed it. It's maintained, and works great. The OSX port isn't as half-assed as you'd like to think. It's not FOSS on Win32, like it is on OSX and *NIX, but that's Trolltech's decision, not mine.

      You're right, XUL may be horribly under-appreciated. But realize that's largely Mozilla's own doing. They've been promising a standalone GRE for about 5 years now, and have yet to follow through. Much of the Mozilla platform is meant for eventual public consumption, but it's not ready for that today. When I can 'gcc -o myapp -lMozillaGRE -lMozillaJScript', come tell me.

  8. Sho me the MONEY! by mcrbids · · Score: 3, Interesting

    I've heard about Mozilla's "RAD" capabilities, and I've heard all about "how flexible" it all is...

    But - is there a single application that I'd consider using, written with Moz, other than Moz itself?

    Anybody? One? Just one?

    --
    I have no problem with your religion until you decide it's reason to deprive others of the truth.
    1. Re:Sho me the MONEY! by leoxx · · Score: 4, Informative

      How about the Activestate IDE, Komodo?

    2. Re:Sho me the MONEY! by Bill+Dimm · · Score: 5, Informative

      OK, you won't use it, but I did recently write a Mozilla application for MagPortal.com to allow our editors to work remotely. We are a Linux shop and our editors mostly use Windows, so it had to be cross-platform. Mozilla/XUL was used for the client application to provide a nice GUI interface (more sophisticated than what you could achieve with normal HTML -- uses widgets like <tree> and transfers data in a way that reduces latency for the user) that transfers XML back and forth across the Internet to the web server for storage. It works very nicely and is quite professional. I am somewhat surprised that you don't hear more noise about companies building custom applications like this with Mozilla.

      McFarlane's book was my primary reference for the project. It is a very useful book, but I do agree with the reviewer that the index needs some work. Additionally, make sure you keep an eye on the errata page. I was a bit disappointed that the book didn't talk about how to parse generic XML in your application (look at the parseFromString() member function of DOMParser).

    3. Re:Sho me the MONEY! by X-Nc · · Score: 3, Informative

      If you check out OEone's HomeBase Linux distro you'll see what can be done with Mozilla. Everything in it runs with Mozilla as the desktop interface. It's increadably slick and easy to use.

      --
      --
      If I actually could spell I'd have spelled it right in the first place.
    4. Re:Sho me the MONEY! by gavinjolly · · Score: 4, Interesting

      I believe he mentioned the need gor a richer interface.

      Do a google search for XUL and AMAZON and try out the XUL developed Amazon interface. You need a Mozilla based browser.

      After trying this interface then come back and comment.

      --

      The weathers here - Wish you were beautiful

  9. Quick Question by KillerLoop · · Score: 4, Interesting

    I'm always wondering where you put the actual logic in this kind of setup. You write your business logic as XPCOM components in ... what? C++? Java? Python? Javascript?

    I was given to understand that Mozilla as application platform should be platform independent. But what about the actual code apart from GUI and the necessary wiring?

  10. Sounds like a soon-to-be-added edition by elmegil · · Score: 5, Informative

    This sounds very much like it actually delivers what Creating Applications With Mozilla promised. After reading CAwM first 3 chapters, having them completely confuse all the various issues in my mind, a wrote this review. To give Boswell credit, he emailed me with some pointers to resources that helped get me over the hump, but that doesn't excuse O'Reilly's editorship from their usually excellent job of encouraging authors to make their work accessable as well as detailed.

    --
    7 November 2006: The day Americans realized corruption and incompetence weren't addressing 11 September 2001
  11. XUL? by Conspiracy_Of_Doves · · Score: 3, Funny

    Ok, who is going to be first with the Ghostbuster jokes?

    1. Re:XUL? by happyfrogcow · · Score: 3, Funny

      [evil_voice_over]
      There are no Ghostbuster jokes, only XUL
      [/evil_voice_over]

  12. Here's the unencrypted PDF and source code. by Bruce+Perens · · Score: 5, Informative
    Here's the unencrypted PDF in a .zip file.

    Here's the source RTF document in a zip file. That's Rich Text File, not the usual acronym :-)

    So, having established that it really is Open Source, I do encourage you to buy the book.

    Thanks

    Bruce

    1. Re:Here's the unencrypted PDF and source code. by dubious9 · · Score: 4, Informative

      I'm surprised you didn't plug the rest of the books in your series. I've look at a couple and they're really quite good.

      For those interested in those that have been released as .pdf's look here.

      --
      Why, o why must the sky fall when I've learned to fly?
  13. Mozilla + Trailblazer = drool by System.out.println() · · Score: 4, Interesting

    Maybe if someone could read this book and combine Mozilla with Trailblazer we would have the best browser ever.

    And don't suggest me. I'm far too lazy. ;-)

  14. Re:Forbidden!! by Bruce+Perens · · Score: 4, Informative
    Oops. He's moved his site recently. The front page is the Red Hat place-holder. The license qualifies as Open Source, commercial printing and resale allowed.

    Bruce

  15. 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.

  16. Re:Hiow about the (s)ftp lizard by timothyf · · Score: 3, Informative

    Sorry, but FileZilla runs as a native Win32 app. It doesn't have anything to do with Mozilla.

  17. I've recently read this... by cliveholloway · · Score: 3, Interesting

    ...and found it cluttered. It's like they took the tutorial pages and the appendix and decided to shuffle them together.

    The listings are only for parts of an application at a time, making it hard to visualize the whole project.

    It could really do with having stand alone examples for each chapter or, at the very least, have an associated web site with such content (the listings could, I guess, get a little out of hand).

    It may just be me, but seeing snippets out of context is not how I learn things.

    I think it would have been better if they started off by presenting the whole of the notetaker program, and then analysed each section to explain what it did, and leave the detailed descriptions of tags to appendices.

    In its defence though, there's so much to learn that it would be hard to make a good tutorial in one book along with the reference material - whatever the approach.

    I'm still waiting for a perfect book on Mozilla Application Development. Kudos to anyone who manages to write one though - there's so much to cover.

    cLive ;-)

    --
    -- Trinity in high heels carrying a whip: The donimatrix - there is no spoonerism
  18. Cross Platform kits and Native Interferaces by melatonin · · Score: 4, Interesting

    I think everyone agrees that most x-platform tookits have one glaring weakness - all the platforms share the same user interface. Mozilla supports skinning, which is nice, but it doesn't feel like a Windows application or a Mac application. It feels like an XUL application. NeXT had fantastic x-platform support with OpenStep; it's also how it (and Cocoa) acheive localization. That technique should be able to be used with other toolkits, even if they don't have 'native' support for that technique.

    Let's take a look at localization first. Typically, you generate a .strings file for each language. That kinda sucks because if you just did that, all localized versions would share the exact same window and control (widget) dimensions. The following is what Cocoa (OpenStep) does. Each application 'binary' is actually a directory with this kind of layout

    Foo.app/Contents/
    -/MacOS/
    --Foo (executable)
    -/Windows/
    --Foo.exe
    -/Sparc/
    --F oo
    -/Resources/
    --MainWindow.nib (interface file for the main window; controls and stuff)
    --ToolWindow.nib (interface for tool window; no french version)
    -/French/
    --MainWindow.nib (french version of the main window)
    --Localized.strings (localized strings for the entire app, excluding those translated in MainWindow.nib)

    Hopefully that's self-explanatory. Basically each platform gets its own version of an executable, and each language gets its own version of the interface (falling back to the basic definition in Resources/ if no version for a specific language is found). Well the next step is obvious. If you want to create a windows specific .nib, you create a MainWindow-windows.nib, which will only be used over MainWindow.nib on the Windows platform. Native controls are used on each platform, regardless if there's a platform-specific nib or not.

    It's a shame that Cocoa is no longer x-platform (although the support is still there, it's just that the runtime isn't available on other platforms). But this should be possible with other platforms too; you just need to encapsulate resource loading and load the appropriate resource for each platform and localization.


    --
    Moderators should have to take a reading comprehension test.
  19. Re:Hmm. by dolmen.fr · · Score: 3, Interesting

    Too many companies sell "intranet applications" for things such as timesheets, knowledge management... that are IE only because they try to imitate Windows application look. When you have one of theese, your are "IE-locked".

    Do you think it is any better?

    At least, the Mozilla platform is free and available on other OS than Win32.