[Project_owners] Question: Mozilla Development

Todd Ross mozdev at brainsick.com
Thu Mar 24 17:43:14 EST 2005


Pete Collins wrote:
> I have some basic questions regards Mozilla development for Mozdev 
> developers.
> 
> When developing Moz code what editor do you use?

jEdit would be preferred, but I settle for Gedit (comes with GNOME). 
See the other thread from about a month ago where we all gave our 
opinions on editors.

> What platform do you use for primary development?

The development happens 100% on FreeBSD with testing on Windows 2000 as 
well.

> If you are writing some js code let's say this bit below:
> 
> var prefs = Components.classes["@mozilla.org/preferences-service;1"].
>                     getService(Components.interfaces.nsIPrefBranch);
> 
> How would you actually write this code?

I don't put any code that I'm unfamiliar with in my projects.  The first 
thing I'd do is look it up at XUL Planet and then do a search in LXR to 
see it in action.

> Copy and paste it from somewhere else?

If I've used it in some of my other code, I'll take it from there and 
adapt it to the new situation.  Otherwise, I usually take it from code 
in the LXR; I license my code using the same tri-license.

> Do you type it manually from memory?

Never.

> How do you obtain the contractID or interface to use to instantiate a 
> component?
> 
> eg: "@mozilla.org/preferences-service;1",  "nsIPrefBranch"

Try to find the interface on XUL Planet.  Once identified, check the 
main tutorial if available and then XLR.

> How about if you were writing a new XUL file from scratch, how would you 
> do it?

I copy it from another XUL file in my project.  The first one was 
probably copied out of a book or tutorial.

> Let's say you wanted to add the code below, how would you do it?
> 
>   <toolbarbutton type="menu">
>     <menupopup>
>       <menu>
>         <menupopup>
>           <menuitem />
>         </menupopup>
>       </menu>
>     </menupopup>
>   </toolbarbutton>

Hey, look!  It's already written.  Copy/paste.

> Same with css, let's say you wanted to add some style rules to an element:
> 
> #foo
> {
>   -moz-image-region: rect(0, 388px, 20px, 292px);
> }

Most of CSS is from memory.  I've never tried looking up -moz specific 
preferences, but if I ever needed to, I'd imagine it would be back to 
XUL Planet for me.

> Is the rule "-moz-image-region" committed to memory or a search and 
> paste action?

The CSS that isn't by memory comes from the W3C specs.

> I'm very curious to see how everyone does things. How the act of 
> actually writing the code works for different people.

I'm curious about your ultimate motives in asking these questions.  What 
are you cooking up?

If you're just looking for feedback on Mozilla development, I believe 
that the biggest shortcoming is documentation.

I've bought all of the development-specific books that I could find:

Rapid Application Development with Mozilla
Creating Applications with Mozilla

Both USELESS.  JavaScript: The Definitive Guide is useful for the Core. 
  XUL Planet is alright, but I don't think it goes far enough.

WE NEED BETTER DOCUMENTATION.

This list is the best (only) list that I'm on to discuss tips and 
techniques with other developers.  It's tough to get help on the 
newsgroups and irc.  This is the only MozDev service that I actually 
take advantage of.

Todd


More information about the Project_owners mailing list