A project triumvirate

There are three forces that shape a project: domain, process and technology. Add the “-driven” suffix to any of them and you’ll perhaps recognize some of the methods used in projects you’ve been involved in and yet, as soon as one takes too much of a lead against the other two, failure will follow almost inevitably. At the intersection of these three forces we find familiar terms and concepts but first a word or two about each of them:

Technology
Back in the days of the tech bubble, tech was allmighty. Buzzwords like Java, EJBs, PHP defined entire projects. It was the time where software became accessible to a much larger audience. The new wave of enthusiastic geeks embraced everything from new languages to professional certifications to the then-nascent open source. I admit having my share of technology-driven projects back in the day…

Process
Process brings structure and pace to a project. The two complementary components of a project process are methodology and integration. We are all too familiar with methodology: waterfall, RUP or agile methods of software development are vastly documented and practiced; integration largely is defect management, testing, build, deployment and documentation. Today they all come together in what is called continuous integration where all these concepts become interrelated in a repetitive process that produces accountability and visibility into the progress of a project. Process is also the one force that tends to disappear first after a project is finished.

Domain
The domain captures entities and business logic, is driven by the business requirements and is in no way influenced by the two other forces. The most successful way to employ the domain is through Domain Driven Design where the main focus of software development is neither technology nor process but the business requirements.

Continue reading “A project triumvirate”

Process Journalism really is Agile Journalism

MediaThere’s an interesting story rippling the news stream these days: The New York Times is questioning the ways Techcrunch reports on news. The crux of the issue is product journalism v. process journalism, the act of producing news only after all facts have been verified versus just writing the story based on what the author best knows about an event at that moment then let the story evolve and provide rigorous updates and corrections once it does.
As I was reading, I got an epiphany. The “old media” is following the old methods, much like the waterfall process where the story (the requirements) has to be fully known before proceeding with actually breaking the story (the implementation). The new media follows a radical approach: it starts with a lead (or rumor) that is initially published in a somewhat crude form, then the story evolves based on field feedback and facts drawn from the actual reality, until it becomes accurate. Even the language of the aforementioned references use words like “iterative process”, “transparent” and “standards” the same way I’d use them when talking about developing software.

This method of early release followed by incremental improvements resembles so much the agile methods of software development, I’m calling it Agile Journalism.

A revolution is happening in the media. Old methods are swiftly pushed aside; the emergence of the Internet as the news dissemination medium is fundamentally changing the ways the reality is reported upon. Who wants to read a story that is already obsolete or wrong altogether and impossible to be corrected/evolved until a new paper edition is off the press? The new media not only breaks news faster (release early) but gets the stories right eventually, simply because the new rules (standards) are clearly stating that until confirmed, the product -otherwise useful- is still a beta representation of the reality and the consumers already know how to consume such product.

From blogs to real time news streams, the new media’s aspiration is to bring the most accurate information yet to the consumers. It can and will do it by revolutionizing the way the stories are iteratively discovered based on constant feedback, the same way agile methods are revolutionizing the software industry.

Image courtesy hirefrank

Proposal to standardize the Level 2 query cache configuration in JPA 2.0

Level 2 cache is one of the most powerful features of the JPA spec. It’s a transparent layer that manages out-of-session data access and cranks-up the performance of the data access tier. To my knowledge it has been first seen in Hibernate and was later adopted by the then-emerging JPA spec (driven mostly by the Hibernate guys back in the day).
As annotations gained strength and adoption, L2 caching that was initially configured through XML or properties files, was brought closer to the source code, alas in different forms and shapes. This becomes apparent if you ever have to deploy your webapp across a multitude of containers as you have to painfully recode the cache configuration (or worse, hand-coded cache access). Why not standardizing the cache control in JPA? This seems to be simple enough to achieve and yet it isn’t there. Now that JPA 2.0 is standardizing on Level 2 cache access (See JSR 317 section 6.10) it is the natural thing to do.
Every JPA provider has its own way of specifying cache access (both Entity and query cache).
To grasp the extent of the various ways cache is configured, here are some examples:

Hibernate:
Cache control for entities

@Entity
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Employee {...

Cache control for named queries:

@javax.persistence.NamedQuery(name="findEmployeesInDept",
query="select emp from Employee emp where emp.department = ?1",
hints={@QueryHint(name="org.hibernate.cacheable",value="true")})

or

@org.hibernate.annotations.NamedQuery(cacheable=true, cacheRegion="employeeRegion")

OpenJPA
Cache control for entities

@Entity
@org.apache.openjpa.persistence.DataCache(timeout=10000)
public class Employee {...

Query cache requires hand coded cache access:

OpenJPAEntityManagerFactory oemf = OpenJPAPersistence.cast(emf);
QueryResultCache qcache = oemf.getQueryResultCache();

Continue reading “Proposal to standardize the Level 2 query cache configuration in JPA 2.0”

“Thinking in” what?

image010“Thinking in…” anything has been a marketing quirk for a while now, being used and abused from the field of language learning to computer science. Thinking in Java is the title of a well known book written by Bruce Eckel. I am passing a “Think in Spanish” course flyer ad every time I stroll on Bloor Street West here in Toronto.
Funny, thinking within the rigors of a discipline is the very definition of thinking inside the box.With respect to programming languages, it encourages one to think within the limits of a single language which is the exact opposite of what one should do when developing software.
The hegemony of agile methodologies inflicted a disruptive change on the face of the software industry and amongst the established roles within a team. The legions of “coders” bred by the tech bubble of 2000 are facing extinction; the roles of the software designer and Technical Architect are fuzzier than ever. Thinking inside of the language box makes a better coder but not a better software engineer.

Modern software design methodologies shatter that box. Domain Driven Design disconnects the developer from the technology and places domain rules before the intricacies of a language. Test Driven Development brings the Domain in the software realm and it does it by forcing to write the tests first, then write the actual code. Test-first forces you to think behavior and APIs first then perform the act of coding which is nothing more than implementing that behavior.
Eric Evans’s DDD: Strategic Design is an eye opener. And while you’re at it, check his other presentation about domain modeling.

So instead of “Thinking in Java”, think Domain and APIs first then act. In Java.

Mobile internet is here to stay

Since I went back from vacation (Easter with family back home in Romania) I got quite interested in the mobile internet. This was the first time I wasn’t going to internet cafes or asking buddies to let me use their internet (and their PCs).
I have a beaten Nokia 3100 that works both in RO and here in Toronto. I was playing with it in my first vacation days back home, exploring the features of my romanian mobile carrier (I love the *…# service commands, they remind me of dumb terminals) and I noticed that they had a new offering, mobile internet. Configuration was a breeze and I found myself browsing the internet a few minutes later. Email, news, even checking if my websites are still up and running; they were all there where I left them.
Needless to say that from that day I didn’t step into an internet cafe anymore to get my fix.

I also got a lovely gift from Corina around the same time, an iPod Touch. Since I’m a fan of Apple’s products I couldn’t be happier and since I started using it I realized that I use my regular laptop less and less. I’m using the iPod Touch more to check Email, news, weather, live TV (gotta love France24) and play the occasional game, than to listen to music. The experience is more condensed and focused and so I spend less time to find what I’m looking for. Mobile internet experience achieved the goal that it’s parent couldn’t: ease of use.

Funny that I had to go back home to find it out.
Continue reading “Mobile internet is here to stay”

Evaluating EclipseLink 1.1

As I’m using the ubiquitous Hibernate 3.3 as the JPA 1.0 provider for Spincloud, I decided to try out another one. I had tried OpenJPA (spawned from Kodo JDO) when they only supported build-time bytecode enhancement and it was a pain to make it work. It worked all right but boy what a pain. There’s now an agent to provide on-the-fly enhancement but I’ll take transparent enhancement anytime.
I’ve heard about EclipseLink before. The project started when Oracle donated the respectable TopLink project to the Eclipse foundation. If the solid reputation behind TopLink was a good enough argument for me to try it, the announcement that it will be the JPA 2.0 reference implementation convinced me that I should try it out.
My goal is to evaluate if EclipseLink is production-ready. I’m applying a complex set of evaluation criteria (joking): if it can run Spincloud then it is (I was inspired by Seifer’s interview on Infoq about Ruby VMs; when asked what was the criteria for qualifying if a Ruby VM is production ready, he answered: if it runs Rails).

I have the following JPA requirements:
– column mappings, one-to-one, one-to-many
– supports BLOB fields
– supports NamedQueries and NamedNativeQueries
– support for object cache and query cache
– deployment/operational nice to have: ease of maintaining compatibility with both EclipseLink and Hibernate in the source code and runtime. Ideally I should plug-in any JPA provider without changing a single line of code. This was not attainable as I’ll explain below.

I started by downloading the binaries. I’m using Maven to bring the jars so I’ve followed the instructions here. I only changed the version since I wanted to use v1.1.0:

  <dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>eclipselink</artifactId>
    <version>1.1.0</version>
    <scope>provided</scope>
  </dependency>

There’s a single jar file called eclipselink-1.1.0.jar downloaded which is a nice change from the multitude of Hibernate jars I was accustomed with.
Continue reading “Evaluating EclipseLink 1.1”

Atlantis spotted on Google Earth?

I couldn’t miss this one. It didn’t take long  after Google released its seafloor imagery to its Earth and Maps products for someone to claim the discovery of nothing less than Atlantis itself! Ah, and again it wasn’t me…

Take a closer look at the Atlantic Ocean floor area:

atlantis

On the left, a grid-like structure is clearly visible. I also spotted a similar “grid” east of the main one (yes, I called it!) and some more off the west coast of Ireland.

However, it may all be a false alarm. Google said that:

 “Bathymetric (or sea floor terrain) data is often collected from boats using sonar to take measurements of the sea floor […] The lines reflect the path of the boat as it gathers the data.”

I’m keeping my fingers crossed though. I’m waiting for Discovery Channel, bounty hunters and reality showmen to swarm the place now as I think this patch of open ocean is international waters. Finders keepers!

Deus ex Machina

I love Hollywood movies. They project a surreal world that in which all stories have a happy ending. Whenever the hero seems to be cornered and rapidly heading to his doom, a last-second turn of events allows him to escape. This is deus ex machina. God from the machine. To the rescue.

I’m thinking back at many movies I so enjoyed. Terminator, Die Hard (yeah, right), Batman, Ironman, Indiana. Deus ex machina all over. I denounce them.

Think of a Hollywood movie, any of them. Chances are it’s a Deus one.

I like Rocky 1 and Trainspotting. And Sex Traffic.

I know why I like the cheesy Deus’ movies. I know the ending, no surprises there. Shameless happiness at the end, the hero survives all impossible circumstances. Satisfaction guaranteed.

No more of this nonsense. Realism rocks. I’m not going to go watch any of these other movies anymore!

And yet I can’t look away.

REST is DSL

I like RESTful URLs. They clearly express the intent of the provided resource. We humans speak a language close to REST when we talk to The Internet. 

Take a look at Google’s RESTful search query, probably the most used RESTful URL ever:

http://www.google.com/search?q=your-terms-of-choice

in freeform language this translates to: “Google, search for this term.”

How about the Flickr RESTful tag cluster search service:

http://api.flickr.com/services/rest/?method=flickr.tags.getClusters&
api_key=a6f11b67ae348a7b3f2da0d865b8bc1d&tag=Berlin

In Flickr lingo this means: “Fetch all tag clusters for the ‘Berlin’ tag”.

It doesn’t take much to understand RESTful URLs. They speak the language of the domain they represent and therefore in the Web Services provider-consumer world:

The collection of all RESTful services provided by a domain represents its web-oriented Domain Specific Language.  

DSLs have been around for a long time. For more information check Martin Fowler’s talk on the subject.

Mac wars

humpOh, that “I’m a Mac” commercial is on the TV again. Then some ugly new ad where some webcam people defend the PCs on behalf of Microsoft: “I’m a PC”. While my brain was tricked into an attempted wash, I realized that I’m not any of it.I’m a human being.

I’m not trying to help you here Redmond but voila, here’s one good ad slogan:

I am not a machine. I’m a human being. And I use a PC.®