February, 2010

Using iBatis 3.0 with Scala

Thursday, February 25th, 2010



iBatis has been my ORM of choice for the last several years. From the Ruby-programmer’s point of view, iBatis is overloaded with XML boiler-plate code, but when it comes to high performance, iBatis is out of competition – explicit mapping of queries in XML configuration files (you have to write all the queries you’re going to use manually) has benefits of transparency and ease of maintenance (at any moment of time you can give your XML with mappings, based on standard SQL, to DBA that should not have a framework-specific knowledge to understand and fine tune your queries).

Since recently I’m tending to use Scala, modern elegant JVM-based language, for the back-end areas that require high performance. Though Scala and Java are 99% backwards compatible (you can call Scala code from Java, and vise verse), iBatis configuration under Scala was quite complicated (and ugly) as of late (until the beta 7 version of Scala 3.0 released, which contains support for non-Java classes: Scala objects, etc.).

Besides the non-Java classes support, iBatis 3.0 has some noticeable surprises (both good and bad) for old iBatis users (I’ve been using iBatis 2.3 in production, before):

  • iBatis 3.0 is absolutely incompatible with older pre 3.0 versions of iBatis: package structure, class names, XML schemes and approach, in general, are different;
  • It’s now possible to map beans via constructors (not only setter methods) – that’s the coolest feature in the light of Scala’s case classes;
  • Mapping can be configured with annotations (an obvious attempt to follow the fashion). At the first glance, not very useful – instead of active record approach (when mapping annotations are added directly to the bean to be mapped), iBatis requires to create one mapping class per domain bean;

In the rest of the article I’m going to give you a small overview that will help to use iBatis 3.0 and Scala together. The example below shows some details of the back-end for IdeaBox project that I mentioned in one of my previous articles.

First of all, you need to create a domain class that will be mapped to query results. For domain classes in Scala you may use case class concept that provides lots of useful features (I’m particularly interested in the field’s immutability and handy default implementation of toString method):

trait DomainClass{
   def isNotEmptyString(str: String) = str != null && str.length > 0
}
 
case class Topic(id: String, name: String) extends DomainClass{
   assume(isNotEmptyString(id))
   assume(isNotEmptyString(name))
}

(more…)

What does Google need Buzz for?

Thursday, February 11th, 2010



Ever tried? Ever failed? No matter. Try Again. Fail again. Fail better.
Samuel Beckett

Okay, folks, let’s be honest – that was predictable. People all over the world are already using gDocs to access, edit and exchange documents (+ recently Google added support for any types of files), gReader to read RSS feed subscriptions, gVawe to work collaboratively, gTalk to chat instantly, gVoice to access a variety of phone services, Picassa Web Albums to share photographs, and many other applications (not talking about gMail and the search engine). Social network integrated into the most popular Google’s client, gMail, is absolutely understandable step to consolidate access to other Google’s applications. And whilst Facebook and Twitter owners get frightened, and some executives are even start bullshitting Google (famous Jobs’ speech), Google makes mistakes, learns the lessons, and slowly, step by step builds the biggest empire that has ever existed on the Internet. Google’s way of innovations (reinventing an existing) doesn’t require huge Oracle’s funds (Oracle’s approach of innovation by acquisition), but in many cases, Google’s proposal is objectively worse than the original: just consider Picassa vs Flickr, gTalk vs myriad of other better IMs, Go vs other concurrent languages, Guice vs Spring, and many other examples. And Buzz is not an exclusion – Facebook is more attractive, mature and comprehensive than Buzz. So is Buzz nothing more then just another epic fail of Google (like gVawe)? Don’t think so. Google understands that it will be impossible to attract as many clients as other successful networks have, or force 400 million Facebook users to change their favourite network for raw Google’s alternative.

What does Google need Buzz for?

1. Google wants to have more information (structured and unstructured) about their clients (more than 150 million gMail users). One of the gMail attractive features is an instant registration, where you actually need to provide a very small amount of personal data (which can be dummy). That’s good for users that want to access mail services as fast as possible, but certainly bad for the service provider. Social networks is another story – people sometimes underweight privacy there and say to much about themselves: age, occupation, interests, education, contacts, etc. Google wants to build a deeper insight into their clients, have a wider abilities for market segmentation, increase the value of the customers they currently have and generally manage relationships with the clients better. Secondly, feeds (chats, logs of collaborative work) is a source of unstructured data, that can be used for the same marketing purposes – Google will track opinions, trends and moods of the buzzers. And I’m not sure, Google will provide an open API for the third parties to access the data about their customers (like other social networking providers do). Google values privacy and uses customer records exclusively for own benefit.

2. “The only real failure is the failure to learn from failure” (M. Skarin). Google’s executives understand it perfectly. While media claims Wave to be the biggest Google’s fail of ‘09, the G acquires important experience in building of massive multi-user online collaboration tools. Though buzz might not be as interesting and comfortable as Twitter, it will definitely be more technically perfect – Twitter’s epic fail with ruby-to-scala migration is just impossible in case of Google. Google does not afraid to invest in new initiatives (even if they have merely a small chance to succeed), because they know that series of fails may turn into big success in future. And Google can definitely afford it, providing the hugest search engine and the most popular mail service. Google’s search engine is actually a key to promotion these days. Just think for a minute, what SEO means now? Right – pushing the resource forward on Google.

3. Brand-making and money. Google makes money on ads. The more time client spends in gMail/buzz, the more ads this client consumes. Secondly, one of the hottest market trends is a tendency of consumers to trust more in brands. And Google has a strong story to tell there – it has a reputation as the biggest and strongest provider of free, durable and robust SaaS.

You might not realize it yet, but Google has actually got a lot on the Internet under control. I’ve personally felt, when trojans were hitting my blog, and Google just blocked it in the search engine (which means, I’ve got invisible for e-society). Google can do it with any resource, whenever it wants (so be careful, Apple). Or, for instance, one day Google may decide to put the link to buzz first in the list for query for “best+social+network” (though it’s unlikely to happen).
But will Google manage to fight all it’s alienated opponents building it’s Internet empire? If you look at the history of humanity, you’ll see, that the most of empires willing to achieve world domination were ending the same way – elimination.

While you’re still thinking, I’m giving Buzz a try. Though it’s not going to replace vkonakte/facebook/studiVZ for me, it’s definitely worth spending time on, like all the other Google inventions. Be proactive and learn from Google’s experience – it’s still free for anyone.

Psychea @ Reactor Club, Minsk

Saturday, February 6th, 2010

Psychea is one of the most popular alternative metal bands in Russia. They arose in fame in early 2000s. Their music expressively uses and integrates elements from cybermetal, industrial and grunge. Unusual and memorizable style of Psychea brought many fans to Russian alternative scene.

(more…)

Internal Crowdsourcing: Enterprise Edition

Thursday, February 4th, 2010



Crowdsourcing represents the act of a company or institution taking a function once performed by employees and outsourcing it to an undefined (and generally large) network of people in the form of an open call. This can take the form of peer-production (when the job is performed collaboratively), but is also often undertaken by sole individuals. The crucial prerequisite is the use of the open call format and the large network of potential laborers.

Jeff Howe and Mark Robinson in the June 2006 issue of Wired magazine

I bet, everyone of you at least once in the life felt that your manager is the bottleneck to your creativity and your ideas are underrated. If I’m right, you should know perfectly, what do the phrases “we are considering your proposal” and “we will definitely include this in the next version” mean. Your boss, who in the most cases knows better then you what the market needs (I’m not kidding – people don’t become managers by accident), just wants to protect you against stress. But lets imagine, your amazing, brilliant idea is one of those 20%, which can make 80% of business. What will you do? Go to the boss of your manager? Come on, don’t be a fool – the chance to succeed is really, really small, whilst the relationships with your direct chief will be blown up for sure. The same outcome is expected, if you will be coming to the boss with your ideas over and over again - the head will stay unbending, whereas your creativity will slowly run out.

Modern development practices recognize the importance of this problem and try to solve it setting up direct connections between representatives of different parties (sometimes lowering the influence of project managers). Underside of this approach is that the change motivated by chaotic unstructured communications can lead to even bigger ambiguity, and finally you won’t have any solution to the problem. You can find some order in running brainstorming sessions – good old way to collect fresh points of view. But brainstorms are expensive (in terms of time and special atmosphere they require), so you can hardly afford setting them up on a regular basis and make them a part of your process. You need some kind of solution that will continuously collect ideas (in the background), measure their market value and will give outlet for those employees who can’t keep still.

Internal Crowdsourcing

When it comes to prototyping or planning of internal applications for the enterprise, the common practice is to involve into collaboration process representative(s) of the user party. Normally, they’re the heads of departments (marketing, sales, etc.) or just the most experienced users; in total, no more than 3-4 persons, who can define, whether a technically implementable and economically sound requirement has any sense for users. Whilst those persons can have impact on the development process, specifying requirements and assessing viability of ideas, the main reason of their presence is to help building the cultural bridge between users and new applications (IOW, to get the users ready for change). The problems is that, like with any other kind of mediators, user representatives, who aggregate demands of the community and promote them to other parties (technical, business), can be inaccurate in their conclusions and vision of major demands. At the end of the day, the things that users really want can be out of the picture. Internal crowdsourcing will help to setup many-to-many relationships between users and other parties. Without slowing the planning and development processes down, it may continuously reveal bottlenecks and impediments that users face interacting with the system.

Employees of customer service, marketing, sales and other departments are those who use internal applications on a daily basis (literally breath those application) and have a very deep insight into them. Working with the applications they admit the problems that doesn’t let them act effectively, or things they lack that will increase the productivity. If they try to push those points forward via bug-tracking engine (create a ticket for a proposal), they have a very little chance to succeed – the ticket most likely will be treated as “not a bug” and put off. With crowdsourcing application as the place where employees can submit their ideas, no brilliant ones will be lost. Filtering and promotion of ideas is managed internally by the crowd, so the hottest ones are always highlighted and very little external impact is required. Compared with other media tricks, internal crowdsourcing resembles self-organized continuous brainstorming, most of all.

Source: Daren Brabham, crowdsourcing researcher, http://darenbrabham.com/

Crowd self-management is achieved with voting for the best ideas. At any moment of time, employee should have access to all the ideas submitted by other users, but not evaluated by the crowdsourcer yet (evaluated means accepted for implementation, or rejected). Voting up or down for ideas and collaborating on them, crowd members not only push the best ideas forward, but also adjust them during communication.

Using internal crowdsourcing judiciously, you can find this simple concept doing the following for you:

  • Stimulating innovations. End users can be authors of innovative ideas that will increase share in existing markets, add new value to a current project and help entering new markets. Fresh eyed users can see the problem in a new light;
  • Solving impediments. Users may have problems using existing products, or have no ability (functionality) to do what they want. Crowdsourcing may reveal the most popular impediments;
  • Highlighting creative agents. Management may be interested in figuring out the most creative employees for the future;

Employees on themselves have a strong motivation to share ideas, which can also be stirred up with money or public approval.

The most common motivators for the crowd are:
  • the opportunity to make money (crowdsourcer provides benefits for the best ideas);
  • fun (the process of generation and promoting ideas is exciting);
  • opportunity to earn a reputation as a creative person and innovator;
  • know about other creative persons in the company (build a network of innovators);
  • creative outlet;
  • kill time when bored;

(more…)