Category Archives: Software Development

Posts about software development. Generally I use Java, PHP, and Python for development but occasionally I delve into other things as well.

The Chrome App Store Swinging the Pendulum WAY open

I’ve been very critical of Apple’s recent moves in deprecating java and excluding java-based applications from their new Mac App store. Their restrictive policies seem to be strong-arming developers into using their closed set of tools (and allowing apple to take 30% of all sales). So when I heard about Google’s new Chrome App store, I was naturally excited about the promise of a more open environment where apps are not shunned merely because they were built with a non-approved tool.

Unfortunately, it seems that they have gone a little too far in the opposite direction of Apple. The Chrome App store is meant to be a marketplace for web-based applications (i.e. anything that runs in a web browser). It allows users to install web applications so that they are added to their dashboard and can be easily accessed. Google provides tools for developers to handle purchases through the app store and keep track of user’s licenses. Unlike Apple’s closed model where only Cocoa-built apps need apply, the Chrome store invites all technologies that run in a web browser including HTML5, Flash, Silverlight, and Java (applets and webstart apps). I applaud Google for taking this step and for keeping the market open to such a wide array of technologies, but the current state of store is a little disorienting because they don’t seem to be very strict about the applications integrating into the app store frameworks. Many of the “applications” are just glorified web pages that can’t really be called an “app”. Others that could be classified as apps aren’t integrated at all with the app store other than the initial link – so that when you click on the icon, you are just taken to the app’s homepage that contains all kinds of advertising and gives an option to register for an account or login. When you’re clicking on an “app” icon to open an application, you expect to be taken directly into some sort of app interface…. you don’t expect to have to fill out a registration form or log in every time you visit.

My suggestion to Google would be to become a little more discerning about what kinds of apps get accepted into their store. They should start with a set of rules about one quarter the size of the Apple App store submission guidelines to ensure that the user experience is as close as possible to using a desktop application. If users have to sift through too much garbage, they’ll just give up and the app store will become a glorified set of bookmarks.

Posthumously discovering JavaFX

It turns out that JavaFX is actually kind of cool. Sun had been pushing it to no avail for over 2 years before Oracle finally pulled the plug (sort of .. they’re killing the language and porting it to Java), but they seemed to do a lousy job of making it seem relevant.

Now that it is dead, I have gone back over the docs for a final look and have discovered that it actually looks kind of cool. Being able to lay out 3d objects in a scene graph, apply transformations and animations to any branch; binding variables to one another to keep them in sync. It actually makes for a nice system.

The problem is that I’m having trouble forming a complete picture of where I can use my JavaFX apps. They say it’s for all the screens of your life, but with no iPhone, no Android, limited to no Mac support, I’m not sure what I’m left with. I’ve seen the odd reference to Blackberry support, but nothing definitive yet.

A shame, really.

Apple’s assault on Java is an Assault Java Developers

Yesterday, Apple announced that its next version of OS X, called “Lion”, will include an App store to simplify the process of downloading, purchasing, and updating applications on the Mac.

This is great news!

Apple will take a 30% cut of all transactions performed through the app store.

I’m mixed about this. If the App store is able to increase the sales of my apps by more than 30%, then it might be worth it. Otherwise, this is just a 30% tax off the top of all of my app income.

In a much less hyped announcement, Apple has deprecated Java as of version 1.6 update 3, and may not continue to bundle Java with future releases of OS X.

This is bad news… and it could be terrible news if Oracle or someone else doesn’t pick up the slack and provide a Mac deployment for the Java VM. Although, this could be somewhat good news if the “new” steward takes better care, as Java on the Mac does lag behind other platforms in both performance and stability. Oracle taking over Java could be a good thing if it results in a better product.

One final non-announcement came in the form of a guideline for admission to the Mac App store: Applications that use deprecated API’s (e.g. Java) will be rejected from the App store.

This is terrible news! A betrayal of the first order. It appears that Apple now feels confident enough with its market position to close the doors on all but their faithful Objective-C developers.

I currently have 3 desktop Mac applications on the market, and 2 of them are written almost entirely in Java. I chose, and still prefer, Java as a language because it provides a fast, robust, multi-threaded environment that is easy to scale, and even easier to port over to different platforms. It took me about 4 hours to port PDF OCR X over to Windows, and most of that time was spent on the non-java portions.

I was actually intending to blog about my experience with Java and multi-platform application development and was going to advocate Java as a good platform for development on the Desktop.

In light of yesterday’s announcements, I must take a pause to consider my future. Since Apple seems to be dictating its terms in a heavy-handed way, my instinct is to stick it to “the man” (Apple) and boycott its App store and its products altogether.

But then I lean back and glance around the room at my iPad, iPhone, Apple TV, Mac Mini, and 2 Mac books…. and I question my resolve as they do indeed make nice products.

I watched from afar when Apple shut out Flash from its iPhone. But this didn’t affect me as I didn’t develop for the iPhone. And, after all, Flash runs down the battery life too fast so there was a logical technical reason for its omission. When they brazenly placed a prohibition on all advertisements served by competitors to their iAd service, I shook my head – but it didn’t really affect me. And since the iPhone was a new device, the fact that it was closed wasn’t too much of a concern, because we only had non-existence to compare to its “closed existence”, and a closed existence surely is better than non-existence

But with the Mac we are moving from an era of openness, and stepping into one that would appear to be much more closed, so I get the distinct and unpleasant feeling of having my virtual civil rights stripped away. For now, we will probably be able to download and install applications the conventional way, but such applications will likely be treated as 2nd class citizens, branded with a star, and forced to live in some hard-to-find ghetto folder. Once Apple has achieved wide-spread acceptance amongst users that the App store is the only acceptable way to obtain software, perhaps they’ll close the technical loop hole that allows those second class apps from even breathing the same air as Apple’s preferred class of fully-taxed App store apps, and we’ll be left with a completely closed, yet beautiful utopia of an operating system housing only the master race of applications that descend from Apple’s own genetic components (i.e. Objective-C) and bear the 30%-tax stamp of Approval.

Mister Jobs, you have stepped too far. I was a true believer. I am now agnostic.

3g data plans in Canada. What they don’t want you to know.

I have an iPhone with a pretty good data plan through Rogers (6 gigs/mo for $30). No complaints. I generally use under 100 megs per month. I recently bought an iPad but didn’t want to spring for the 3G version because they are trying to make us spend an additional $35/mo for a separate data plan for that unit. My original hope was that I could tether from my iPhone to my iPad so that I could make use of my existing data plan. Well…. they thought of that and disabled tethering intentionally on the iPad. They want to squeeze that additional $35/mo out of us.

No worries, though. For now I’m happy to just use the iPad at home on WiFi.

A second scenario came up this past weekend. I was traveling in the states with friends and I need to have internet access at all times due to my online businesses so I looked into the options that Rogers has for me to be able to use my 3G in the US. For $30 you can get 10 megs!! That means that if I used 100 megs in 5 days (which is entirely likely) it would cost me $300 for 5 days. Get real!

My next idea was to see about getting a sim card from AT&T to use my iPhone on AT&T’s network while I was in the states. AT&T seems to be drinking the same cool-aid as Rogers, however because in order to get 3G with tethering support I needed to sign a 2 year contract at $60/mo with them. Not really worth it for 5 days.

So I walked into Best Buy to see if there were any other solutions available to me. There I discovered the flourishing pay-as-you-go market in the states (that is non-existent in Canada). I was able to buy a Virgin Mobile Hotspot for $150 that generates a WiFi network wherever I am that I can use to access the internet on all of my devices (my 3 friends and I were all able to work online while we travelled down the I5). All I had to do was buy a $20 access card for Virgin which gave me 300 megs of 3G data (more than we needed). And if I ran out I could have just paid another $20 for another 300 megs. If I’m ever traveling in the US now I can just throw $20 on my account and have full internet access wherever I go.

This was an awesome solution so I decided to see if we have anything comparable in Canada.

Lucky me! Rogers sells a MiFi device that is very similar to the Virgin one for only $249. The only thing is that they don’t have any form of pay-as-you go packages. Their cheapest package is $35/mo for 500 megs. Remember that I’m already getting 6 gigs on my iPhone for $30/mo. So for more around twice as much money, I can get less than 10% more usage (when I’m currently only using under 10% of my existing 6 gigs per month).

This is just greed. They offer no solution for me.

So I guess we’re out of luck in Canada. Guess again. A quick search on Google brings up an iPhone app called MyWi which will transform your iPhone in to a wifi hotspot. That way you can run your computer, your iPad, your iPhone, and whatever else you want off of your iPhone’s data package.

Of course Apple doesn’t want you to use this (so it’s not in the App store), and Rogers doesn’t want you to use this. They to milk you for everything you have. No thanks.

iPhone Web App Development: JQTouch vs Dashcode

I’ve been playing around with iPhone and iPad web app development for the past week or so (I’m working up to building a native app, as there are benefits to playing both sides of the field here). Given my familiarity with jQuery, I felt inclined to try out the jQTouch framework to start with. After some successes and failures, I then decided to take Apple’s Dashcode development environment for a spin. Here are my initial impressions:

My adventures began by modifying the demo jQTouch application to do what I wanted. I was impressed by the capabilities of this framework out of the box. It looks good on both the iPhone and the iPad – and feels just like a native app. The user can add the page to their “home screen” to load it up just like a native app also. My first stumbling block came when I faced the iPhone’s “no multi-tasking” limitation. If the user spent some time browsing to a particular place in my app, then left the app for any reason (e.g. to take a call or check their email), then they would be sent back to the start screen of the app and lose where they were altogether. I tried a number of workarounds the involved things like local storage, session storage, cookies, sessions and the like, but all were a little klunky. I realize that this problem will be fixed in iPhone 4 with the advent of multi-tasking, but many iPhone’s don’t qualify for this upgrade so it was important to me to at least be able to retain state.

Rather than hack jQTouch to pieces to try to implement this functionality (believe me, I tried), I decided to see what else was on the web app development landscape. That led me to Dashcode.

So I started the project more-or-less from scratch using Dashcode. I was impressed most by the Dashcode interface – how it allows you to drag and drop GUI widgets, or code snippets. It really is a model to follow if you want to develop an IDE. With Dashcode, you are almost completely insulated from the HTML markup. Instead you work with the visual WYSIWYG pallettes or with the javascript API to update the model. Rendering is done using MVC, and the performance of the resulting app is noticeably (on my older iPhone 3G) snappier than with jQTouch..

Unfortunately, I ended up hitting the same wall as with jQTouch: saving and restoring application state is a bit of a bitch. It involves more than just recording “where you are” in the app, because of the way the “back” buttons are set up, you have to recreate the entire environment, history and all. This is more than I really wanted to do right now.

So at this point I had 2 nearly complete, and almost identical apps. One using jQTouch. The other using Dashcode.

But now that I had climbed the learning curve in both of these frameworks, I knew I could do better. So I started, more-or-less, from scratch with a new project using jQTouch that will incorporate all that I had learned. I’ll be releasing the app in a few weeks.

Here is a brief comparison of these two ways of building iPhone/iPad apps:

  1. Dashcode produces an app that is a little snappier and a little more native (on the iPhone).
  2. jQTouch seemed to allow me more flexibility since I have direct control over the markup. In addition the development cycle seemed to be a bit faster using jQTouch. (However I’m sure you could improve the dev time on Dashcode if you used jQuery and other productivity libraries on the javascript side of things… I had been trying to use its API directly).
  3. Dashcode doesn’t seem to scale up to the iPad larger screen as easily as jQTouch. The extra flexibility in jQTouch with markup etc, makes me feel better equipped to customize the interface for the device.
  4. Dashcode is a fantastic IDE.

DRM/Apple to save the world from crap content

The internet has no shortage of pundits complaining loudly about the iPad’s extensive use of DRM (digital rights management). They say that the device is “crippled” by DRM and that it is a giant step backward for the software freedom movement. I’ll concede that it is a step back for the free software movement (a movement that seems to push for the abolition of any form of intellectual property), but I don’t think that DRM is necessarily a bad thing, especially in this case.

Over the past 20 years we have seen technology improve to the point where almost anything of intellectual value (e.g. software, literature, music, movies, schematics, business processes, etc..) can be copied and shared freely. In addition we are now at the point where it is easier than ever to produce creative works. If you’re a writer you can start a blog with the click of a button, or publish e-books on the ‘net for download. If you’re a movie maker, you can shoot, edit and publish movies all for virtually free using common software and video distribution services like YouTube. I.e. the barriers to entry into the world of creative productions became very low. These two trends complement each other to some extent since the increased demand created by the free distribution of content is met by an increased supply of content due to the lowered production costs.

So analyzing the trend with our broad economic brush we might conclude that everything is fine and that we have just reached a new equilibrium with an unprecedentedly high demand for creative content which is nicely met by the record levels of supply. Unfortunately our purely economic metric is incomplete. The axes on our familiar economic model are marked “Price” and “Quantity” only, and a shift both the demand and supply curves to the right (i.e. increased quantities at lower prices) should indicate greater wealth for all. But what of quality? How does the quality of the content fare in this new utopian equilibrium where content is both “free” to consume and “cheap” to produce? Now that we are a little over a decade into this experiment (that arguably began with the advent of broad-band internet) I believe we are in a good position to see a trend along the quality line – and it does not look good.

Over the past 10 years we have turned to the internet for more and more of our entertainment. At the beginning the quality of content paled in comparison to competitive content through conventional sources. You could stream or download audio to your computer but the quality still wasn’t as good as CD and it was time-consuming and inconvenient to go through the hassle of trying to find music that was decent quality – and then ultimately burn it onto CD in a 2X CD recorder (it would take 40 minutes to burn a CD). You could get some news off the ‘net from various news sites but it wasn’t in an easy to read format, nor was it comprehensive. Video seemed a life-time behind the conventional media formats (e.g. DVD, satellite TV or cable … or even VHS for that matter). You could download a smattering of books, but there wasn’t an easy means of copying it to a portable device for reading – so it was a far inferior experience to the real thing. What the internet provided wonderfully at this time of birth and exploration was access to a wealth of amateur content. People were able to, for the first time, try their hand at publishing and share their thoughts and art with the world. And the world could take it or leave it. This period of the internet was an exciting time and didn’t present a threat yet to quality. If you really wanted to watch a good movie, you still needed to look outside the internet for it. Similarly you had to seek the professionals for quality news and editorials.

This baby that we called the internet, grew like a weed, however, and in a mere 10 years has improved to the point where everyone can become a publisher, and aggregators like Google have solved the problem of comprehensiveness that limited the early internet. Everybody can contribute a tiny piece of the puzzle and old faithful Google will assemble the pieces into a shallow approximation of the complete picture. This approximation amounts to a cartoon-y picture of the real picture where only the primary colors are every present (no shades, skin-tones, or mixtures that we expect in the real world). The fact that technology is now able to paint these 4 color portraits of our world and culture is a remarkable achievement. We can look at these 2-dimensional, computer aggregated cartoons and quite easily imagine their real world equivalents (we see that the people have only 3 fingers, but that’s OK, we’ll settle for that – it’s close enough). The insidious problem with the ease with which these cartoon representations of reality are produced is that now there is little to no demand for the art of producing photo-realistic paintings (or any style other than 4 colour cartoons), because the “free” cartoon puzzles that are assembled by the internet aggregators are “good enough” to satisfy 99% of the demand. And without demand, the price to produce a real painting that accurately represents the world it is meaning to portray goes through the roof – and ultimately the craft disappears into history despite the fact that it is a far superior product to the free cartoons that it was replaced with.

This analogy of the cartoon puzzle describes the state of creative works with ever increasing accuracy as time goes on. We have been corralled into consuming mediocre content on a regular basis because it is so easily accessible.

So how does all this relate to DRM? A big reason why the cartoon puzzles have become much cheaper to produce than photo-realistic paintings is because the transaction cost of obtaining the painting is higher by “legal” means (i.e. purchasing the painting legitimately) than it is by “illegal” means (i.e. copying from a friend or downloading from torrent). So even if there remains a market for quality paintings after it is flooded with cartoon puzzles, there is a logistical barrier to the distribution of it. Purchasing the painting legitimately currently involves having to go into a store and purchase some physical media on which the painting resides (e.g. a DVD, news paper, magazine, book, etc…). This is far more difficult that simply turning on torrent and downloading it – for free!. If we make a digital version of the painting available for sale, then it will soon be copied to torrent for distribution. And having to fill in credit card information on a web site and all kinds of personal information just to buy a $5 painting is still far more of a hassle than simply downloading the product on torrent – for free!. Only when the transaction cost of obtaining the painting legitimately is *lower* than that of downloading it from torrent, will there be reason for a customer to buy the painting.

Enter the iPad, a device that is now infamous in “free software” movements as a “crippled, trojan horse of DRM”. It provides two powerful remedies for our assailed painters:

1. The extensive use of DRM makes it difficult to illegally distribute the content on torrent once downloaded (this will help to increase the transaction costs of obtaining the paintings illegally).
2. The seamless integration with iTunes’ payment system makes it completely painless to purchase the paintings legitimately. One click and it’s yours in a format that is ever so elegant and pleasurable to consume. This significantly decreases the transaction cost of obtaining paintings legally.

After only the first couple of months of the iPad being on the market, the signs that this strategy is working are quite evident. Already “painters” like Time magazine, marvel comics, the new york times and more have cast their lots and started delivering high quality paintings, the likes of which have not been seen yet in the digital world. The promise of a digital market for paintings is once again compelling artists to pick up their brushes, dip them in the ink of their personal creativity, and cover the canvas with innovative and truly unique paintings. As patrons return to the market place, and the rank of artists continue to swell in this new platform we may be in for a new renaissance and a return to a world where quality and originality is king. If not, then we may doom ourselves to a prolonged dark age of cartoon puzzle art. I’m optimistic that we’ll choose the former, despite ourselves.

iPad: Initial impressions

Just picked up an iPad today and am very impressed – not only by its potential for changing the world, but for its immediate utility. Here are just a few things that I notice after playing with it for 4 or 5 hours:

  1. When reading, scrolling down a page is quite hard on the eyes (you get kind of car sick doing that too much). I notice this particularly because of the extensive use of side “sweeping” in iPad applications. E.g. the Comic book apps allow you to read a comic one page at a time, and then just flip the page to see the next cells. This is very easy on the eyes. The Financial Times app also makes use of side scrolling to read its news paper – less scrolling down – more sweeping across. This makes for a much more pleasent reading experience. Look to see much more of this style in the future as more devices like the iPad hit the market.

  2. It looks like there’s nothing for sale yet in iBooks (probably a delay because we’re in Canada). However its extensive selection of free titles (generally classics that have passed their copyright expiration dates) makes for lots of choice still. I started to read “The Rise and Fall of the Confederate Government” by Jefferson Davis (the president of the Southern Confederacy during the American Civil War) this afternoon to complement the a book I’m currently reading about Abraham Lincoln and his cabinet. The iBooks experience is almost as good as reading a real book. It makes it very easy to flip pages, change font size, and skip to any part of the book. I appreciate it’s little status message ever present at the bottom right corner indicating how many pages are left in the current chapter.

  3. The Kindle App is also quite good, and currently provides a much larger selection of books to purchase. (iBooks appeared to have zero books available for sale). The only problem is that they make it damn hard to purchase any books. The Kindle app has a button to “Shop for books from the store”. But this just takes you to the amazon web site which is not optimized in any way for mobile devices or the iPad. After logging in, entering credit card info, and finally finishing the purchase, it downloaded a book on iPad software development into Kindle. They really need to build the purchase mechanism into the iPad to make it competitive with iBooks (which allows you to simply click on a book and purchase it on the spot – and be reading it in seconds).

  4. Comics! The iPad is a savior for the fledgling comic industry. Reading comics on this thing feels very natural. I downloaded both the Marvel Comics app and the Transformers Comics app, which allow you to read comics in a rich, full-screen, environment. They offer some free comics and have others for sale. I purchased one issue of Transformers for $1.99 and it was as simple as one click and I’m reading it.

  5. News papers are now multi-media. I downloaded the free Financial Times app which is a UK news paper. Reading it was much like reading a news paper, giving you the same ability to read the articles in columns and scan to the right to see other stories. They have embedded videos associated with some articles, and tapping on the video displays the high quality video right inside the window (as expected, but still really cool). I think we’re just hitting the tip of the iceberg in our exploration of how different media can be melded together to enhance the user experience.

  6. HTML5 Support – After reading about iPad’s rich support for HTML 5 it occurs to me that Apple is doing the world a favour by taking a hard stand against browser extensions like Flash and Java (sad to say). The market share of the iPhone OS (estimated at over 318 million units between iphone, ipod, and ipad) is so big that Apple is able to single-handedly force us to endure a little pain for the greater good in the long run. HTML has been moving at a snails pace since it’s introduction and this has been a sort of chicken-and-egg problem, whereby developers don’t use any cutting edge features because of lack of browser support, and the standard hasn’t progressed very fast because there hasn’t been the demand for cutting-edge features from the development side. Apple is changing that with the powerful HTML 5 support in Safari for iPhone and iPad. Finally HTML/CSS/Javascript is at the point where you can create a full desktop application using open web standards. In addition this model for networked applications is much cleaner and safer than previous strategies (such as Java and Flash applets) because they truly run inside a sandbox where they cannot harm your computer.

The Apple war against browser extensions (Flash and Java applets) reminds me in some ways of the American civil war and the related end to slavery. Just as slavery was entrenched into the culture of the south to the point where they could not willingly let the practice go without experiencing major economic hardships, we, as computer users, have become dependent on proprietary browser plugins like flash to make up for features that ought to have been built into the browser to begin with. Just as it took a bloody war (or some southerners might say a Northern dictator) to force the issue on slavery, it takes a dictator from the South to force us into the future of computing for our own good, when we lacked the will to make the leap on our own.

I’m very excited to start developing HTML 5 applications, now that there is a reliable and stable platform to target: the iPad!

Apple no longer updating its Downoads section

This article confirms my fears after noting that Apple hadn’t updated its downloads in over a month. The Apple Downloads section was my bread and butter for advertising new releases of my Mac software. Since apple discontinued its download section, my sales have taken a significant hit.

This section offered a compelling reason to develop Mac software. It provided an instant market place for my software and despite the mac market being smaller than the windows market, this connection point more than made up for this shortcoming. With its demise goes much of this advantage to the point where developing for Windows becomes much more attractive.

Mac, you’ve got a friend in Java. Now be nice.

I have recently rediscovered the joy of programming in Java for desktop Applications. Mac OS X provides a perfect deployment system for Java applications since Java 1.6 comes standard, so you don’t have to worry about directing your users to download Java for your applications to work. What’s more, since your application is written in Java it can easily be adapted (and perhaps unchanged) to run on Windows and Linux. So what is so great about Java:

  1. It is multi-threaded from the ground up.

Although threads can be used in many other programming languages, Java presents by far the cleanest and complete implementation I have ever come across. The language is built for threads at its very core with locking and monitor capability on any object.

  1. Namespaces and packaging

Between Java’s rich namespace support and it’s native packaging JAR format Java allows you to build applications component by component with minimal hassle when it comes to putting the components together. Unlike interpreted languages like Ruby, Python, and PHP, you are able to build your sky-scraper of an application without worrying about the size of it affective the speed of it. When you’ve completed a library, you can package it up an wrap it in a bow and feel confident that this component will serve you well for many projects to come.

  1. Garbage Collection

Most of the time, honestly, I don’t want to have to worry about mundane details like deleting objects that are no longer being used. Garbage collection does add a bit of overhead to an application, but it is well worth it 99% of the time.

  1. Swing

Say what you will about Swing, but it still stands up as one of the most powerful and portable GUI toolkits available on any platform. With only a few lines of code you can have yourself a full-fledged application with the look and feel of the native operating system, and have it run on Mac, Windows, and Linux without the need for any form of recompiling. It gives you the building blocks that you need to have a rich application, and allows you to extend quite far also.

There have been some troubling trends over the past few years as they pertain to Java. New dynamic languages like Python and Ruby have gained a lot of attention at the expense of Java. Windows has stopped shipping with Java and the IPhone and IPad don’t support Java and likely never will. My website stats indicate that only about 85% of Windows user have Java installed – this is definitely less than 10 years ago when virtually all Windows machines were equipped with Java. If you do a Google search for “Java OS X” or “Java for Mac Desktop Apps” you’ll find a plethora of articles circa 2002. There is scarcely anyone talking about using Java on the Desktop in the past 3 years. Has everything worth writing been written, or is this just the writing on the wall.

I hope this does not foreshadow and end to the glory days of Java as a development platform on OS X. It would be tragic if, one day, Apple decided to leave Java out of the default install. That would force users to install Java before running any software dependent upon Java – which would make Java a much less attractive platform to develop on.