Keetology

Bring in the Alloys: What’s New in PR2

It’s not a long time ago since I wrote about Appcelerator Titanium, about a month ago if you’re counting. So what’s changed? Nothing much really:

  • PR1 is still available on the official website.
  • The community is still small, but it’s slowly growing as more people become interested in Titanium’s future.
  • I’ve pledged myself as a Titanium Preacher to help spreading the Word of Titanium.
  • I’ve become a regular fixture in the Titanium IRC channel—usually just bugging people out.. hehe.

Well, that’s what changed really. Oh, except for one other thing: the next preview release, Titanium PR2, is coming very, very soon. And believe me: it’s one hell of a release.

So here’s a little sneak peek of what to expect in the next release of Titanium.

Like in my previous post, I’d like to thank the guys from Appcelerator, especially Jeff Haynie and Marshall Culpepper for their help. Also, please note that Titanium PR2 is still in the works and is still far from finalized. The things I wrote here may change within the course of a few days and new things might pop up. Stay tuned to this page for any updates. For the lazy, I’d added a Quick Giddyficator (again!) to get an overview of the post.

Finally, please note that all views expressed here (particularly those that involve Adobe Air), is strictly my own and does not express the views of the guys from Appcelerator or the Titanium Team. I’m not a member of the development team, but I am one of their preachers. In other words, I’m just here for the swag!.. LOL!

Hail the Mighty Krull!.. No, Kroll!

Titanium PR2 might look similar in functionality as PR1, but it’s a different beast. After the launch of the platform, the guys at Appcelerator didn’t waste any time and started working hard for the next release, which was meant to be a complete rewrite of the platform.

The real star of this rewrite is the new core of the platform, lovingly named Kroll—which is the pyrometallurgical industrial process used to produce titanium. Kroll is the microkernel that powers Titanium (and probably a few other project in the future) and gives the framework the ability to run plugins and modules. As Jeff Haynie, CEO of Appcelerator, explains in the README for Kroll:

Kroll is a compact microkernel written in C++ for running pluggable modules. Kroll supports a cross-language, cross-platform “binding” and invocation framework which supports mixing and matching code within the Kroll kernel.

There are three main parts that compose Kroll: KBoot, KInstall and KKernel:

  1. The “bootloader,” KBoot, starts the microkernel and resolves the paths to the necessary files by parsing the application manifest that is included in each Titanium app.
  2. KBoot then runs KInstall, which checks for bundled runtimes within the app. Unlike Adobe Air, Titanium gives you the choice of bundling a specific version of the runtime into your apps, making sure that your application still runs even if the user doesn’t have that version of the runtime. When Kroll reads the application manifest, it checks whether the version of the runtime required by the application already exists within the user’s system. If it’s not installed, KInstall automatically takes the bundled runtime and installs it to the user’s system.
  3. Finally, when everything is ready, KBoot launches KKernel, which then calls the system-specific implementation that handles the loading of the different modules. When this is done, all control is passed over to the modules and the Titanium application is finally ready to run.

Just like a regular microkernel, Kroll implements the low-level stuff needed to bind languages into Titanium. The nitty-gritty stuff you normally have to do for each system is already handled by Kroll, which makes it easier to implement modules that extend the framework.

(A side note, though, here’s an idea for a possible mascot for Kroll.)

In the Mood for Modules..

If you’ve read my previous post on Titanium, you’ll probably remember me mentioning that much of the functionality of Titanium is from it’s use of a modified version of Google Gears. Titanium wrapped Gears and exposed most of its functions using the ti namespace available in Javascript. There were also a couple of functions added to the API that were not part of Gears, like the notification system and native window management.

For PR2, Gears has been totally removed, and bulk of the work will be handled by Kroll modules. These modules add the functionality needed for developing desktop applications and exposes them to the framework via Javascript (or any other language, as we’ll see later on).

There are two kinds of Kroll modules for Titanium PR2. The first one are the Core Modules, which handle the essential functions like window management, menu creation and file-system handling. These modules are included in the runtime by default, and will be accessible via the Titanium namespace.

The other kind of modules will be the Extension Modules, which will further extend the framework by exposing new functions, methods and even full blown language support. It’s with these Extension Modules that Titanium PR2 really gets exciting. Using the streamlined API, developers will be able to add more functionality to Titanium by binding other languages to the framework. This dynamic binding will allow Titanium developers to not only to create bridges between Javascript and another language, but will also allow the use of languages other than Javascript directly in the application’s code: like <script type="text/ruby"> or <script type="text/python">.

There are already modules for Javascript, C/C++, Ruby and Python right now, all of which will be bundled into the runtime as default extensions, and more languages are soon to be implemented, like PHP, Java, Objective-J and C#. I’m also in the process of writing a module for Lua.

In other words, Titanium’s next iteration will greatly surpass Adobe Air by fulfilling its promise of giving us developers the power to extend the platform in any way we want, opening new avenues to creating richer and more powerful desktop applications.

Pfft. That’s For Geeks!

But you don’t need to be a master of module-fu to be able to take part in Titanium’s awesomeness—because even if you’ll stick with the default modules bundled with the runtime, you’ll still be able to create powerful applications.

There are lots of nifty stuff coming in PR2, and there’s a new SDK that not only upgrades the functions and fixes the bugs from PR1 but also adds new commands like the ability to chose between bundling the runtime and modules or relying on the runtimes installed on the user’s system. And while Titanium PR2’s API will be the same with PR1 for the most part, retaining the features and functions like native window management, native menus and local database access, the new API is now accessible via the namespace Titanium (replacing the old ti namespace) and there are new features as well:

  • Configurable Runtime and Module Bundling. PR2 will now allow developers to chose whether or not to bundle the runtime with their application, as well as any modules you might need.
  • Launch Other Applications. Titanium PR2 will implement one of the most requested features in Adobe Air: the ability to launch other applications and the default applications for different file types.
  • Native Socket API. PR2 now gives you the ability to use native sockets that enables you to implement support for custom server protocols like POP3 or Jabber in your applications. (I’ll admit that this is one of the things I’ve been waiting for).
  • Improved Notification API Titanium PR2 will add support to the popular notification systems: Growl for OS X, Snarl for Windows and libnotify for Linux. Any calls to Titanium.Notification will use these notification systems if they’re available, or fallback to the regular notification system included in PR1.
  • Ability to Install Apps from the Browser Even though “web browsers are sooo 2008,” they’re still a big part of everyday life, that’s why Titanium PR2 will add the functionality to install an application from a web browser. And unlike Adobe Air, you won’t need to work with complex “badges” and stuff—just put a link to your app using a special URI on your website and Titanium will automatically handle the installation for you. Talk about easy!

Of course, a lot of other stuff would probably crop up in the following weeks, so I advise you to stay tuned…

The Giddyfier

So what’s to be excited about PR2? Because you’re lazy, here’s a recap:

  1. There’s a new microkernel, Kroll, that powers Titanium and enables the platform to be extended in ways Air could only imagine.
  2. Functionality of the platform is now handled by Kroll Modules which not only expose basic system features, but also allow developers to create bridges between Javascript and other languages, and also gives developers the ability to use the language of their choice within HTML documents (e.g. <script type="text/python">).
  3. A new and improved Titanium SDK.
  4. Developers will now have the power to decide whether or not to include the runtime and needed modules via Configurable Bundling.
  5. Tons of improvements on the Titanium API, including new features like launching other applications and the new Native Socket and Notification APIs.
  6. An easier way to distribute your applications by allowing users to install apps from the browser.

If that doesn’t make you giddy, nothing will.

What Are You Still Doing Here?

The release of Titanium PR2 will certainly be a milestone, not only for the awesome team from Appcelerator, but for the whole community as well. The future of the PBW is certainly getting clearer, and Titanium is in the forefront. It’s nice to know that PR2 is coming very, very soon.

Now, I suggest you scram from here and get started learning more about Titanium! The first Preview Release is still available at the official Titanium site, and you can still join in on the discussions at the official forum and irc channel or follow the official Titanium twitter account. The source code for Kroll and Titanium PR2 is available on Github.

And most of all I suggest you subscribe to this site’s RSS feed or follow me on Twitter. After all, I’m a Titanium Preacher—would I lead you astray?.. :D

Reactions

post your reaction

Post a Reaction