Category Archives: Design

Saturday Night App: NewsFlow

There can’t be a better way of spending your Saturday night other then crafting and knitting new apps for your mobile devices. This Saturday I was missing a nice news reader for my Nokia N900. I tried to follow the Forum Nokia workflow: Design, Develop, Distribute. Here’s what happened:

Design

Palette for news reader app

The first thing that I had to do was to get my app a decent color palette so that app would feel nice and consistent through out the views. I tend to use colourlovers.com to either create or browse good palettes. This time I decided to use nice blueish palette, The First Raindrop.

Now it was time to do the actual fun part and design the overall view of the apps user interface. As I tend to use Qt Web Runtime for development it’s pretty easy to do the UI drafts with simple static HTML page. These drafts can easily be extended to be used in the final app.

I really wanted to have horizontal panels this time around. Maybe to provide a book-like user interaction where you go to the next page to the right and back to the left. The following image shows the mockup of the UI.

User interface mockup for news reader app

As the mobile device display is quite small I thought that I’d show only one panel on one screen. If this would be created for a tablet like device then it could be wise to show e.g. all three or two panels at once on a display. I’ll have to test that when I get the first MeeGo tablet in my hands :)

Develop

Now that I had a draft UI HTML I started knitting the functionality with JavaScript to my new app which I would call NewsFlow. I used jQuery library to do all the heavy lifting like loading and parsing the RSS feeds.

As a small detail I used CSS animation for the panel switching so when user e.g. selects a feed from a feed list then view is switched to feed items page. With jQuery the CSS animations can be easily created with the animate method:

...
$(left).css("left", "0");
$(left).css("position", "fixed");
$(left).animate(
    // What CSS value(s) to animate
    {left:"-" + width + "px"},
    // Animation time in milliseconds
    1000,
    // Function to call when animation is finished
    function() {
		$(window).scrollTop();
		$(left).css("position", "relative");
	});
...

Then was the time to do the normal widget packaging and upload the app to the device. Here is what it turned out to be:

I have to say that I like it a lot as a simple news reader. This was again a good reminder on how fast the Qt WRT is to develop with. Now I just hope that Ovi Store would also start supporting Qt WRT apps soon so that the Distribute part would be easier.

What features you’d like to have in your news reader app?

From Anemic to Rich Domain Model

I’ve been researching this subject lately since I’ve had many good conversations about the two approaches with my fellow co-workers. The Fowler’s term, Anemic Domain Model, was new to me even though I’ve used the both Rich and Anemic Domain Models in the past without giving much attention to the differences between these two approaches.

What is the difference between the Rich and Anemic Domain Models? I think that Martin Fowler describes this quite well in his blog post, AnemicDomainModel in 2003. Frans Bouma have also made a great posts about the different approaches. And in this post he describes quite well the differences between Entity Approach (Anemic Domain Model) and Domain Approach (Rich Domain Model). Here is my version of describing the difference between these two with simple UML diagram:

Anemic and Rich Domain Models in UML

Basic idea in Rich Domain Model is that the behavior is included in the domain object compared to Anemic Domain Model where behavior is implemented in separate classes. This will reduce the lines-of-code in the application layer and it also makes the application code more maintainable since the use of domain objects is more logical.

Fowler wonders in his post why this anti-pattern, Anemic Domain Model, is still so common nowadays and one reason that comes to mind is that the existing applications, especially enterprise level applications, have used this approach as de facto through decades. This might also be the reason for even the Wikipedia’s article to mention that some argue that this wouldn’t be anti-pattern at all. It feels like this subject divides developers to two camps in the same manner like different development platforms or operating systems.

Also the fact that this anti-pattern is used widely in the literature doesn’t help to adapt to the Rich Domain Model approach. I found a good example of this as I read the excellent book Agile Java Development with Spring, Hibernate and Eclipse written by Anil Hemrajani. Hemrajani writes about the POJOs but still uses the Entity Approach throughout the book.

Rich Domain Model ain’t a silver bullet but first few encounters have been very positive and looking forward on applying it more and more in the future projects.Подаръци