So we’ve reached a small milestone this week.. I’ll start from the beginning.
Mozilla, which we’re using as the client side software platform, has a built in framework called XPCOM which allows developers to add software components to the overall application. For example, if you developed a fast XML processing application that you wanted to use from within Mozilla, you just have to write some XPCOM ‘glue’ code to plug the component into the Mozilla application proper. You will then be able to use your XML library from within javascript, which is used to develop Mozilla applications. Currently there is built in XPCOM support for javascript and c++, and there are efforts under way to bring other languages into the fold – Python and Perl to name a few.
Before Mozilla was even a consideration for client side development, we had developed some c++ communication components to run on the server end. So naturally, when Mozilla came along, we had the bright idea to try and re-use this code on the client side as an XPCOM component. This all went well until we made our first attempt to port the code to Windows. Not all of the open source code libraries we were using were developed with Windows in mind. We had some success, but it looked like the porting process was going to turn into a long term battle that would verge on resulting in two different code bases that didn’t behave exactly the same – when the whole point was to use just one.
So we shelved the client side c++ for a bit to see what we could do with Javascript. Javascript is very easy language to use, but because it’s a web programming language, it does not have a lot of the features the a regular ‘application’ programming language might have. For example, Javascript does not have a native sockets interface. (Sockets are used to communicate over the network.) This is because Javascript strives to be a secure web programming language, and allowing developers to write networking code from within a web page opens a pretty big security hole. There are numerous other examples of what most programming languages offer that Javascript does not. Well, this is where XPCOM comes back into play. The kind people at Mozilla (and their global team of supporters) have developed many XPCOM components for Mozilla that solve this problem of software security. For example, there is a socket component for Mozilla that allows us to write our own transport communication code in Javascript without having to develop an external library. There’s also file handling components, thread components, stream components, XPATH components – I could go on. In the end what we get is a rapid development Javascript environment with all the power of a ‘regular’ programming language. Note that Mozilla is not simply bypassing standard browser security by adding all of these features. Mozilla applications have to be installed on the local machine before they can be run with these enhancements.
So I set out to code the transport/message layer in javascript and it’s only taken about 3 days to have a functioning client side communication layer. Hence the milestone. We can now make actual requests of the server. Couple this with Mike’s storage app for acquiring data from the database and Jason’s interface components and we have the tools to move forward with the client side application development.
For more on using XPCOM in Mozilla, see http://www.xulplanet.com/
-bill