NoteMe and Lessons Learned
As displayed in my AIR post before, I was working on my note taking application: NoteMe, but I’ve already been learning too much that stifled my development. Adobe AIR is a great framework, but I’ve also realized how little I know about web encryption/security. I don’t really understand about digital signing and certificates. Unfortunately, certificates cost, which isn’t something I prefer to dish out for a simple test app like this.
Before I get on with the learning experience, here’s the download (and source). As a warning, the source code is a bit disorganized since I was still learning AIR as I developed it.
It still has a relatively crappy interface as well. I hope to rewrite the application entirely, especially the note editor portion using canvas. Currently I’m using iframes, but AIR has a flawed iframe with no undo/redo support. I’m not sure why it was excluded, unless it wasn’t functionality part of webkit.
Furthermore, there is a bigger problem. I’ve come to the conclusion that jQuery isn’t quite the best for developing large javascript-based applications. It’s very nice and concise for the small amount of javascript here and there, but jQuery code isn’t particularly too clear. This seems more due to my fault for not getting in the habit of commenting my javascript files. In addition, jQuery doesn’t provide a clear guideline for developing large-scale javascript applications. The normal Object Oriented programming in javascript is flawed.
function dog(name){
this.name = name;
this.bark = function(){ alert("woof!"); };
}var snoopy = new dog("Snoopy");
snoopy.bark();
alert(snoopy.name);
This isn’t the most elegant solution when defining classes. The main problem is that methods you define may not always have this equating to the class. This is evident by some jQuery provided functions ($.each, bind, etc.) which alter this in the context of the function. I prefer to avoid this syntax when possible. It’s ugly to program in.
Of course there’s the static class way:
var dogs = {
repos: [],
add: function(dog){
dogs.repos.push(dog);
},
bark: function(){
for(var d in dogs){
d.bark();
}
}
};dogs.add(new dog("Snoopy"));
dogs.bark();
This still isn’t too pretty. Although it’s better than previously. The main problem is if you need to refactor the static class. All code that calls the static class needs to be renamed, including internal calls (see red, highlighted line).
MooTools, Prototype and other JS frameworks provide class behavior with static-class-style definition. Although this represents the class object (removing the need for internal refactoring like regular static classes.
As much as I love jQuery, I may have to look into other frameworks when developing a larger javascript powered application that doesn’t have a few ajax or visual effects. Or I’ll plow through my hatred of function-class definitions. Trying something that generates javascript entirely doesn’t seem like a bad idea either.
Adobe AIR
I've been spoiled by the relative ease of developing interfaces using Web Technologies (Javascript, HTML, CSS) over tradition methods (OS-native API, wxWidgets, GTK, etc.). This put me off writing most desktop GUI applications. That includes my, now abandoned, C++ Cairo-based GUI framework I attempted to make to simplify desktop GUI app development. For the framework, all my motivation was sucked up by C++ (since it's easier to port a C++ library other languages, not to mention Cairo & native APIs are in C) and the current results being where I wanted to avoid. Programming desktop apps aren't as fun as their web cousins.
The closest I've probably used to being enjoyable was .NET 3 / WPF, which allows you do develop GUI using XML, quite similar to HTML. But .NET's visual studio is pretty slow, no cross-platform support, and XAML extremely verbose.
I finally started re-investigating Adobe AIR. I've looked into it in the early betas, but I don't quite remember what drove me away. Quite frankly, I'm perplexed why, it's a breath of fresh air from the traditional GUI frameworks I've been mangling with. Instead of focusing on building something that just looks sane and functions correctly, I can iterate on what's seems most usable (although I'm probably far from great UI usability design).
A personal "tinkering" project. Only CSS/HTML so far.
For those that aren't aware of Adobe's AIR framework, it's just about a browser with desktop-permissions. AIR utilizes flash and webkit for its rendering. AIR applications do require the AIR runtime framework, but it's relatively fast to install over the .NET framework and even allows users to quickly install air applications through their web browser.
My only critique of AIR is that you really need to love ECMAScript/Javascript, since all your heavy lifting will be in that language. Using Flash/Flex won't let you escape Javascript. Actionscript is a dialect of javascript. But if you're a web developer, that shouldn't be too much of an issue.