Monday, October 26, 2009

My First Android Experience...meh.

My current interest is Android development. I've put all of my other projects on hold for this too! This isn't the first time I've done Java, in fact I have done a lot of Java before. The thing is though, that I don't remember the last time I had to use sooo much XML! Maybe never. JSON has been apart of my development life for years now, and it's always given me a feeling of resentment towards XML. It's too clunky and bulky, like a rusty old machine.

Maybe I'm just looking at it with the wrong set of eyes. As a web developer, XML means extra overhead, no built-in data types, large file sizes, extra parsing, and non-native support (in most cases). So beginning my first serious Android project, I'm hating XML before I get the chance to understand it's true potential. Truth be told, I'm starting to see how great it can be for certain instances.


Is it just me, or do Java developers love them some XML??? They may be the only ones keeping it alive; they're also keeping Java from getting buried, so they may be used to it. (jk)

I will say that it is very cool to be able to create an entire layout in one XML file! It's extremely versatile, and super flexible. One can change the Look & Feel without having to go into any code. Great! The major headache with this though, is the learning curve. For instance; the widgets, their attributes, layout types, and all of the different pieces used to put these applications together. Like; activities, intents, providers, services, and adapters. Mamma mia!!

Okay, these concepts are not completely foreign to me, having done Java before, but I guess it's been awhile. The structure and elegant design patterns have always intrigued me. In fact, I apply a lot of those patterns within my web applications. Though, sometimes enough is enough. Don't make it complex for the sake of being complex.

So far though, I do prefer iPhone development over Android. The tools that Apple gives you are insanely easy to use. I'm not a designer, so I don't want to spend all of my time on the UI, and using the interface builder, I can easily get most of the Look & Feel taken care of, so that I spend my time where it matters...coding!

Also, one can harness the power of C/Objective-C for their apps. Mmmmmm, speed. While going through Android tutorials, I was a bit discouraged when I saw articles titled, "How to optimize your Android loops", or "How to design for performance". Seriously?!?! I haven't even started yet, and I have to worry about that? I already optimize the hell out of anything that I make, but telling me off the bat that the application is going to need to be optimized is a bit sad. Oh well, it's Java, so what should I have expected?

I'll keep updating this as the project progresses. Perhaps my opinions will change!


PS - I'm aware that Android !== Java, so don't waste your time.

Wednesday, October 14, 2009

Threading in JavaScript with Web Workers

One of the things that I love about lower-level programming languages like C/C++, and even Java, are the fact that you can thread off new processes in the background. Since a lot of my work involves creating web applications, I work with JavaScript a lot. It really got to me that everything is single-threaded. I'm embarrassed to say that I haven't really read much on Web Workers until recently, but once I learn about something as great as this, I must make it my own! I scoured the web for examples and specs, until I had my fill. While the implementation is great for the web, and will bring about even better applications, I did not like the interface that it was presented in.

I always loved the simplicity of Java Threads, so I felt inclined to create a decorator for Web Workers that would give it a Java Thread interface. This will consist of a Thread object that  runs an object of type Runnable, in the background.

UPDATE: The cross-browser implementation is finished! Go ahead and knock yourselves out.

You can check out the work in progress here;

JSRun

The implementation seems simple enough to me, but I'm curious as to what others might think.