My name is Juri Strumpflohner and this is my technical blog. I'm a software architect, .Net, Android, Web and Java dev, TDD and best practices promoter and martial arts practitioner.

Recent Posts Subscribe

Dear reader of Juri's TechBlog,
I moved my blog to a new domain and a new hosting solution as well. I'm now blogging on juristr.com.

Android Development Tools

Till recently, (IMHO) Android Developers had a very bad experience in designing graphical UIs for their Android apps. Personally I never relied on the graphical designer that was provided with the Android Eclipse plugin. It just didn't do it's job well. Then later, Google launched AppInventor, a simple way for (as they claim) even non-technical people to design their Android application. It basically allows you to create your app by composing together pieces of functionality in a very interactive, graphical way. This made me wonder a bit: why did Google invest into an online - say - graphical editor for Android apps when their Eclipse based editor used by the mainstream of "serious" Android developers really sucked?? But it was clear that it was just a matter of time till they would enhance that one as well.

Create DOM Tree out of a Dynamic HTML String

Just a very short post before I go to bed as I'm really tired today. I just played around with some JavaScript code, building a Google Chrome extension when I came to the point where I needed to process the DOM tree of a HTML string.

Basically I had something like the following:

...
   var dynamicHtmlString = "<pre>public class SomeClass{....}</pre>";
   ...
The dynamicHtmlString was build by my JavaScript code through a long-lasting process. At the end I wanted to format those (basically pieces of source code) in a proper way by associating the "prettyprint" css class to all "pre" elements and then calling google-code-prettify's prettyPrint() method.

Simply doing document.body.innerHTML=dynamicHtmlString; doesn't work obviously as I wanted to use jQuery for traversing the DOM and adding the CSS class. Luckly, jQuery does also support creating the DOM tree, by simply wrapping html code within $().
   var dynamicHtmlString = "<pre>public class SomeClass{....}</pre>";
   $(dynamicHtmlString).appendTo("body");

   $("pre").each(function(){
      $(this).attr("class", "prettyprint"); //check this for compatibility with v1.6 -> use .prop(...) otherwise
   });
   prettyPrint();
So that did the job. Pretty easy, isn't it :). This tells a lot about the power of jQuery. Love this library!

SmellyCode: A Classical Example of Non-Unittestable Code

I know there might be some degree of repetition in my posts when I speak about unit testing and mocking, but I always again come over similar problems in code I'm reviewing. Most often the core problem is that the responsibilities among different entities are not clearly separated which in turn makes testing complex or even impossible.
In the following, I demonstrate a classical example I recently found in our codebase. The requirement was that you should be able to validate an Account object, certify it's validity, and if everything is fine, send the user a confirmation mail. This is a small piece taken out of a larger requirement, but it is enough to understand the point.

Original, smelly code
Roughly, the code has been structured as follows:



Should Android Worry About the iOS 5 Update? Definitely Not!

With the announcement of the new iOS 5 at the WWDC, the first articles emerge already on the web relating the new features with the existing Android OS. Take for instance the article from ibtimes, entitled "iOS 5: Top Five Features That May Worry Android".

Do you think Android has to worry?? I don't really see any point:

Feature 1: Notification Center
The new iOS offers now the possibility to get notifications by swiping down from the top of any screen. Sounds familiar to you (Android user)? Well, probably yes, as this was build-in starting from the first version of Android. So I don't see a treat in this, but rather iOS now finally introduced a standardized way on how apps can communicate notifications to their users (in v5!).

Integrating Android and Google App Engine

Google App Engine is great for those of you in search of a complete, scalable and affordable hosting solution. Especially if you start a project and you don't yet know exactly how successful it'll be (which mostly you never know), how much potential users you'll have and so on, then App Engine is great.

Figure: Demo application architecture of Google IO session
It allows you to start with a free plan and then to scale your pricing as the number of users and CPU resources increases. The advantage: you don't have to setup (and pay) for a huge system to cover the maximum possible work load, but instead just pay the exact work load you need.