Insights and outlooks on software development

S'true

On Flickr and JSON vs JSONP

Friday, September 16, 2011 by Thomas L

I've been playing somewhat with the Flickr API lately since I've been preparing a workshop in introductory jQuery, and the Flickr API is a great example in doing GETs for JSON content. However, the Flickr API returns JSONP instead of JSON by default. A typical response:

jsonFlickrApi({
  "photos": {
    "page": 1,
    "pages": 1033,
    "perpage": 100,
    "total": "103268",
    "photo": [{...}]
  }
})

In order not to confuse my students, I wanted to start using pure JSON, i.e. letting the response be

{
  "photos": {
    "page": 1,
    "pages": 1033,
    "perpage": 100,
    "total": "103268",
    "photo": [{...}]
  }
}

I couldn't find this in the Flickr API docs, which are rather good, but later I found out that you can append &nojsoncallback=1 to the request URL to accomplish the latter response.

On design vs. style

Friday, September 2, 2011 by Thomas L

So, recently I was listening to the Style episode of This Developer's Life, talking about the importance of design. In the beginning, the interviewer talks to a designer working at Microsoft, and it hit me that they, without mentioning it, are talking about the single reason why Apple has fared so well in the marketplace.

Design is not just what it looks like and feels like. Design is how it works.
- Steve Jobs

Compare the quote from Steve Jobs above to the Microsoft designer talking about colors in the code surface.

Design isn't visuals, it's the entire user experience. If you're only doing a fair job thinking about how the user will actually use your feature, there's no way the user is going to think your product is good even though you put a lot of thought into the color scheme.

On a Code Kata in Malmö

Thursday, May 12, 2011 by Thomas L

Me and Joakim Karlsson are arranging a Code Kata in Malmö. The purpose is to be in "training" mode in order to build knowledge, instead of trying out stuff on a real project. This way we can experiment and reflect on our modelling and designing skills more thoroughly than when we are in a real production code setting.

If you're interested, go to our meetup event page (in Swedish) and sign up!

On Spring MVC running on AppEngine

Wednesday, May 11, 2011 by Thomas L

I've just published a (modified) version of the Google AppEngine Java tutorial which runs using Spring and Spring MVC. Since it was rather tedious to get everything running as it should, I thought it could be spread to the world.

Go check it out at github! Pull requests are welcome.

On my Scandinavian Developer Conference presentation

Monday, April 4, 2011 by Thomas L

This is the presentation I held on April 4, 2011 at the Scandinavian Developer Conference 2011 in Gothenburg.

On ScanDevConf 2011

Wednesday, March 30, 2011 by Thomas L

I haven't remembered to note this on this blog (but I hope you've seen it on my Twitter feed), but I'll do a session on Scandinavian Developer Conference, which takes place in Gothenburg April 4-5. My session is called "Railsify your web development". In that session I'll try to explain how to become (almost) as effective in your legacy web app development as when you're doing Ruby on Rails development, by using some of the practices Rails developers use.

I'll make sure I post the presentation from that conference here.

If you read this blog, don't hesitate to come talk to me!

On upgrading Rails from 2.3.5 to Rails 3 (via 2.3.8)

Friday, January 21, 2011 by Thomas L

I run a rather small and basic, but functional, web site for me and some friends on Rails. The site has been running on Rails 2.3.5 for a rather lengthy period, but a couple of weeks ago I decided to enter the new era of Rails 3. This is what I had to do in order to get things working.

While still remaining on Rails 2.3.5, I changed the project to use Bundler and made sure all of my tests ran well, and added a few extra ones.

I then upgraded to Rails 2.3.8. The upgrade was rather smooth, I didn't get any incompatibilities there, so I made sure everything worked, and then jumped on to the real upgrade, to Rails 3.

In Rails 3, I had trouble with the will_paginate gem (solved by upgrading the gem to version 3.0.pre2). I also had problems with Authlogic saying: "undefined method `to_key' for #". I solved this by using the form_for helper change mentioned here.

Since there are quite a few changes between Rails 2.3 and Rails 3, e.g. the new application.rb, I got help from the plugin rails-upgrade (instructions).

In controllers, old root redirects didn't work, i.e.

redirect_to root_url

To solve this, I had to define a named route in routes.rb like so:

match '/' => 'posts#index', :as => :root

Then I can use redirect_to like so:

redirect_to :root

Rails 3 has removed the markdown view helper method, so I had to use the formatize gem to get this working.

From Rails 3 onwards, all of the stuff output in the views are html escaped. Make sure that you stop escaping the user-generated things, and, more importantly, un-escaping the outputs in the views that should contain regular HTML.

Happy upgrade!