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.