Considering using MongoDB instead of a SQL DB in your next CodeIgniter project? Well, we were and decided to take a stab at it, and fairly soon discovered that it is pretty straightforward. Even more so, if you don’t try to use CI Active Record, but use native PHP Mongo interface to store and query your data. That suits our case, as we are planning to access the data mostly from Javascript UI over Ajax — in which case it is quite simple to just get the document from Mongo as an array and then serialize it to the UI using PHP JSON functions. Initially I was looking for a way to return JSON objects directly from Mongo (like over the built-in REST interface) to gain some speed, but probably it is not worth the hassle. It is so much easier to take care of authentication, access control, session management and such on the PHP side, because they have to be built into the application anyway; conversion from BSON to PHP array to JSON is not that heavy that it would affect performance too much.

However, even if I can live without the CodeIgniter Active Record, I didn’t want to give up the good stuff in the CI_Session class and do session management using native PHP sessions. I took a look at CI Session.php and found a way to extend it so that the existing code can be (mostly) reused. The implementation would be nicer if the CI_Session class was actually designed for extension with DB functions extracted so that they could be easily overridden to use a different kind of storage. My approach relies on the internal implementation of the session manipulation functions and can easily break when CI version changes. The implementation is based on 1.7.2 and tested only on that; if you want to use it on a different CI version, be prepared to read the Session.php of that version and tweak the Mongo session implementation accordingly.

You can download my implementation here; the package contains a README for installation instructions. The sessions will be persisted to MongoDB instead of SQL — otherwise they behave exactly as before.


I have been discussing about Scala (and other new programming languages and paradigms) every now and then with colleagues and last night Petteri tweeted my thoughts distilled as “The Scala language doesn’t have an obvious sweet spot.” That is what I really believe, but I think I owe some elaboration beyond 140 chars 🙂

We were discussing whether Scala might replace Java, and my opinion was that no, in the web domain Java has already been replaced by PHP, Python/Django and RoR, and in the enterprise Java (EE) likely cannot be replaced that easily as the big players there (the Oracles, IBMs and such) don’t want to rock their comfortable boat of elaborate, massive and profitable product lines. I sincerely believe that the brightest future of Java is in the enterprise.

What about Scala? I have noticed that Scala as a language immediately appeals to many experienced programmers and it is easy to see the benefits of the language – many, including me, are itching to get their hands dirty with Scala in a real life project. So what gives? Petteri said that he has been wanting to try out Scala in a real project for at least three years now, still all of them have ended up using something else. I can say myself that as much as I like Scala, I don’t hesitate at all starting a new web project with PHP or Django despite my relatively short experience with those, but I wouldn’t dare to suggest a Scala/Lift project to a client despite my relatively long experience in Java.

There are many reasons behind the fact that Scala in its current form is not ideal for a mainstream web project, but I don’t think those are the real issues. I think that the web domain is doing quite well with the current tools and should concentrate making the most of them rather than taking yet another new language into use. Same goes for enterprise: Java has found its sweet spot there, and although enterprise Java coding might not be the sweetest job in the world, that’s the way things are done there relatively predictably and repeatably.

I think the real issue is that we don’t know yet what the ideal domain for Scala might be. Maybe it does not exist at all yet, maybe we haven’t really identified it yet, or maybe it just won’t be any mainstream stuff (which I think would be quite sad). Some possible domains we identified:

  • Mobile apps: You can code Android with Scala and I think event-based UI coding would even be quite nice with Scala, but it is too heavyweight a tool for that so far. On the other hand, there might be some use for a new apps programming environment: Android Java is quite OK but not awesome, Apple, well, only they can pull off objective-C, Qt has yet to prove itself and Symbian is dead already.
  • Protocol programming: quite a good application for Scala, but a niche that never was big and is getting even smaller these days
  • Gaming platforms: need backend performance, lot of scalable logic, real-timeness and optimized protocols compared to “normal” web apps. Not quite large scale mainstream, though, although a very interesting area
  • Large scale distributed computing: A long-time promise, but is it going to be something more than the various x@Home projects?
  • AI / robotics: This area will develop quite fast in the coming decades and will need a lot of new stuff on the software side as well. Maybe this could be Scala’s chance?

In any case, I invite you to prove me wrong! Please tell me that there is a big gaping void waiting for Scala to fill it and I’m just too blind to see it. Where do you see the future of Scala lies? If anywhere?

I and my colleague have been doing some scouting and research on social shopping related areas lately and I wanted to share some of our thoughts and observations. By “social shopping” here I mean a rather wide variety of different types of services centered around shopping and sharing the experience. We identified at least three subcategories:

  • Sharing the purchases: In this product centric category the users share their recent purchases with friends online, “like” each others’ purchases etc.; in other words sharing shopping experience using the traditional social media means. Examples range from relatively simple Kaboodle to Swipely, who have an exciting (bordering on mild uneasiness) idea of reading your credit card “swipes” and sharing a selection of those with friends.
  • Check-in: These here-and-now focused services allow users to share and get rewarded of their presence in a certain place. While check-ins are not strictly “shopping” as such, most of the services extend the basic concept with some commercial aspect, such as advertising or special offers. Foursquare is of course the prime example, but there are many others: PlacePop provides virtual loyalty cards, while Shopkick goes as far as installing special boxes in stores which detect your mobile phone app to get very accurate check-ins (effectively luring people into and around the store creating “foot traffic”). Then of course Facebook is now entering this space with Places; we’ll see how that turns out.
  • Daily deals: Simple, yet hugely popular way to get special offers from your home town businesses. Although at its simplest the concept is little more than daily advertisement in your local newspaper, the success of Groupon and the following it has gained through countless copy-cats (including Twitter @earlybird) is remarkable and definitely means something. Maybe that we don’t read papers that much anymore but rather, even willingly, receive our daily dose of advertising online?

This area is definitely a hot one with lot of innovation and media coverage going on and both fresh startups as well as initiatives from established players popping up all the time. However, there is one thing that is slightly nagging me and I cannot shake it off easily: what is the long-term value for the users that keeps them committed to these services? For sharing your purchases, well it’s nice if you are an active social media user in the first place, but is it enough alone? It also covers only a small portion of the purchases you make, because there really isn’t anything interesting in sharing the mundane shopping you (or at least I) mostly do. As for check-ins, it may be quite exciting in the beginning, but what do you do after you have earned enough of those Foursquare badges? After the initial enthusiasm wears off, there better be some good rewards to keep those users bothering to check in. Daily deal services do provide clear value: good deals. However, if it is only about deals the user experience might become a little thin and also the likelihood to get a relevant, interesting deal is probably not that high after all.

To be honest, virtually all services in this area do try to address the above problem by beefing up their value proposition by combining the different aspects discussed above to create a unique mix for their users. As an example, the check-in services usually bundle in some form of deals and the daily deal services try to make most out of the social networks. But doesn’t this mixin’ and matchin’ somewhat blur the key ideas of the services? I got this impression when studying the area and so many different types of companies and services came up – all of them approaching more or less similar goals from different angles using different tools and emphasizing different things in the end user experience.

My question is: Has anybody really nailed it yet?

Went to see the Summer of Startups Demo Day pitches and demos because I happened to be around, and I’m really glad I did. Some impressions from the event:

First of all, the winners: Arada (best pitch), Pamoja (best progress) and Living Canvas (best demo): Congrats! The teams with a true cause collected the prizes, and rightly so in my opinion. Launching a startup and becoming an entrepreneur is one thing, but doing that while making the world a better place through your company is entirely another – very respectable and something not all of us have the privilege or guts to do in our careers. However, this is not to say that your noble causes would have somehow given you any excuses on the entrepreneurial side of things, on the contrary. You all also had clear business cases and commercial feasibility – the next thing on your agenda is execution. Very good position to be in.

Some notes and thoughts about some of the other teams in random order:

MiDA – I like your idea! Having some dietary restrictions in my family I can see the value from that point of view, and it is really good. I can imagine myself shopping and e.g. checking if some product contains anything originating from domestic grains (wheat, rye, oat, barley). That would be really handy  as deciphering that information from the ingredients listing is not a trivial thing at all. Just make sure that the user experience of your app is superb and you’re good.

Dealmachine – you create something new on the enterprise side by using game mechanics. I just want to remind not to bet everything on that; I for one think that we have yet to see how far the gaming experience really carries. It is a very good way to create initial interest and commitment in the users, but I would still think it as a means to bring in the users so that they can see the true value of your service. However, I don’t think that will be a major problem for you, as the sales guys should see the value quite quickly in how they are doing with their quota.

eXperQ – I was quite interested in your offering as lately I have been doing some scouting in the customer relationships area myself. You have a clear and focused service, which is good. I think you should put some effort in making your service so that it can be very easily integrated in websites, applications and whatever your customers already have. Maybe something like PollDaddy with SMS, great API and a strong customer relationship focus?

Incspark – guys, I have been following your blog with interest through the summer and must say I have enjoyed it! You surely are onto something as you are not alone doing your thing (having competition is absolutely a good sign). You want to benchmark and position yourselves against competition, for example Yammer has very FB-like user experience and good feature set for the enterprise alongside with quite attractive pricing plans. Then there’s of course Diaspora coming up with momentum and buzz on the open source side. Your thing might well be the MySQL-ish support and customization services as you mentioned, but do you need your own platform for that? Is your core competence helping businesses use social media internally or developing the software for that?

Finally, my sincere respect to the organizers and coaches who made this program possible! This has been a major development in the entrepreneurial climate in Finland and all I can say is that WE WANT MORE!

At some point during my studies in mid-90’s I was offered a possibility to go to Japan as a trainee in the IT department of a traditional Japanese heavy industry company. Well, what the heck, I thought, packed up and spent my next year living here, in the building right in the middle of that picture.

My job in Japan was mostly basic miscellaneous IT work, but with some interesting twists every now and then. I did some programming, although learning Oracle from Japanese manuals was definitely an adventure and an application written in Excel 4 macros running on Macintosh talking to a database in a VAX/VMS server was admittedly a bit exotic. Mac was actually quite popular in Japan at that time, because it handled the language much better than PCs. Internet was just breaking through, and it was quite interesting to witness how it caught up.

My company got their internet connection during my stay, and because I had some experience of the net already, I was considered guru enough to join the meetings with Fujitsu, who were setting it up. Not that I understood much of the formal language used in negotiations between vendor and customer… However, we got the connection and I think I wrote their very first page that was visible in the public net. Thank God they don’t have that page any more.

Another thing that got quite much attention those days was telecommuting, I even joined some seminars arranged by my company about that. The idea of working from home was very understandable considering the terrible commute in Tokyo – I was lucky and had only an hour in three different trains of which only one was always really full. On the other hand, the work culture did not suite telecommuting at all, and I think that’s the main reason it never really caught up. Maybe they have figured out by now how to do the sake-and-karaoke part of the work remotely – if not, perhaps they could find some creative use for Sofanatics

The main thing I got out of this period in my career? Experience and self-confidence. Learning to make it in such a different environment and culture, yet seeing how alike we people all are brings you some perspective to the daily worries in your familiar surroundings. From career point of view this period was not really a turning point, but a reinforcement to continue in my chosen field, seeing how it is truly a global profession where problems, solutions and tools are the same for everybody, but understanding and respecting the people you work with and for really makes the difference.