Sunday, August 31, 2008

Week One in Encinitas

After a week in an Encinitas, I cannot yet say my new surroundings feel "normal", nor any of my habits routine. My furniture is still en route, and although I expect its arrival to restore some normalcy.

My last apartment in Northern Virginia was somewhat secluded, no downtown-area lent itself to gatherings or throngs of pedestrians. As I explore my new surroundings, it isn't the proximity to the ocean that I'm struck by, nor the appearance of palm trees. Rather, while walking in my neighborhood, the thought that echoes in my mind is "My God, what are all these people doing around my place?!?".

I'm finally feeling effective at my job, truly becoming part of the software development team. I think because I place such a high value on teamwork, working remotely is a handicap to which I'm particularly sensitive.

Sunday, August 24, 2008

First 24 hours in Encinitas

After a week of stress inducing packing and other move-related activities, I have arrived in my new home in Encinitas, sans most of my possessions, which will take another two weeks before being delivered.. Although situated physically, my mind has not yet accepted my new residence, and somewhere in its recesses believes my Northern Viginia apartment exists, beckoning with its comfortable couch and big screen TV. Naturally my new apartment is all but bare -- were it not for the generosity of my brother, I would not even have an air mattress on which to sleep.

I'm reminded of my college days, where both my physical dorm and intangible mindset were blank slates, to be filled with Target purchases and new habits respectively. In time, my Northern Virginia baggage will arrive, but it will be made to adorn my new environment, and not vice-versa.

Here are a couple shots of my place, for your benefit and mine, as routinely telling myself "I live by the beach" has proven insufficient to convince my mind.

Meager beach view from my bathroom.




Just outside my place


Not within 2 hours of landing was I reminded how cigarettes are so reviled here in Encinitas. Bereft of my beloved entertainment system, my brother and I went to the local bar shortly after I unlocked my apartment. While enjoying some "fresh air" outside amongst the other nicotine castaways, an attractive girl asked to have a cigarette. We started talking, the "I moved here two hours ago" line being an effective if fleeting conversational gambit. Sandy, a schoolteacher whose name I've changed to protect her reputation amongst her 5th grade students, advised me that a single male best not find himself amongst the maligned Encinitas smokers, as he'd have little hope of igniting romance with the tips of his Parliament Lites. Many residents regarded the habit with disdain, she related. Bikers would often scowl at someone with a cigarette -- funny that it took me a second for me to realize she was referring to bicyclists and not the cigar-chomping, tattoo-adorned, denim wearing gearheads that the image first conjured for me.

I suppose its ironic her admonishment could have only occurred had she asked me for a cigarette, and that she herself should think the habit so disgusting when she was smoking (although she's one of those folks who only lights up when drinking). I came to the conclusion that its probably better to be a hypocritical health-nut than a principled smoker.

Cigarettes, of course, came with me, an entire carton given premium space in my luggage. The addiction which ties me to them suffers no jet lag and is remarkably portable. The routine and habit which regulated their use, like the post-urination ceremony or the celebratory smoke after completing a PS3 game, are in flux. As I've done with my furniture and accumulated junk, it has become time to decide what of my East Coast life will my West Coast environment be made to accomodate.

Saturday, August 9, 2008

Navigating Search with Compass

I have been on two projects where Google-style searching was a requested feature. For each, I used Compass, which bridges the gap between Hibernate and Lucene. One of those projects was recently deployed and is handling thousands of queries a day on an index that includes a few million documents. Prior to this deployment, searching was performed through SQL/Hibernate queries which, we were finding, did not necessarily scale very well.

I am pleased as pie with Compass. The documentation is a little daunting -- mirroring Hibernate is but one of Compass's many features which the online reference covers. In the end, though, integrating with Compass amounts to little more than annotating the classes you intend to index and using Compass's query API to generate search results.

I had run into out-of-memory problems when building the initial index with Compass. After many hours of tweaking configuration settings, I finally was able to fix this by appending "useCursorFetch=true" to the MySql JDBC Url, a problem described by this forum post.

I highly recommend Compass if your project needs search functionality. My hat goes off to Compass developers. Many thanks for providing a fantastic open-source framework.

Sunday, August 3, 2008

My Comments on "Four harmful Java idioms..."

Recently published on JavaWorld, Four harmful Java idioms, and how to fix them struck me as something I could have written if I lived on Bizarro World.

Point by point:

1. Use a naming convention to distinguish three kinds of data, not two: local variables, fields, and method arguments.

The author seems to discount another injury made unto the code's reader, that of a code's noise level. Prefixing variables to indicate scope creates tiny conceptual speed bumps the reader must navigate. IDEs already format variables according to scope, so there's no discernible benefit. If you're using notepad/vi/emacs, then I've no sympathy for you, and I'd be hard-pressed to enact a style guideline to accommodate outdated development environments.

We're fortunate enough to be programmers in a time when programming languages are expressive. Attempts to make the code less English-like, like using prefixes, I regard with suspicion.

3. Don't use JavaBeans for modeling the database.

His thoughts regarding JavaBeans applied to database records rest upon a premise I just am unable to reconcile with my own approach. Namely, my "JavaBeans" aren't modeling database records, they are modeling my domain. The database is also modeling the domain, though naturally through normalized tables and such and not through Java's OO design. It seems to me if a developer attempts to model the database, he/she is ditching Java's rich expressiveness in favor of the bleaker designs of RDMS. I can see how this would lead one to opt for "immutable classes" instead of JavaBeans.

4. Order items in a class in terms of decreasing scope, with private items appearing last.

Again, were we programming in notepad, this might make more sense. With an IDE, I simply hit a key and navigate to a private member's declaration. Further, I'm sure I'm not alone in that I'm accustomed to seeing a class's "vital stats" by looking at the top of it. If I had to switch to the bottom to view its private couplings (probably a class's most important vital stat), insanity might quickly ensue.


Conclusion

You'll notice that I haven't addressed his point #2, favor package-by-feature over package-by-layer. I'd really have to work with such a package design before having an opinion on it, and the article is devoid of any examples. Those interested in hearing more about that I'd recommend perusing a discussion that occurred on TheServerSide here , which, not coincidentally, was started by news of the author's own web4j release (probably the only Java web framework that isn't open source). In fact, that discussion will also provide some context in which to judge other aspects of the author's thesis.