Archive for category General

JavaOne 2010 – My Impressions (Part 2)

Part 1 of the series is here.

Sessions (Contd.)

Building Real-Time Web Applications with Lift

David Pollak, founder of Lift (an open source) Scala-based web framework, did a live demo building a chat application. I haven't seen many sessions (that I attended) in the conference where the presenters did code demos. David pulled it off without major glitches. He developed a comet-based chat application along the way touching the concepts of Lift's templates, snippets and Ajax support.

After the demo he went over some of the features of Scala and Lift. Lift applications are secure by default, and he mentioned that penetration testers are having tough time finding security vulnerabilities in the application. Some of the factors that makes this secure: Lift's forms mechanism associates randomly generated GUIDs with form elements and functions. Risk of replay attacks is relatively low with Lift applications. Lift builds all web pages as well formed XHTML rather than a String or a stream of characters or bytes. Lift's SiteMap provides unified menu generation and access control. All these and more actually makes the developers life lot easy by having them concentrate on the business logic of the domain and not on the underlying plumbing work.

Performance concerns with one of the applications built on Rails caused Pollak to think about a Scala-based web application utilizing the power of the JVM (which eventually improved the performance). Lift borrows a lot of good ideas from Rails and other frameworks into Lift.

Foursquare and Novell Pulse are mentioned as publicly available apps that are built using Lift. There are many more startups and enterprise applications building interactive applications using the framework.

Mint.com's Technology Behind the Scenes: Practical Lessons for Scalable Web Apps

David Michaels and Daryl Puryear presented what turned out be one of my favorite sessions of the conference. Mint.com is world's largest free personal financial application with four million users covering 40K zip codes and all 50 states of the USA. Currently hosts 20 millions financial accounts with over 15K financial institutions.

The speakers went over step-by-step how they built the foundation of quality and security, and went over each of the other aspects of the pyramid: performance, scalability, manageability and maintainability. They traveled back in the time and shared the excitement and environment at the launch time some time in 2006/7 time frame. During that time they have a well-defined feature set but with unknown traffic. They wisely invested in production performance monitoring. Doing this enabled Mint to be proactive and enable fast triage of the issues. Monitored only the expensive operations to keep the overhead low. They decided to build a monitoring application (rather than buying) as they have some in-house expertise. Used Spring's auto-proxy feature. Aggregated results in memory and persist periodically. Simple interface was built on top to analyze the data.

Mint performed some performance tests and found that their database is the bottleneck (sounds familiar?). So they tuned the application code to reduce database usage. That brought only marginal improvement, and they hired services of an outside DB conultant who helped optimized the MySQL configuration, which ultimately removed the bottleneck. Lesson: small team can't have all expertise, hire consultants occasionally.

Traffic continued to grow, there were major spikes after press coverage. Once again database scaling was the need of the hour. They did horizontal scaling with multiple smaller databases. Shards are based on user and they made every user independent with no refs between the users. Non-user data is separated into logical databases (user lookup, shared data, monitoring data, user data).

Mint made continuous investments into beefing up security. Standard items were covered like data encryption, penetration testing, automated security scans, multiple DMZs and secure datacenter. Mint also took care of their application architecture so that a developer mistake will not result in a security hole.

Apart from that they have demoed an application they built for triaging errors in application logs, which was interesting. Mint is using XMLC as part of their frontend! Overall this is a very informative session not just from the technology standpoint but also to hear a startup's success story.

Ninety-Seven Things Every Programmer Should Know

Kevlin Henney and Kirk Pepperdine presented one of the entertaining sessions that I attended. Kevlin Henney in particular is an excellent speaker who knows how to present the message in an entertaining way.

If you haven't read this book yet, here are those 97 things appeared in the book. Speakers chose sixteen out of the list for the talk:

Ubuntu coding for your friends - Aslam Khan; Do lots of deliberate practice - Jon Jagger; Know your IDE - Heinz Kabutz; Put the mouse down and step away from the keyboard - Burk Hufnagel; Code reviews - Mattias Karlsson; Read code - Karianne Berg; Comment only what the code cannot say - Kevlin Henney; Code in the language of the domain - Dan North; Prefer domain-specific types to primitive types - Einar Landre; The road to performance is littered with dirty code bombs - Kirk Pepperdine; Interprocess communication affects application response time - Randy Stafford; The longevity of interim solutions - Klaus Marquardt; Two wrongs can make a right (and are difficult to fix) - Allan Kelly; Testing is the engineering rigor of software development - Neal Ford; Write tests for people - Gerard Meszaros; The boy scout rule - Uncle Bob

One of my favorites is the boy scout rule interpretation for the code:

Always check a module in cleaner than when you checked it out.

This is one of those sessions that is difficult to summarize in a post like this. Checkout a video from the speaker on the same topic but at a different venue.

Simpler Scalability, Fault Tolerance, and Concurrency Through Actors and STM

Akka is a tool that you should seriously cosider if you are writing applications with high concurrency needs. Jonas Bonér, the founder of Akka, presented the concepts pertaining to its software transactional model (STM), actors and persistence mechanism. I have recently started evaluating various concurrency models, and this presentation is exactly what I needed for some concrete guidance!

Actor model was popularized by Erlang which emerged in mid-80s. Actor model is a higher level abstraction, for the developers working on concurrent applications, dealing with the traditional locking and thread management. Actors do not share state with the other actors. Each actor has a mailbox and they can only interact with other actors by sending messages. All processing is done asynchronously, actors do not block so they are excellent candidates for event-based applications. Akka actors are extremely lightweight, you can create millions of them on a single workstation. Jonas Bonér discussed the Java API, Akka has also got a Scala API.

Akka's supervision model is inspired from Erlang. It goes by the "let it crash" approach implemented by linking actors. Akka's approach is that failures do happen, don't try to prevent them as they are inevitable. Your goal should be to make them fail soon and let a supervisor (who has a bigger picture) deal with it. A supervisor is an actor responsible for start, stop and monitoring child actors. Bonér discussed All-for-one (restart all the components that a supervisor is managing) and One-for-one (restart only the crashed actor) strategies.

STM model sees the memory as the transactional dataset. It can provide atomicty, consistency and isolation attributes to a transaction. Transactions are retried automatically after the collision. Akka STM is based on the ideas of Clojure STM, a compelling idea for providing transactional shared state. Akka also has pluggable storage backend currently supports Cassandra, MongoDB and Redis.

It is one of those sessions that I felt organizers saved the best for the last (day)!

Tags: , ,

JavaOne 2010 – My Impressions (Part 1)

Bad

Let's start with the bad and everything else would be an improvement when compared with that. Yes, food at the conference is awful. I thought that's only me who is looking out for vegetarian options, but apparently many people I knew who eat mostly anything under the Sun (no disrespect) are also equally disappointed. There is a huge scope for improvement in this area.

Some other aspects that need some attention -- it was a huge effort for the first couple of days to find the right conference room in Hilton and in Parc55; folks sitting towards the back couldn't see the slides that well because of the placement of the screen and projector; Poor wifi, worked intermittently. I hope Oracle considers moving Java One to Mascone in the future.

Good

Now that we put the worst behind us I will go to the other extreme and explain what's the best. Yes, there are some good sessions that I attended which I will go over in a minute. But the best part is meeting people and exchanging ideas. I got an opportunity to meet a whole lot of people I know for a while, worked with them online or exchanged tweets but got a chance to meetup for the first time. What more? I have even found a childhood friend whom I lost contact for the last few years!

Sessions

I will summarize some of the sessions that I liked at the conference (and skipping the ones that didn't appeal to me much):

Script Bowl 2010: A Scripting Languages Shootout

Clojure, Groovy, JRuby and Scala are the contending languages this time. They were presented by Rich Hickey, Graeme Rocher, Nick Sieger and Dick Wall respectively. Roberto Chinnici of Oracle acted as a judge/coordinator. Two rounds of presentations took place -- first round dealing with the language features and the second one presenting community features. Liked what I saw about Spock.

It was all in a rapid fire mode as the time allotted is only one hour. I was actually thinking that to be a competition where a specific problem or two would be assigned to each person representing the language and then evaluate how each language approaches the problem. But apparently that's not the case.

The winner was announced based on the audience applause at the end, just for fun, I guess. Groovy topped followed by Scala as a close second.

Advanced Java API for RESTful Web Services (JAX-RS)

Paul Sandoz and Paul Chinnici started off with an overview of JAX-RS -- going over basic annotations (@Path, @Produces, etc.). Runtime resource resolution was dealt with in good detail. Middle part of the presentation was over integrating JAX-RS with EJBs and CDI (Yawn! I'm not much into it CDI).

Then they woke me up with some good discussion over content negotiation and conditional request support of JAX-RS. JAX-RS has got great content negotiation support covering media type, character set, language, and content encoding. Variant API is nice and flexible.

Equally nice is its support for conditional requests (GETs and PUTs) for caching representations and for concurrency control. They have demoed ETag validation and evaluatePrecondition flow.

"If you think you understand Java Generics than actually you don't understand it!" - a quote from the presenters that drew some laughs. The speakers went over how they had to deal with the type erasure issue and a work around of using GenericEntity to preserve type information at runtime. They finished the presentation discussing the pluggable exception handling mechanism of JAX-RS.

Overall, a nice presentation. I have expected them to discuss hypermedia support in Jersey but because of time constraint they couldn't get to it, as Paul Sandoz suggested after the talk when I asked him about it.

The Next Big Java Virtual Machine Language (NBJL)

Stephen Colebourne of OpenGamma is the speaker of this talk with potential controversy from the title itself. There are a lot of folks who swear by their language of choice, for what its worth, I thought it would be interesting to see what conclusion the presenter would arrive and based on what analysis. (There is also another section of people who completely denounce of the notion of NBJL. They consider polyglot programming is here to stay and there is not going to be one big successor, and you choose a language that best serves your task at hand. Let's leave that view point for another day!).

Colebourne defined what he thinks a next big language would be, one that's widely used (big job market) with supporting ecosystem and community. Examples: C, C++, Java, C#, Cobol, VB, Perl, PHP, Javascript, etc. So NBJL is one that challenges Java and eventually displaces it.

There are a lot of design decisions that were made at various points while Java was evolving. Many of them appeared to be right at that point and only after some experience people started to realize that there are better ways to approach. The speaker went over few items that are sore points in Java and what we have learnt from the real world experiences, from technology advancements, and from the other new breed of languages. Colebourne went over checked exceptions, primitives, arrays, 'everything is a monitor' concept, static methods, method overloading, and generics as some areas where NBJL could provide some solid alternatives.

Colebourne presented what can Java do to evolve still maintaining the "feel of Java". Bigger challenges for Java at this point are supporting -- Properties, Continuations, Control abstraction, Traits, Immutability, Design by Contract, and Reified generics. Another important point the speaker made was that the NBJL should be a "blue collar" language, a language of the masses. An average developer should be able to pick it up rather quickly and be productive in a reasonable time frame.

Towards that end the presenter looked at various languages: Clojure, Groovy, Scala, Fantom and discarded every one of them with some justification. Here is where it gets interesting. He concludes with a thought may be that Java should come up with a backward incompatible version and fix its warts. Regardless of how you respond to the concluding thought it was an excellent presentation overall covering a wide spectrum of concepts. If you are interested to hear from the presenter himself check this out.

NoSQL Alternatives: Principles and Patterns for Building Scalable Applications

Nati Shalom of GigaSpaces presented data scalability patterns that emerged out of various NoSQL projects. He compared the new breed of technology against the traditional database scaling approach in terms of consistency, transaction and query semantics.

Some of the factors that are affecting the scalability needs -- social networks changed the web experience in the recent years. Read-mostly applications transformed into read/write and mostly predictable traffic has become a viral one with huge spikes at certain time intervals triggered by the events. SaaS model and cloud is mentioned as a factor. The speaker suggests that the economic downturn has forced the corporates to work efficiently, and no more that throwing more expensive hardware at the problem is an appealing solution.

Another factor that the speaker suggested was that the disk failures are up and lot higher than what are actually reported by the vendors (3% actual vs 0.5% reported). With the advancements in technology memory can be 100 - 1000x more efficient than the disk. RAMClouds become much more attractive for applications with high throughput requirements. New hardware makes it possible to store the entire set of data in-memory.

The presenter went over various alternatives: In-memory (GigaSpaces), Key/Value. Column (BigTable, HBase), Document model (CouchDB), Graph (Neo4J).  Shalom discussed common principles behind the NoSQL alternatives like - design for failure;  scale through partitioning of the data; maintain reliability through replication; provide flexibility between consistency, availability and partition failure; dynamic scaling. Some other principles (not so common) discussed are - document model support, SQL query support, MapReduce, transaction management, and security.

To be continued ...

See here for part 2 of the series.

Tags: , , ,

Thoughtworks Technology Radar (April 2010)

Somehow I missed the release of second edition of Thoughtworks' technology radar [PDF]. As they did in the inaugural edition they evaluated various techniques, tools, platforms and languages and put them in four buckets -- hold, assess, trial and adopt.

I will jump to the biggest surprise (but something that's consistent with what I'm hearing these days) -- GWT is moved back from Assess to Hold status. I used to be a fan of the approach GWT took, mostly coming from my angst towards writing Javascript, and to develop client-side stuff using the language that I'm quite familiar with -- Java.  Although I haven't done enterprise stuff with GWT yet, what I heard was it's not as productive as I was earlier thinking about, and this technology radar points to some of the issues with the generation of Javascript in terms of productivity, troubleshoting, not being able to utilize powerful features of Javascript, and unit testing. I'm not giving up yet on GWT, but would certainly like to hear feedback from the folks who used it in production-grade applications with good success.

As far as languages are concerned -- they are excited about two languages that I'm having great fun with -- Scala and Clojure. I'm fairly convinced that the enterprises sooner than later would evaluate options of using these JVM-based languages than sticking with Java alone. Java as a language is not dead yet (in fact far from it and dead is a too harsh a word), but if the current trend continues in terms of these new breed of JVM languages (coupled with some good customer stories) that day may not be that far off. Other than that in the languages section -- HTML 5 is gaining traction, which is expected.

In the tools category -- Restfulie has got a mention. I think this is pretty significant in the world of REST-based development. Restfulie is an excellent tool to achieve Hypermedia constraint (HATEOAS) of REST, which helps significantly in loose coupling between clients and servers. They said it well -- "It [success of Restufulie] is an emperical proof that the web and the hypermedia can be used to orchestrate complex business activities".

Also in the tools category -- Subversion moves back into the Adopt section. It has to be that way all along, in my opinion. I like distributed version control systems (Git and Mercurial) a lot but Subversion still has a place in the enterprise. I second their opinion that it's a solid version control system suitable for most teams. New to enter the radar is Github, another success story, undoubtedly popularized Git along with their source code hosting and social networking abilities.

Tags: ,

Pomodoro Technique

A decade ago Joel Spolsky wrote an article titled Where do these people get their (unoriginal) ideas. What he has written is common sense and most of us who worked for a few years in a corporate environment would agree with (I'm talking based on my IT background). Although the context of his article is different, the underlying theme is higher productivity, precisely the theme of this post. Joel says --

Here's the trouble. We all know that knowledge workers work best by getting into "flow", also known as being "in the zone", where they are fully concentrated on their work and fully tuned out of their environment. They lose track of time and produce great stuff through absolute concentration. This is when they get all of their productive work done. Writers, programmers, scientists, and even basketball players will tell you about being in the zone.

He continues ...

The other trouble is that it's so easy to get knocked out of the zone. Noise, phone calls, going out for lunch, having to drive 5 minutes to Starbucks for coffee, and interruptions by coworkers -- ESPECIALLY interruptions by coworkers -- all knock you out of the zone. ...

As Joel rightly points out in the article getting into that "zone" is not that easy. And once you are in, there are quite a few distractions in a typical corporate environment. Great, if you are lucky and gifted to be get into the zone without much effort. If you are like rest of us, you would be all ears for techniques that improve your productivity.

So an year or so ago, I stumbled on this technique called Pomodoro. At the outset it's a simple tracking and feedback process where the unit of work is the pomodoro, a time slot of 25 minutes. The basic principle is to keep you focused enough for specific period of time (in this case: 25 minutes). Here is a free e-book [PDF] if you are interested to know more.

This technique helped me quite well in accomplishing some of the tasks I have either been not focusing enough or procrastinating for various reasons.

This InfoQ article posed some interesting questions with some counter-arguments from Mario Fusco. Mario compares IT professionals with the professionals from other fields and says --

So, why should our work be so different from the former ones? Why do we always think that our work is so special and unique to need a wide set of specific methodologies? Are we professionals or unexperienced kids playing with something bigger then them? I think that, like any other serious professional, I can stay concentrated on what I am doing for hours. I honestly don't need a pomodoro to keep myself focused for just 25 minutes. And if somebody can stay focused for no more than 25 minutes I am afraid that he should really rethink the way he works.

To respond to that, I'm not so sure whether there is an apples-to-apples comparison between the professions and type of work performed. The basic goal is to be productive. Regardless which profession you are in, you find your own tools and techniques to accomplish that goal. I would treat this technique or something else as a chance to improve. Certainly with corporate emails, phone calls, and other interruptions it's certainly not easy to concentrate for a good chunk of time and being productive (I'm not even mentioning about Blogs/RSS readers, Twitter, etc.). As I already mentioned, if you think you are already productive and can concentrate quite well (without any new techniques), great, pat on your back.

On the drawbacks-front he says --

Said that, in my opinion there are also other important drawbacks in the pomodoro technique. What should I reply to my customer who is calling me, possibly from the other side of the ocean? That I am in the middle of my pomodoro and I can't break it? ...

I don't think the technique is that restrictive. Obviously if that call is important you would take it and discard that Pomodoro, attend the urgent task, and get back to Pomodoro when you are ready. Let's not complicate it more than what it is, this is just a way to being more productive cutting down on the distractions. I don't see this as a hindrance to the team work or on your efficiency to deal with more urgent matters.

Have you used Pomodoro technique, how do you like it?

Tags: ,