PureMVC for TypeScript

PureMVC for TypeScript

As you may already know, TypeScript is a new programming language announced on October 1st,2012. It is written at Microsoft by Anders Hejlsberg (designer of C#, Delphi, Turbo Pascal) with specifications published under an Apache License. Its goal is to output JavaScript from a superset of the language which allows compile-time type checking, classes, interfaces, modules and more while still understanding vanilla JavaScript.

In the week TypeScript was announced I contacted Cliff Hall to tell him I was ready to port TypeScript to PureMVC. He immediately told me that he was ok, probably because he's a well known supporter of «languages that compile-to-JavaScript».

I first tried to develop using Visual Studio 2012 and its dedicated TypeScript module which may had helped a lot to start with TypeScript, but I'm on Windows XP at home and VS 2012 simply doesn't run on it. As a resulting consequence, I made my work using Webstorm for JavaScript and the Node version of the TypeScript compiler (let me know if I missed something specific to Visual Studio 2012).

For the rest, I was lost at least one hour or two before starting the work because of lack of any existing documentation, but using stackoverflow.com and examples from the official TypeScript website, I quickly found all I needed to start with this new language.

Port to PureMVC

For the work on the framework itself, I decided to merge PureMVC ActionScript 3 Standard Framework and my own PureMVC JavaScript for Objs Standard Framework so it has typing from AS3 and required idioms from JavaScript.

As a result of this work I produced three PureMVC TypeScript repositories:

The PureMVC EmployeeAdmin demo can of course also be tested live.

Update: Cliff Hall made the official announce for it on the PureMVC website.

Continue reading

PureMVC Employee Admin demo for jQuery Mobile

PureMVC EmployeeAdmin Demo for jQuery Mobile

I started this project last year when jQuery Mobile was still in alpha stage. The first version of Employee Admin demo I made with alpha version of jQuery Mobile was interesting but not fully functional. I so have waited near a year to work on it again. Now that jQueryMobile is final and even passed version 1.0.1 few days ago it was worth it to try to finish the project completely. As recalled for my recent Employee Admin demo for jQuery (call it desktop so) that demo does not use a port of the PureMVC framework for jQuery Mobile. It is not necessary. The two are compatible but independent one from the other.

jQuery Mobile

For those who do not yet know much how jQuery Mobile works, it is loaded in addition to the jQuery framework on a mobile HTML page. The library, once loaded render the HTML page (with some minor jQuery Mobile specific additions) to make it identical to any native mobile application. The framework supports a maximum mobile platforms.

Multi-page template

All pages of a jQuery Mobile application must be hosted on a single HTML page. This is the so called jQuery Mobile multi-page template. Using address bar anchors, the framework is responsible to navigate between different pages of the application without changing the root HTML page hosting the application. For the demonstration I chose to only have two pages. One to manage the list of users, one to manage the form to enter data related to each user. In this demo, there is no dedicated page to manage user roles, it would have been ridiculous to make navigation so complex only to have a page hosting a panel when it can be made with a simple multiple select box.

Continue reading

PureMVC Employee Admin demo for jQuery

PureMVC EmployeeAdmin Demo for jQuery

More and more people ask me to finish the job I started in 2011 on the PureMVC Employee Admin demo for jQuery. So I recently took the time to finish it completely.

The project uses:

Before continuing note that using PureMVC Standard or PureMVC JS Native Port (Cliff spoke recently on Twitter ) instead of Objs would be really easy. It is only syntactic sugar. The libraries used, the architecture, implementation choices will be kept the same.

Also note that this project does not depend on any specific PureMVC for jQuery framework, here jQuery only provides the UI layer, PureMVC and UI layers always stands to be two distincts entities. I found this port illustrate this perfectly.

Continue reading

PureMVC native JavaScript port

PureMVC native JavaScript port

Now that I have implemented a Unit Tests Suite for PureMVC JavaScript ports I couldn't resist to create a native JavaScript PureMVC port. By "native" I mean that this port doesn't use any external library but PureMVC classes themselves. The port uses "org.puremvc.js.standard" as namespace because I think this is a good thing to refer to it as the JavaScript standard port.

When I started to work with PureMVC in JavaScript in 2008 I thought this was not possible to use PureMVC alone with JavaScript to develop maintainable projects. My main fears were class name collision and class declaration order. But time passed, I worked since on JavaScript projects with near 300 classes using only a micro-architecture (my Objs library) to maintain class namespaces for reflection on rare cases. All of this worked pretty well, I thought last week to create a PureMVC port to native JavaScript only.

But this is not only a personal challenge. Now that we have an agnostic Unit Test Suite and an agnostic PureMVC port, we can easily create applications using jQuery as User Interface (I mean avoiding any UI components compatibility with others libraries). And what I really wanted to create was a PureMVC EmployeeAdmin for jQueryMobile as few applications already exists for and I need to learn how to use it. I'm already working on it and I think to be able to release it for the next week-end.

Next step will be to create a PureMVC EmployeeAdmin Demo with this standard port using jQuery UI (the standard jQuery version, so not the mobile one). My hope is that it will help in creating future Employee Admin port to other frameworks.

Continue reading

PureMVC port to Prototype JavaScript Framework

PureMVC port to Prototype JavaScript Framework

As to give an answer to Cliff Hall asking: "JavaScript Port Branches to Support ExtJS, MooTools, Objs... What's Next?" on a PureMVC blog post, I announced on Twitter last week that I had in idea to port PureMVC to Prototype.js as soon as possible.

As you may know, I made the first PureMVC port to JavaScript using a micro-architecture of mine called Objs. The goal of this project was to show that PureMVC could be used in JavaScript and to demonstrate with the PureMVC EmployeeAdmin demo that it even works great. Even if some people have been a little pessimistic in that it uses a micro-architecture instead of a well known JavaScript framework, I like to think that my goal was achieved as Justin Wilaby created a PureMVC for Mootols (for which I made the PureMVC Employee Admin demo too) and more recently Tony DeFusco the PureMVC for ExtJS.

I said it on my blog or on the PureMVC forums, I'm a partisan of having a PureMVC port for each mainframe JavaScript framework. One of the reason is that, as each JavaScript developer knows, we don't always have choice of the framework we can use on the product we are working for. This is why I decided to port PureMVC to Prototype which was the next mainstream JavaScript framework in which we need to port PureMVC.

Another thing I want to do for months was to add an agnostic JavaScript Unit Test suite to PureMVC for JavaScript. This is why I have not taken the time to make a demo for the Prototype port but preferred to add an Unit Test Suite.

I will port PureMVC Employee Admin or BoxSplash demo in a later blog post I assume that this part will be valuable for PureMVC developers only, but for the moment I prefer to describe which Unit Test framework I used and how I implemented it to test PureMVC.

Continue reading

Android currency converter using PureMVC

Android currency converter using PureMVC

I'm working on an Android Froyo application in the goal of better learn Android development while developing a real Android application. It uses PureMVC for Java. I initially have planned to make it public here only when the application would have been pushed on the Android Market. But when I occasionally talk about this project here on my blog and on the PureMVC forums, some folks were really interested and ask me to give some help on how I achieved my PureMVC app development with Android. So today I decided to publish the application in its alpha stage even if it's still not ready.

The application is a currency converter that uses a webservice hosted on my website for several years that deliver currencies rate for 40 currencies with a daily update. Currencies rate are obtained from the European Central Bank. I recently have worked a on the webservice (PHP 5/ MySQL 5) to deliver currencies name in all existing languages supported by Android. I used a Java project based on the IBM International Components for Unicode project to fill the database with the I18N informations I needed.

The Android application itself uses threads, multiple activities, PreferenceActivity, SQLite local storage, Json and a call to a webservice and has unit tests associated to it. So this is what I think to be a good example to start with Android and PureMVC. I will commit its sources to the PureMVC website when it will be committed to the Android market as well.

Continue reading

PureMVC single core for Java

PureMVC single core for Java

As I proposed it recently on the PureMVC forums I took some time today to convert the multicore version of the PureMVC for Java port into a single core version.

I recently had to work with PureMVC Java for an Android application I work for the PureMVC community as an example of what we can do with PureMVC in an Android native Java application. I was surprised that the existing single core version didn't have onRegister/onRemove methods over Mediator and Proxy objects. Those methods were present in the multicore version of the port. The single core version was older and some other minor fixes have to be made, so I proposed Cliff to update the existing single core version with the multicore.

I took the best of both world each time possible in code and structure following the last PureMVC best practices for project editing.

I suppose that Cliff Hall will update the single core Java as soon as possible with this update, but for the moment here are the files :

PureMVC JavaScript Mootools EmployeeAdmin Demo

Mootools and PureMVC logos

As you may know I'm the author of the first PureMVC JavaScript port. I started it in 2008 using a little library of mine called Objs. I also provided a JavaScript EmployeeAdmin demo to test it.

Recently Justin Wilaby contribute to the PureMVC community by providing a new PureMVC port to JavaScript using Mootools. I expected a port to a better known JavaScript framework like Mootools since the first release of my port to JavaScript. My opinion is that we need a PureMVC port to each of the mainstream JavaScript frameworks. I'm still convinced that the more PureMVC code examples we will have for each of them, the more users will understand the gain in working with real architectures, even in JavaScript. That's why, on the announce of the PureMVC port to Mootools, I immediately engaged myself in porting the standard PureMVC EmployeeAdmin application from the Objs port to the Mootools one.

Continue reading

PureMVC EmployeeAdmin for Silverlight demo

PureMVC EmployeeAdmin for Silverlight demo

As I promised on the PureMVC forums, I ported the Flex PureMVC EmployeeAdmin demo to Silverlight using PureMVC Standard for C#.

When I'll get some sufficient code review and Cliff has time to, I'm pretty sure that he'll add it to the PureMVC C# port for Silverlight as a demo.

This was my first real Silverlight application. I learned a lot from this work. I now have a better understanding of Silverlight, its pros and cons. As you may know, I'm specialized in Flex/Flash development, so you'll probably be interested in my opinion regarding Silverlight compared to Flex.

Continue reading

Using PureMVC Loadup utility with Flash IDE

PureMVC Loadup for Flash demo screenshot

The Loadup library is a PureMVC utility intended to add support for Lazy Loading in PureMVC applications. It can also be used to load assets and report progress during loading.

I recently had to use the assetloader package of the PureMVC Loadup utility in a pure ActionScript project. When I finished to integrate it in my project, I realized that my application took an unwanted 120KB file size. After a little exploration, I found some direct references to mx.core.UIComponent or mx.controls.Image in the AssetOfTypeImage, AssetOfTypeSwf and AssetOfTypetext classes of the PureMVC Loadup utility.

As you may know, UIComponent is the base class for all Flex SDK components and is required when you compile a Flex project. As it requires a lot of dependencies and take something like 120KB, when file size is critical, a good choice is not to use the Flex SDK UI components in your project. Another side effect of using it is that it prevents to compile the project from the Flash IDE as Flash IDE currently can't compile most of the Flex SDK dependencies which is quite frustrating as PureMVC is intended to be fully Flash/Flex compatible.

When I reported this problem on the PureMVC forums some users asked for a solution, I promised to blog mine. So here it is.

Continue reading