What
 · Technology
 · · Coding
 · · · · Java (25 fragments)
 · · · · Text (13 fragments)

Tools! · I’m in the un­ac­cus­tomed po­si­tion of spend­ing all my work time ei­ther writ­ing soft­ware or in meet­ings about it. The cur­rent project is con­ven­tion­al big-system server-side Java. That’s not a land­scape that anyone’s gonna wax lyri­cal over, but boy, have the tools ev­er come along while I was off An­droid­ing and Go-ing and Ruby­ing ...
[4 comments]  
R and G and J · I just read Adam Jacob’s Rust and Go, com­par­ing two new hot­ness­es. Me, I’ve been (u­nac­cus­tomed­ly) work­ing the last few months in a fa­mil­iar code­base/­toolset, on an An­droid ap­p; so I thought I’d add an “…and Java.” ...
[8 comments]  
The DI Opposition · Another pile-on sto­ry; this time on David Heine­meier Hansson’s Depen­den­cy in­jec­tion is not a virtue. I agree with ev­ery word DHH writes here, but I think I have a bet­ter ex­am­ple. Tl;­dr: ...
[12 comments]  
D.P.H. · I owe a whole lot to Per­l. So does the prac­tice of com­put­ing in gen­er­al, and the con­struc­tion of the Web in par­tic­u­lar. Perl’s sit­u­a­tion is not ter­ri­bly hap­py; I wouldn’t go so far as to say “desperate”, but cer­tain­ly these are not its glo­ry days ...
[22 comments]  
Concurrent List Update With Shuffling · This is a sketch of how to pro­vide high­ly con­cur­rent read and up­date ac­cess to sort­ed paged lists while re­quir­ing min­i­mal lock­ing. This par­tic­u­lar trick has prob­a­bly been cov­ered be­fore but if so I’ve missed it and haven’t seen any­one else us­ing it ...
[12 comments]  
Forget the Defaults · I was watch­ing en­gi­neers ar­gue, some­one was bitch­ing about a code re­view­er ask­ing him to put more paren­the­ses in a con­di­tion­al: “As if I don’t know the prece­dence rules!” I don’t know them, as a mat­ter of prin­ci­ple ...
[37 comments]  
Fortress · Since I’m spelunk­ing around the new-languages cav­erns these days, I re­al­ly ought to men­tion the long-ongoing and very in­ter­est­ing Fortress, brain-child of our own Guy Steele, who knows one or two things about de­sign­ing lan­guages ...
[5 comments]  
Clojure N00b Tips · Clo­jure is the new hot­ness among peo­ple who think the JVM is an in­ter­est­ing plat­form for post-Java lan­guages, and for peo­ple who think there’s still life in that ol’ Lisp beast, and for peo­ple who wor­ry about con­cur­ren­cy and state in the con­text of the mul­ti­core fu­ture. Over the last few days I’ve been severe­ly bipo­lar about Clo­jure, swing­ing from “way cool!” to “am I re­al­ly that stupid?” Here­with some getting-started tips for new­bies like me ...
[7 comments]  
Tail Call Amputation · This is per­haps a slight di­gres­sion; just an ex­tend­ed ex­pres­sion of plea­sure about Clojure’s re­cur state­men­t. It neat­ly squash­es a bee I’ve had in my bon­net for some years now; if it’s wrong to loathe “tail re­cur­sion optimization” then I don’t want to be right ...
[25 comments]  
On Duct Tape · There’s this con­ver­sa­tion rolling around the developers’ world; it start­ed with chap­ter in Coders at Work by the one & on­ly JWZ, which I haven’t read, but which Joel Spol­sky en­thused over, prais­ing the prac­tice of “duct-tape programming”. Un­cle Bob Martin weighed in. I have opin­ions and ex­am­ples too ...
[26 comments]  
Test-Driven Heresy · I’ve been think­ing about test-driven de­vel­op­ment a lot late­ly, ob­serv­ing my­self veer­ing be­tween TDD virtue and oc­ca­sion­al laps­es in­to sin. Here’s my the­sis: As a pro­fes­sion, we do a lot more soft­ware main­te­nance than we do green­field de­vel­op­men­t. And it’s at the main­te­nance end where TDD re­al­ly pays of­f. I’m start­ing to see laps­es from the TDD cre­do as more and more for­giv­able the clos­er you are to the be­gin­ning of a pro­jec­t. And con­verse­ly, en­tire­ly ab­hor­rent while in main­te­nance mod­e ...
[26 comments]  
Tab Sweep — Tech · Here­with glean­ings from a cir­cle of brows­er tabs fac­ing in­ward at the world of tech­nol­o­gy. Some are weeks and weeks old: Am­ber Road, Clo­jure, tail re­cur­sion, cloud­zones, deep pack­et in­spec­tion, and key/­val­ue mi­crobench­mark­ing ...
[5 comments]  
Transparent Storage · In prepa­ra­tion for that Disk Per­for­mance piece and ac­com­pa­ny­ing keynote last week, I spent quite a bit of time with the new Uni­fied Stor­age “Fishworks” An­a­lyt­ics Soft­ware, which is fas­ci­nat­ing stuff. Here­with an il­lus­trat­ed re­port ...
[2 comments]  
Inside mod_atom · This is a lengthy note to my­self. I ini­tial­ly want­ed to cap­ture the think­ing that went in­to the con­struc­tion of mod­_atom while it was still fresh in my mind, and dumped out the first dozen or so sec­tion­s. Then as I ex­pand­ed and refac­tored the code, I find that I’m keep­ing this up to date. This most­ly by way of putting it in a place where I won’t lose it. I can write stuff for on­go­ing faster than for any oth­er medi­um, and “On the Net” is a good place not to lose stuff. If mod­_atom even­tu­al­ly gets picked up and used, this may be use­ful to me or any­one else who’s main­tain­ing it; and if it doesn’t, there’ll still even­tu­al­ly be an AtomPub serv­er mod­ule for Apache, and this might be use­ful to who­ev­er builds it. But this is not de­signed to be en­ter­tain­ing or ped­a­gog­i­cal; among oth­er things, it’s in es­sen­tial­ly ran­dom or­der ...
 
Build One to Throw Away · This is a max­im from Fred Brooks’ The Myth­i­cal Man-Month. Th­ese days I’m think­ing it’s the sin­gle most im­por­tant les­son there is about soft­ware. It’s been brought rude­ly home to me by my re­cent work on mod­_atom, whose de­sign is ter­ri­bly sim­ple; but I still got the first cut wrong in im­por­tant ways ...
[9 comments]  
Annotated Questions · OSCON has tra­di­tion­al­ly fea­tured bun­dles of short fifteen-minute keynotes. I gave one en­ti­tled “Programming-Language Questions” and loved the com­pressed in­ten­si­ty of the for­mat. Un­for­tu­nate­ly, my slides were ir­re­triev­ably lost in the post-speech disk crash (yes, I usu­al­ly drop ’em on a USB stick, this time I didn’t). There’s video on­line at blip.tv, but the qual­i­ty is pret­ty ba­sic, and I sus­pect that the on-screen URIs and code sam­ples not use­ful. Here are all the miss­ing pieces, should you want to watch it (on­ly 15 min­utes, re­mem­ber); plus a lit­tle ex­tra com­men­tary ...
[4 comments]  
Which Tools? · Wow, this one touched a nerve. Some guys here at Sun were ar­gu­ing about which bug track­ers and SCM tools were cur­rent­ly da bombi­est, and they de­cid­ed to ask the world. Hasn’t re­ceived hard­ly any pub­lic­i­ty yet, and al­ready over 200 re­spons­es. Join in, and pass the word; Here is the sur­vey and here are the re­sults.
[10 comments]  
In C · I’m back to work­ing on mod­_atom and kind of gloomy be­cause it’s C pro­gram­ming; so much more ef­fort to do a unit of work com­pared, for ex­am­ple, to Ruby. In this con­tex­t, Ter­ry Jones’ Em­brac­ing En­cap­su­la­tion got my at­ten­tion and made me feel vague­ly di­nosauri­an. While he may be on to some­thing im­por­tan­t, there are some con­so­la­tions for us griz­zled pointer-wranglers. For ex­am­ple, the list of things im­ple­ment­ed in large­ly or whol­ly in C: Unix, Lin­ux, So­lar­is, Win­dows, Java, .NET, Flash, Mozil­la, Mi­crosoft Of­fice, the Apache server, the X win­dow sys­tem, Per­l, Python, and Ruby. Not bad, re­al­ly not bad at al­l.
[8 comments]  
GNU Tool Moan · I mean au­to­conf, libtool, and friend­s, col­lec­tive­ly the GNU build sys­tem. Man, they’re hard to un­der­stand ...
[11 comments]  
Language-Book Principles · I have start­ed read­ing the Scala book (which doesn’t seem to have its own URL, but is for sale at the ar­ti­ma.­com shop) and I have two re­marks on programming-language book­s ...
[14 comments]  
NetBeans & C · I’ve been us­ing NetBeans for my mod-atom work for a while now, and while it was bet­ter than Emac­s, the C sup­port has still had a way to go ...
[4 comments]  
Thirty Years to Live · It seems that Perl will soon be able to deal with dates past 2038. Can your pro­gram­ming lan­guage do this? (See 2038bug.­com.) ...
[10 comments]  
Autotools 1, Tim 0 · I’m go­ing to do some more work on mod­_atom, but I have a prob­lem; it doesn’t work on Leop­ard. That’s OK, the Ape blows it up re­peat­ably, so should be no big­gie. Hm­m, ex­cept for apr_­glob­al_­mu­tex_cre­ate is act­ing weird, re­mov­ing the lock­file while fail­ing. Docs no help... OK, let’s look at the code. Urgh. Let’s use the de­bug­ger to see where it’s go­ing. Wel­l... that was a day and a half ago. Since then, been in a maze of twisty lit­tle pas­sages. I’m be­gin­ning to think that Bri­an McCal­lis­ter has a point in say­ing Au­to­tools are the Devil. I used to know how to com­pile C code, sigh.
[Up­date]: Hey, check out the follow-ups. I think this Open Source stuff is go­ing to catch on.
[A­gain]: Hah! Paul Querna’s sug­ges­tion not on­ly made the com­pi­la­tion prob­lems go away, the orig­i­nal bug van­ished too. You know, that Apache com­mu­ni­ty is first-rate.

[2 comments]  
Year-End Sweep — Tech · Over the course of the year, in brows­er tab­s, book­mark­s, and del.i­cio.us, I’ve built up a huge list of things that I felt I should write about, at least at the time I saw them. Wel­l, dammit, I’m not gonna let 2007 end with­out at least mak­ing a try. Here goes. Cat­e­go­rized, even ...
[7 comments]  
On Closures · I start­ed out ner­vous with the idea of adding clo­sures to Java, and I think I’ve slid firm­ly in­to the “contra” cam­p. One rea­son is that it seems in­creas­ing­ly a bad idea to add any­thing to the Ja­va lan­guage. On a re­lat­ed sub­jec­t, my brief so­journ in Ruby-land has changed my think­ing about clo­sures en­tire­ly ...
[19 comments]  
Tab Sweep — Tech · Shed­ding, TDD, Java, and keys ...
[5 comments]  
Language Waves · I sup­pose I could have en­ti­tled this A Gen­er­al Model for Progress In Adop­tion of Pop­u­lar Pro­gram­ming Lan­guages. What hap­pened was, I was com­pos­ing a rant in­tend­ed for use in an in­ter­nal dis­cus­sion of de­vel­op­er fu­tures, and it dawned on me that there’s a re­peat­ing pat­tern in the waves of pro­gram­ming lan­guages that man­age to suc­ceed in find­ing broad us­age ...
[14 comments]  
Postmodern Errors · Today’s fash­ion­able pro­gram­ming lan­guages, in par­tic­u­lar Ruby, Python, and Er­lang, have some­thing in com­mon: re­al­ly lousy er­ror mes­sages. I guess we just got­ta suck it up and deal with it. But to­day I got some­thing re­al­ly, uh, spe­cial from Er­lang ...
[15 comments]  
NB6b1 · Which is to say, NetBeans 6.0 Be­ta 1 is out. Looks pret­ty good so far, they even re­vised the Borg Cube lo­go. I’ve got a cou­ple tabs with .rb files open, and three more that end in .h and .c. I un­der­stand it can be used with Ja­va too ...
[15 comments]  
Reducing C Pain · De­spite my bru­tal min­i­mal­is­m, mod­_atom is get­ting kind of big. The main file has a few dozen (most­ly pleasingly-small) func­tion­s, and nav­i­gat­ing around in it was start­ing to be a chore. I’ve been us­ing Emac­s, and I seem to re­call that it has all sorts of nav­i­ga­tion mag­ic. But then I thought about NetBeans’ ex­cel­lent “Navigator” tool, and that there’s sup­posed to be some new C-support code. So I in­stalled it and it kind of work­s ...
[4 comments]  
Pick-me-up · OK, here’s the prob­lem. It’s a warm day, and kind of stuffy, and what you’re work­ing on isn’t that in­ter­est­ing, and you’re re­al­ly hav­ing trou­ble keep­ing a grip. Here’s the so­lu­tion: dou­ble iced lat­te! ...
[4 comments]  
Executable Babel · Here are two con­sid­er­a­tions of the fact that try­ing to get work done in just one pro­gram­ming lan­guage is no more like­ly to be pos­si­ble in the fu­ture than it has been in the past: Neal Ford’s Poly­glot Pro­gram­ming and Martin Fowler’s Should we strive to on­ly have one lan­guage in our de­vel­op­ment ef­fort­s? Both are worth read­ing, part­ly be­cause they take up more gen­er­al is­sues like con­cur­ren­cy and the old stat­ic/­dy­nam­ic de­bate. But both con­clude that yeah, no sur­prise, the fu­ture is mul­ti­lin­gual. So how do we in­te­grate ’em al­l? ...
[1 comment]  
Tech Tab Sweep · We’re all over the map to­day, from gen­er­al the­o­ries of soft­ware de­vel­op­ment to low-level op­ti­mized bit-banging. Wel­l, all over the soft­ware map, I guess ...
[2 comments]  
Big NetBeans · I was chat­ting with one of the NetBeans guys the oth­er day and he said “BTW, it’s up to 6.7 mil­lion lines of code now”. Gack. Here is their pub­lic sched­ule. Wish them luck­... the thought of man­ag­ing a code-base like that makes my flesh crawl.
[2 comments]  
Another Defeat for XML · <Snicker> I’m talk­ing about Buil­dr, a drop-in re­place­ment for Maven; I’ve nev­er used Maven but boy do peo­ple ev­er hate it. Buil­dr is writ­ten in Ru­by not Java, it us­es a DSL-ish Ru­by di­alect for build files in­stead of XML, and it’s way faster.
[6 comments]  
Which Language? · I was hav­ing trou­ble get­ting my par­tial­ly home-baked Ru­by WSSE im­ple­men­ta­tion to play nice with Hiroshi Asakura’s NTT server-side, so I asked him to send me his WSSE client code. I even­tu­al­ly got it to work (not 100% sure how) but at one point I was peer­ing close­ly at Hiroshi’s code and think­ing “What does that do?” and re­al­ized I wasn’t sure what pro­gram­ming lan­guage I was read­ing. Then I re­al­ized it didn’t re­al­ly mat­ter, they all look more and more like each oth­er. It turned out to be C#.
[6 comments]  
Beautiful Code · This is the O’Reilly project that I was work­ing on in Jan­uary in Aus­trali­a. In terms of the co-authors’ cod­ing achieve­ments, I am in the round­ing er­ror way off to the right of the dec­i­mal point. Stil­l, it was fun writ­ing my chap­ter, and it’s a book I think I’d snap up even if I hadn’t been part of it. Greg Wil­son spills the beans.
[1 comment]  
RX Redux · Thanks to the com­menters on the pre­vi­ous RX piece who rec­om­mend­ed ruby-prof (there’s a gem in­stal­l), which is a much faster and thus bet­ter pro­fil­er than the built-in one. I learned a few more things ...
[6 comments]  
An RX for Ruby Performance · This is an in­sane­ly long and gnarly es­say about im­ple­ment­ing, then op­ti­miz­ing, the low-level bits of a pure-Ruby XML parser. If you ob­sess about XML read­ing, de­ter­min­is­tic fi­nite au­tomata, or Ru­by code op­ti­miza­tion, you may find some part of it in­ter­est­ing. There may per­haps be six peo­ple in the world who care about all three; oth­ers are warned that an at­tempt to read this end to end may lead to gen­er­al paral­y­sis and per­haps even clin­i­cal brain-death. [He’s not kid­ding. -Ed.] By way of com­pen­sa­tion, I’ve tried to be of­fen­sive wher­ev­er the op­por­tu­ni­ty pre­sent­ed. [Up­date: Out­stand­ing com­ment from Avi Bryant be­low, which he re­peats and ex­pands here.]  ...
[18 comments]  
Data that Holds Still · Th­ese last few days, I’ve been sketch­ing in some code for an idea I have that you’ll hear about if it work­s. Un­like most of my re­cent pro­ject­s, it’s got no net­work links or message-passing or socket-munging, it just pro­cess­es some da­ta and pro­duces some oth­er data. The main dif­fer­ence is, it’s in­cred­i­bly easy to unit-test. There are lots of network-programming tasks where I just don’t even know how to unit-test, and where you can do it, it takes a lot of ex­tra work and or­ches­tra­tion, and so the temp­ta­tion to slack off can be ir­re­sistible, for me at least. Some­one who re­al­ly want­ed to ad­vance the state of the art in soft­ware could work on re­duc­ing the fric­tion for de­vel­op­ers who be­lieve in TDD but have to write dis­tribut­ed code.
 
Oooh, Cédric · That’d be Cédric Beust, who, writ­ing both in my new com­ment sys­tem and his own space, de­claims “The bot­tom line is that IDE’s for dy­nam­ic lan­guages will *n­ev­er* be able to per­form cer­tain refac­tor­ings, such as renaming” and asks “Who wants a refac­tor­ing IDE that ‘works most of the time’?” He clos­es with a ma­jor dynamic-language dis­s: “I'm con­vinced that they are not suit­ed for large-scale soft­ware development”. Ob­vi­ous­ly a fun-loving fel­low. Geek girls and boys, I think that man is get­ting in yo face.
[21 comments]  
Dynamic-Language IDEs · I was read­ing Pat Eyler’s in­ter­view with the JRu­by guys (that’s part 2, Part 1 is good too); and I had an idea about build­ing IDEs for dy­nam­ic lan­guages like Ruby ...
[20 comments]  
Yegge Again · I’ve point­ed to Steve Yegge be­fore, but he’s re­cent­ly pub­lished two pieces that I think any­one who cares about de­vel­op­ing soft­ware in A.D. 2006 would en­joy (and ben­e­fit from) read­ing: Ru­by and Ja­va and Stuff and Dream­ing in Brows­er Swamp. Check ’em out.
 
grumble(); · I’m pret­ty busy with this and that but mak­ing good progress on the on­go­ing com­ments sub­sys­tem in be­tween. Writ­ing a com­ment sub­mis­sion/dis­play sys­tem is easy, but even fair­ly mod­est spam re­pel­lent is quite a lot of work; I’ve been con­vinced that it’s worth a cer­tain amount of ef­fort to avoid manda­to­ry mod­er­a­tion. It’s all fair­ly straight­for­ward Ruby, no frame­works or databas­es or any­thing. The on­ly down­side is that I have to make a few ad­just­ments to the cur­rent pub­lish­ing en­gine, which is Per­l, and to the client-side stuff, which is of course JavaScrip­t. I keep putting : in front of con­stant strings. And for­get­ting paren­the­ses. Espe­cial­ly emp­ty paren­the­ses. And semi­colon­s. Espe­cial­ly semi­colon­s. Bloody stupid use­less semi­colon­s.
 
Spolsky Starts a Language War · In Joel Spolsky’s new Lan­guage Wars, he ar­gues that .NET, Java, PHP, and maybe Python are the safe choic­es if you’re go­ing to build out a Web app that’s re­al­ly big and re­al­ly crit­i­cal. He ices this cake with a shov­el­ful of clas­sic FUD aimed at Ru­by and Rail­s. Not sur­pris­ing­ly, David Heine­meier Hans­son vol­leys back twice with Fear, Uncer­tain, and Doubt by Joel Spol­sky and Was Joel’s Wasabi a joke? Bruce Tate has a more thought­ful re­sponse over at In­foQ: From Ja­va to Ruby: Risk. You may not agree with all of Bruce’s points, but they’re well ar­gued. It may sur­prise some who’ve en­dured the flood of Ruby-red writ­ing around here re­cent­ly, but I think Joel’s cor­rect that Python is quite a bit bet­ter proven than Ruby; and al­so that Ru­by has a big Uni­code prob­lem. But I can’t get around the fact that Joel sounds ex­act­ly like a main­frame droid talk­ing about Per­son­al Com­put­er­s, or a VMS droid talk­ing about Unix, or an EDI droid talk­ing about the We­b, or a C++ droid talk­ing about Java. Yeah, the new thing is kin­da un­proven and kin­da shaky in places and kin­da slow and not very full-featured. But it’s got ease-of-use ad­van­tages and programmer-productivity ad­van­tages and de­vel­op­ers like to use it. See the Tech­nol­o­gy Pre­dic­tor Suc­cess Ma­trix, and par­tic­u­lar­ly the last three cri­te­ri­a: Hap­py Pro­gram­mers, Tech­ni­cal Ele­gance, and es­pe­cial­ly the 80/20 Point. Joel’s prob­a­bly wrong.
 
Code Typography · I’ve been hav­ing fun writ­ing Ru­by (and I’ll post some thoughts on that, and the code, soon) and one of the things I’m try­ing to do is be id­iomat­ic. I haven’t ful­ly in­ter­nal­ized where to use paren­the­ses and where not to; but I’ve come to ap­pre­ci­ate the virtues of leav­ing them out; one of the rea­sons that Ruby’s so easy to read is that there are few­er ty­po­graph­ic squig­gles to break up the flow of mean­ing­ful tex­t. Al­so, hav­ing done most­ly Ja­va for some time, I use low­erCamelCase method names. But af­ter some days soak­ing in the Ru­by ethos, those names are start­ing to feel re­al­lyKindOfOverEx­cit­ed and I’m warm­ing to Ruby’s cool_mea­sured_rhythms in­stead.
 
OSCON—Perl & Python · I man­aged to at­tend most of both Gui­do van Rossum’s talk on Python 3000, and Lar­ry Wall with Dami­an Con­way on Perl 6. It’s re­fresh­ing to look at tech­nolo­gies that have passed that tenth birth­day that seems to be cru­cial for soft­ware to es­tab­lish that it’s re­al, and to see that they’re liv­ing and squirm­ing and grow­ing. Python, per its cul­ture, seems to be tread­ing a straight-and-narrow path on a well-defined sched­ule guid­ed by a ruth­less­ly ra­tio­nal set of de­sign cri­te­ri­a. On a tech­ni­cal note, Python 3 will have a String type that is 100% Uni­code and that’s all it is, and sep­a­rate­ly a byte-array type that lets you in­dulge your most squalidly-perverse bit-bashing fan­tasies. I ap­prove. Per­l, on the oth­er hand, is whim­si­cal and wit­ty and un­sched­uled and blithe­ly dis­re­gards many gen­era of con­ven­tion­al wis­dom. One could eas­i­ly have con­clud­ed, lis­ten­ing to Lar­ry and Dami­an, that the prob­lem with pre­vi­ous ver­sions of perl was that they didn’t have enough syn­tax, and thus there was an ur­gent need to add more. It ill be­hooves me to diss Lar­ry Wall’s lan­guage de­sign­s, since I have suc­cess­ful­ly in­ter­nal­ized all but the most per­verse (type­glob, blec­ch) of those that are here to­day and they have en­abled me to wran­gle large amounts of da­ta in sur­pris­ing­ly lit­tle time with generally-popular re­sult­s. Noth­ing would warm my heart more than Perl 6 leap­ing to the cen­ter of the dynamic-language stage and re­claim­ing mind­share. The jury’s out.
 
Want a New Pony? · In Java, you’d say new Pony("black"), and the pony is made by Pony(String color). In Ruby, you’d say Pony.new("black") and the pony-maker is ini­tial­ize(­col­or). In Python, you’d say Pony("black") and the pony-maker is __init__(self, color). I won­der which is best? Does all this seem kind of ad-hoc? Any­how, in re­al life, a Ja­va pro­gram­mer would start with an Ab­strac­tEquineBreed­erGen­er­a­tor and work from there. And for Ru­by you’d be able to say mySpecialPresent.get do | pony |, and it would clean up the pony poop for you (but the pony would be named Kuro­fu­ne). Python pro­gram­mers are Se­ri­ous Men and Women who Don’t Have Time For Ponies. [Up­date: The email is al­ready swirling in. Stand by for an­oth­er vir­tu­al com­ments sec­tion.]
 
Friday Coding Hint · I’m sure you know the feel­ing; an innocent-seeming refac­tor­ing caus­es lit­tle waves of dis­tur­bance all over your sys­tem and all of a sud­den lots of your tests are fail­ing, and you can’t seem to to re­al­ly get a han­dle on it. So yes­ter­day af­ter a cou­ple of hours of hard slog­ging with no net gain, I threw up my hands in dis­gust and mowed the lawn. Halfway through it, I re­al­ized the refac­tor­ing was sub­tly wrong at the core, and when I came back in I made one lit­tle shift and was able to delete lots of special-case code and the tests passed. Prob­lem is, I hate mow­ing the lawn.
 
More Binary-Search Breakage · Peter Luschny writes in with yet an­oth­er way to break my sup­pos­ed­ly bullet-proof bi­na­ry search al­go­rithm. You’re search­ing an ar­ray of what­ev­er­s; well sup­pose that ar­ray is de­clared:
What­ev­er[] w = new What­ev­er[In­te­ger.MAX_VALUE * 2];
I checked, and Ja­va will com­pile that hap­pi­ly. Bi­nary search fall down go boom. Sigh. So, if you think you might have more than a cou­ple bil­lion el­e­ments in your ar­ray, you’d be bet­ter off declar­ing all your in­dex­ing vari­ables as long. (Which should be free on a 64-bit com­put­er, right?) I’ll go up­date the binary-search ar­ti­cle to add this cau­tion. [Up­date: Maybe not. Greg Thomp­son and A. Sun­darara­jan both point out that the Ja­va Lan­guage Def­i­ni­tion re­quires ar­ray in­dices to be in­te­gers, not longs. So I won­der why this com­piles?]

 
Abstract Numbers Yadda Yadda · Fol­low­ing on the up­date to the bi­na­ry search piece, I am in re­ceipt of mul­ti­ple email­s, and the tar­get of mul­ti­ple web links, all say­ing, in a su­pe­ri­or kind of tone, “The poor boy, that prim­i­tive Ja­va stuff broke be­cause he doesn’t have auto-magical big num­bers like Lisp-n-Smalltalk had back in the day.” Thank you for rais­ing my con­scious­ness. If you’ll grant that the trade-off be­tween fixed-size hard-wired datatypes and more ab­stract ones has been un­der dis­cus­sion since Tur­ing was a tot, I’ll grant that many at­tempts to pack the da­ta in tight are symp­toms of pre­ma­ture op­ti­miza­tion. But space-vs-time trade-offs are just not gonna go away; deal with it. And I’ve had my work­ing set blown to hell more than once try­ing to build the parse tree for what seemed like a moderately-sized in­com­ing mes­sage, in a lan­guage that turned out to be just a lit­tle too high lev­el. And the “My thought-experiment lan­guage solved that in 1976” mantra is bor­ing.
 
On the Goodness of Binary Search · Any­one who re­gards them­selves as a se­ri­ous pro­gram­mer has in­ter­nal­ized a lot of dif­fer­ent ways of search­ing: hash ta­bles, bi­na­ry, and many dif­fer­ent kinds of trees. I've used pret­ty well all of these se­ri­ous­ly at some point, but for a decade or so, as far as can I re­call I've used al­most ex­clu­sive­ly bi­na­ry search, and I see no rea­son to change that. Here­with an es­say for pro­gram­mer­s, with fully-worked out ex­am­ples in Java, on why. [Up­dat­ed 39 months af­ter pub­lish­ing when I read with hor­ror Josh Bloch’s exposé of a long-lurking bug. If we can’t get bi­na­ry search right, what chance do we have with re­al soft­ware?] ...
 
Those Accents · I al­ready wrote about how the NetBeans and EE guys are learn­ing lessons from Rail­s. But when Ro­man Strobl asked me to look at his lat­est on in­stant per­sis­tence, I re­al­ized that they’ve learned the re­al­ly im­por­tant lesson; it’s all about instant-app screen­casts fea­tur­ing guys with cute Euro­pean ac­cents. Dig the way Ro­man says “scaffolding”. Clear­ly Djan­go, Grail­s, and the oth­er Web-framework wannabes need to go re­cruit some ap­peal­ing Euro­pean­s... now here’s a rad­i­cal idea: how about a wom­an? [Up­date: Djan­go has a Eurowe­b­cast too!]
 
The Rails Lesson · Over at Geertjan’s blog, The Best Fea­ture Of The Up­com­ing NetBeans IDE 5.5 is the strongest ev­i­dence I’ve seen that the main­stream Ja­va uni­verse is re­al­ly pay­ing at­ten­tion to that lesson. Sure, over at the ex­cel­lent Aquar­i­um, you can read about how they’re slav­ing away in the en­gine room try­ing to make Ja­va EE.next sim­pler and sim­pler and yet sim­pler. But I haven’t been con­vinced that they’ve got to a place yet where they’re go­ing to win lots of con­verts from PHP and Rail­s. But this GlassFish+IDE com­bo is re­al­ly com­ing along: in Geertjan’s ex­am­ple, he makes what looks like a ba­sic CRUD app with no cod­ing and no file edit­ing. In par­tic­u­lar, it looks like they’re get­ting close to Rails lev­els of DRY (“Don’t Re­peat Yourself”). Geert­jan skips light­ly over the database-selection wiz­ard; I won­der how much more than “use these tables” it need­s? [Up­date: He fol­lows up with the de­tail­s.] And the Rails peo­ple will be ask­ing “What is this ‘Deploy’ of which you speak?” But stil­l, we’re in in­ter­est­ing ter­ri­to­ry. [Up­date: Not ten min­utes af­ter writ­ing this, I ran across Ja­va web frame­works - the Rails in­flu­ence, which in turn led me to the (ex­cel­len­t, al­beit in PDF) Ja­va Web Frame­works Sweet Spots. Did I say “interesting territory”? In­ter­est­ing times, too.] [Up­date: It turns out that the in­fras­truc­ture Geert­jan showed off was by Pav­el Buzek, who writes about the pro­cess and seems like a Ma­jor Force for Good. It’s guys like him who are go­ing to cost Ber­lind the price of a nice din­ner.]
 
Having Done Java · Here’s an ob­ser­va­tion: if there’s some­thing you as a pro­gram­mer want to do (con­nect to a web­site, read some XML, walk a filesys­tem, lis­ten on a sock­et, what­ev­er) there’ll be a li­brary in what­ev­er lan­guage you’re us­ing to do that. I’ve ob­served that, on av­er­age, the qual­i­ty of the li­braries is bet­ter in Ja­va than in the com­pe­ti­tion: Per­l, Python, Ruby, what­ev­er. Don’t get up­set, those oth­er lan­guages have lots of oth­er ad­van­tages and are The Right Tool for lots of job­s. And the delta isn’t universal—there are stinky Ja­va li­braries and love­ly Ru­by ones—but stil­l, I’d say this is true way, way more of­ten than not. This sug­gests a hy­poth­e­sis: Hav­ing been a Ja­va pro­gram­mer will make you a bet­ter Ru­by or Python or what­ev­er pro­gram­mer. Oo­h, are peo­ple ev­er gonna get mad at me.
 
XML Automaton · In De­cem­ber of 1996 I re­leased a piece of soft­ware called Lark, which was the world’s first XML Pro­ces­sor (as the term is de­fined in the XML Spec­i­fi­ca­tion). It was suc­cess­ful, but I stopped main­tain­ing it in 1998 be­cause lots of oth­er smart peo­ple, and some big com­pa­nies like Mi­crosoft, were ship­ping per­fect­ly good pro­ces­sors. I nev­er quite open-sourced it, hold­ing back one clever bit in the mo­ron­ic idea that I could make mon­ey out of Lark some­how. The mag­ic sauce is a fi­nite state ma­chine that can be used to parse XML 1.0. Re­cent­ly, some­one out there need­ed one of those, so I thought I’d pub­lish it, with some com­men­tary on Lark’s con­struc­tion and an amus­ing anec­dote about the name. I doubt there are more than twelve peo­ple on the plan­et who care about this kind of pars­ing ar­cana. [Rick Jel­liffe has up­grad­ed the ma­chine]. ...
 
Programming Languages · I fol­lowed a point­er from Bill de hÓra this morn­ing and it cost me an un­planned hour while the rest of the fam­i­ly slep­t, on the sub­ject of pro­gram­ming lan­guages. If you care about such things, stop read­ing here or you’re about to get stuck too; but that’s be­cause it’s good stuff. Bill point­ed me at Steve Yegge, some­how I hadn’t run across him pre­vi­ous­ly.
Item: Bruce Eck­el on The Depar­ture of the Hyper-Enthusiasts, which is too rich to sum­ma­rize but if you had to, it would be: Ru­by is good, but not re­al­ly good enough to beat Python. I wrote about this be­fore, but the con­ver­sa­tion it start­ed re­al­ly has legs.
Item: Steve Yegge push­es back with A lit­tle anti-anti-hype, which ar­gues that friendli­er lan­guages some­times beat bet­ter lan­guages, e.g. Perl vs. Python. The piece is, he ad­mit­s, in­flam­ma­to­ry.
Item: Speak­ing of friend­ly lan­guages, if Steve is right, Ru­by has won, check out why’s (poignan­t) guide to Ru­by which isn’t just friend­ly, it’s a cute lit­tle pup­py bounc­ing in your lap, lick­ing your nose.
Item: Back to Steve Yegge, who ir­ri­tat­ed enough peo­ple with that pre­vi­ous piece that he wrote a follow-up, Bam­bi Meets Godzil­la, mak­ing the same points, but well enough that you don’t mind.
Item: Steve’s Tour de Ba­bel is a re­al­ly fun­ny and en­ter­tain­ing romp through a bunch of lan­guages.
Item: Steve’s al­so in­ter­est­ed in other-languages-on-the-JVM, just like me. Un­like me, he pos­i­tive­ly de­spis­es the Ja­va lan­guage. Me­morable quote: “Java has lots of won­der­ful fea­tures, but Ja­va isn’t one of them. Java’s ap­peal as a plat­form for do­ing re­al work rests pre­cise­ly on its strengths as a plat­for­m, not as a language.” This is in JVM Lan­guages: Ja­va 5, from the se­ries en­ti­tled Stevey’s JVM Lan­guage Soko-Shootout, a re­al­ly in­ter­est­ing run at a sam­ple pro­gram­ming prob­lem in a bunch of dif­fer­ent lan­guages run­ning on the JVM.
Item: Speak­ing of those lan­guages, it turns out that Charles Nut­ter who (with Thomas Enebo) leads the JRu­by pro­jec­t, has a blog, in which he’s re­cent­ly writ­ten about Get­ting IRB Go­ing which he kind of has (although it turns out to be hard), enough to type in Swing (!) code; and a piece which starts talk­ing about JRu­by on Rails, but veers in­to a very in­ter­est­ing dis­cus­sion of JRu­by per­for­mance.

 
Recursive Spolsky · There’s much ado about Joel Spolsky’s The Per­ils of JavaS­chools. I think that Joel’s large­ly right, in that I don’t think that you can re­al­ly ap­pre­ci­ate why Ja­va is a good lan­guage un­less you’re pro­fi­cient in C, and pro­gram­mers who don’t re­al­ly ap­pre­ci­ate Ja­va won’t get the most out of it. But Joel is half wrong in claim­ing that Ja­va by­pass­es point­ers and re­cur­sion; I use re­cur­sion all the time in Java! If you learn pro­gram­ming via Ja­va but re­main ig­no­rant of re­cur­sion, you’ve been poor­ly taugh­t. Al­so, Bill de hÓra has a point when he says that the oth­er re­al­ly hard thing that good pro­gram­mers need to have thought about is con­cur­ren­cy. My guess is that Ja­va is ac­tu­al­ly a good lan­guage for teach­ing con­cur­ren­cy, be­cause the parts of the prob­lem it sweeps un­der the rug are not es­sen­tial to deep un­der­stand­ing and any­how aren’t the re­al­ly hard bit­s. Hav­ing said all that, if I were de­vel­op­ing a dif­fi­cult, mission-critical piece of in­fras­truc­ture, I might de­vel­op in Ja­va but I’d be leery of hir­ing any­one who hadn’t been to the mat with C. My ex­pe­ri­ence dif­fers from Joel’s in an­oth­er re­spec­t: Re­cur­sion is mild­ly hard. Clo­sures and con­tin­u­a­tions are hard. Con­cur­ren­cy is very hard. I nev­er found point­ers hard at al­l.
 
Language Landscape · As the year winds down, the programming-language news keeps flow­ing; at this point I wouldn’t be sur­prised by ma­jor New Year’s Eve an­nounce­ments. Bruce Eck­el wrote The de­par­ture of the hyper-enthusiasts, a lengthy riff on Beyond Ja­va, giv­ing Bruce Tate a hard time on some is­sues and rant­ing away in­for­ma­tive­ly on Ru­by & Python & Zope & EJBs & Rails & lots more; he’s a lit­tle less en­am­ored of Ru­by than oth­er­s. Speak­ing of Rail­s, David Heine­meier Hans­son re­sponds at length. If you’re go­ing to read the­se, do not fail to read the com­ments, which are even more in­ter­est­ing and in­for­ma­tive; Bruce Tate turns up in both con­ver­sa­tion­s. The oth­er item that caught my eye was Cameron Pur­dy not­ing that Cau­cho claims to have a mod­ule that com­piles PHP to byte­codes and runs it on the JVM four times faster than mod­_php (first bench­mark, but on a re­al app not syn­thet­ic). It’s GPL’ed. This is more than a lit­tle sur­pris­ing. I’ve been cam­paign­ing heav­i­ly in the Ja­va com­mu­ni­ty at large and here at Sun specif­i­cal­ly to make dy­nam­ic lan­guages on the JVM a ma­jor pri­or­i­ty, but I’d nev­er re­al­ly fo­cused on PHP, be­cause I didn’t know any­one was even work­ing on the prob­lem. (Wel­l, to be hon­est, al­so be­cause PHP has al­ways made me ner­vous.) This changes the “On Beyond Java” pic­ture. [Late ad­di­tion: last word to Steve Jen­son.]
 
Rework · I just spent some of the af­ter­noon rewrit­ing a chunk of the on­go­ing code. If anything’s bro­ken, do let me know. Read on for some notes on the pro­cess and the tech­nol­o­gy ...
 
Radical New Language Idea · I had this pro­gram that was run­ning slow and fixed the prob­lem by fix­ing the I/O buffer­ing. If I had a quar­ter for ev­ery time I’ve done this over my ca­reer, I’d have, well, two or three buck­s. I think the language-design com­mu­ni­ty ought to take no­tice. Cur­rent­ly, they cook up new lan­guages so object-oriented that each in­di­vid­u­al bit has a method reper­toire, lan­guages so con­cur­rent that threads ex­e­cute in in­com­men­su­rable par­al­lel uni­vers­es, lan­guages so func­tion­al that their ef­fects are com­plete­ly un­ob­serv­able... How about a rad­i­cal new lan­guage where the run­time sys­tem is hy­per­ag­gres­sive about en­sur­ing that all of its I/O prim­i­tives are by de­fault buffered un­less the pro­gram­mer specif­i­cal­ly re­quests oth­er­wise? I’ve heard that there’s some­thing called “COBOL” that has this ca­pa­bil­i­ty, I’ll have to check it out.
 
Atom API Sketches · I’m think­ing about Atom 1.0 from the coder’s point of view. I’m not think­ing about the Pub­lish­ing Pro­to­col, I’m think­ing about how you, the pro­gram­mer, should go about in­hal­ing and ex­hal­ing the stuff. I’ve nev­er be­lieved in One True API for XML, it’s just too broad-spectrum, but Atom’s pret­ty tight­ly con­strained. Ob­vi­ous­ly, you can use some­thing gener­ic like SAX or one of the many DOM-style APIs, or one of the mod­ern pull APIs. Maybe for Atom we could use some­thing sim­pler and more nat­u­ral. I’m think­ing out loud in this space, this is far from fin­ished, not even a pro­pos­al yet. But, I bet there are oth­er peo­ple out there who care ...
 
The Joy of Threads · I’ve had quite a bit to say here about how con­cur­rent soft­ware, which is get­ting more im­por­tant, re­mains bru­tal­ly difficult—beyond the reach, some say, of many ap­pli­ca­tion pro­gram­mer­s. I’m a lit­tle wor­ried about neg­a­tive spin, be­cause if you en­joy pro­gram­ming, you should give con­cur­ren­cy a try; some of us find it es­pe­cial­ly sat­is­fy­ing. I can re­mem­ber like yes­ter­day in the un­der­grad CS course when I first un­der­stood what a “process” was, and then a few years lat­er the same feel­ing when I re­al­ly got thread­s. Yeah, it’s tough; you’ll find your­self de­bug­ging by print state­men­t, and some­times with a compile-run-think cy­cle time mea­sured in min­utes. But when you have the com­put­er do­ing a bunch of things at on­ce, and they all fit to­geth­er and the right things hap­pen fast, well, that’s some pret­ty tasty brain can­dy. All this brought to mind dur­ing our re­cent long week­end in the English coun­tryside; it seemed en­tire­ly rea­son­able to me to sit in a qui­et cor­ner of the pub, or with a view of the ocean, and get a few of those compile-run-think cy­cles in. I can un­der­stand that not ev­ery­one feels this way, but to all the coders out there: this stuff is not on­ly good for your ca­reer, it can be its own re­ward.
 
Jython 2.2a1 · Bri­an Zim­mer did most of the work be­hind this al­pha re­lease, but Bill de hÓra has the best write-up. For sim­ple servlet­s, by the way, I’ve found the cur­rent 2.1 re­lease just hunky-dory, but it’s good to see pro­gress. Con­grat­u­la­tions and thanks to Bri­an.
 
Putting the Soft Back in Software · Check out Bill de hÓra’s No More Nail­s: Mak­ing Good Tech­nol­o­gy Choic­es. I’m not sure that Bill’s nails-vs-screws metaphor works that well, but he says some re­al­ly smart things about how en­ter­prise soft­ware is done. By the way, Paul Hoff­man and I re­cent­ly ap­point­ed Bill co-editor of the Atom Pub­lish­ing Pro­to­col draft, in prepa­ra­tion for the fi­nal charge to the fin­ish line; I ex­pect great things. (Of course, the IETF’s lamentable all-ASCII-all-the-time pub­lish­ing pol­i­cy will keep Bill’s name from show­ing up prop­er­ly on the cov­er).
 
Mind Expansion by Mikael · The Rails (& Ruby) hype is be­com­ing deaf­en­ing to the point that I can’t ig­nore it; while pok­ing around I came across the home of one Mikael Brock­man, yet an­oth­er pre­co­cious Scan­di­na­vian hack­er (what’s go­ing on up there?). Any­how, I’d al­ways vague­ly un­der­stood con­tin­u­a­tions and knew that smart peo­ple thought they were great, but I looked at the code from his es­say Con­tin­u­a­tions on the Web [Sigh, that link is dead. It’s in the archive] and thought “I can’t be­lieve that does what he says”, but it turns out that OS X comes with Ru­by and yes, it does what he says. But I had to spend a long time look­ing at it to see why. Will this kind of id­iom ev­er en­ter the main­stream? I’m not sure, but in­ter­nal­iz­ing it will make you a lit­tle smarter.
 
Things That Just Work: CVS · I’m work­ing on a Java.net project that we’re get­ting ready to de-cloak, and I agreed to fix up some of the files. So I looked at the set­up in­struc­tion­s, and the command-line CVS here on my Mac worked first time, and the whole thing checked out no prob­lem, and there I was do­ing up­date and diff and com­mit. Things aren’t per­fec­t; Java.net seems to run aw­ful­ly slow some­times. But it’s so great when things that are sup­posed to plug to­geth­er just plug to­geth­er and work.
 
Sun EC: On XP and Agile · To­day through noon Fri­day I’m at the in­ter­nal Sun Engi­neer­ing Con­fer­ence. We opened with a cou­ple of speech­es on XP and Agile Soft­ware Devel­op­ment by Ron Jef­fries and John Nolan. I think there were some peo­ple in the au­di­ence who weren’t quite con­vinced, but I learned a cou­ple of things ...
 
Testing Backward · I just wast­ed some time by mak­ing a re­al dumb mis­take in my unit test­ing se­tup, and I think that when tech blog­gers do this they should pub­lish the de­tail­s, be­cause wis­dom is in large part the knowl­edge of how to avoid do­ing dumb things, and thus grows glob­al­ly as a func­tion of the pub­lished in­ven­to­ry of stupid mis­takes. Thus, here­with, a de­scrip­tion of how you can waste time by do­ing your unit test­ing just slight­ly wrong. [Up­dat­ed: A sug­gest­ed best prac­tice to avoid this.] [And again.] ...
 
One IDE to Rule Them All? · Don Box has an in­ter­est­ing set of Pre­dic­tions for 2005. Every one of them is thought-provoking and well-framed. There is one, though, that I have to push back on: the sur­face pre­dic­tion (#2) is that “Sun will em­brace Eclipse”. The deep­er is­sue here pops up a sen­tence lat­er, when Don talks about “unifying on a com­mon tool platform”. Wel­l, as I (and ev­ery­one else who at­tend­ed) learned at the “IDE Shootout” event at the last Ja­va One, the Ja­va IDE land­scape is like a messy, vig­or­ous, noisy, pub­lic mar­ket­place. Each of the big IDEs is here for the long haul; and it’s not just Eclipse and NetBean­s. Don’t for­get Emac­s, JDevel­op­er, and the IDE with the most fa­nat­i­cal fans of al­l, In­tel­liJ IDEA. Un­like the Win­dows world, where Visu­al Stu­dio is all that re­al­ly mat­ter­s, what we have here is an ecosys­tem, a mar­ket, a place where com­pe­ti­tion and evo­lu­tion hap­pen. There is ab­so­lute­ly ze­ro chance that the Ja­va world will ev­er “unify on a com­mon tool platform”. Which is A Good Thing.
 
Test Dammit! · Lau­ren want­ed to vis­it her Mum on the farm for a few days be­fore Christ­mas. The world is well in­to its pre-Christmas slow­down and I’m cod­ing away on Zep­pelin these days, which doesn’t re­quire much Net ac­cess, so I said OK. So I’m sit­ting in front of NetBeans ex­cept when I’m out push­ing the kid’s sled down the hill or vis­it­ing with the cows. Zep­pelin, like most soft­ware, has lots of lay­er­s, and I haven’t fid­dled with the bottom-layer APIs for a while. Ex­cept for I did, added this triv­ial lit­tle method that Couldn’t Pos­si­bly Go Wrong, but (ar­rrrgh) no JUnit test to be sure. Which cost me the best part of a day of de­bug­ging a com­plete­ly in­com­pre­hen­si­ble ap­pli­ca­tion full stop be­cause down at the bot­tom lev­el there was an args[0] in­stead of args[1]. To all those who sat in rooms at one point or an­oth­er this last cou­ple of years and lis­tened to me drone on in a su­pe­ri­or tone of voice about the ex­treme im­por­tance and Karmic ex­cel­lence of unit test­ing, you are now en­ti­tled to one large snick­er in my gen­er­al di­rec­tion.
 
Flashback · I got an email from Phost, who works for Sun in Bei­jing; it turns out that my disk bench­mark named Bon­nie (not Rus­sell Coker’s up­dat­ed Bon­nie++ but my orig­i­nal 1990 ver­sion — argh, that page is hor­ri­bly un­main­tained) has been part of the So­laris Hard­ware Com­pat­i­bil­i­ty Test Suite for years, and it need­ed some up­dates, and they’d made them, and they sent it to me and asked what I thought. So I popped it open in Emac­s, what a weird feel­ing, all of a sud­den it was 1989 and I was sit­ting in an of­fice at the Univer­si­ty of Water­loo. Any­how, I sug­gest­ed a lit­tle mod to the mods and sent it back. Giv­en that I sus­pect the core se­man­tics of Unix-style filesys­tems are not apt to change for, well, I can’t imag­ine how long, I re­al­ize Bon­nie is cer­tain to out­live me. Sober­ing.
 
Genx Status · This is the per­ma­nent sta­tus page for Genx (tar­ball · docs). Genx is a li­brary, writ­ten in the C lan­guage, for gen­er­at­ing XML. Its goals are high per­for­mance, a sim­ple and in­tu­itive API, and out­put that is guar­an­teed to be well-formed; the out­put is al­so guar­an­teed to be Canon­i­cal XML, suit­able for use with digital-signature tech­nol­o­gy. There is a Python wrap­per. Genx comes with a GPL-Compatible but non-viral Open-Source li­cense. Lat­est news: In pro­duc­tion, car­ry­ing hun­dreds of thou­sands of sub­ti­tles per day; think­ing of tak­ing off the “beta” stam­p ...
 
Java Coalface Notes · I man­aged to ig­nore Atom for a few hours this week and get back to work­ing on project Zep­pelin, which leads to a few thoughts on ob­ject trans­mis­sion, con­cur­ren­cy, Jython, and oth­er stuff of pos­si­ble in­ter­est to hands-on Ja­van­s ...
 
Last First Program? · I just wrote my first Python pro­gram. It oc­curs to me, giv­en the gen­er­al­ly grey colour of my beard, that this may be the last time I learn a new pro­gram­ming lan­guage. Which, frankly, would be OK, it’s re­al work. This thing scans all the feeds com­ing out of Plan­et Sun us­ing Mark Pilgrim’s Univer­sal Feed Pars­er, de­tects any that have changed in the last day, and pings we­blogs.­com, tech­no­rati.­com, and blo.gs to let them know. (Ques­tion: who else should be pinged? An­swer: thanks to the many peo­ple who wrote about Ping-o-matic; doesn’t quite fit our bil­l, but in­ter­est­ing.) It’s on­ly 57 lines of code, but I had to learn a mod­est amount of Web wran­gling, string mung­ing, time arith­metic, and da­ta struc­ture walk­ing to get it go­ing. I sus­pect it’s not a very good Python pro­gram, but I can live with that. If you’re go­ing to scale the Python­ic slopes, you’ll need one brows­er tab open to Dive In­to Python, an­oth­er to the Python Tu­to­ri­al, a shell win­dow handy where you can type things like py­doc time, and a non­triv­ial chunk of Python code in a near­by ed­i­tor buffer (I used the Feed Parser) so you can look up id­iom­s. At the end of the day, the code looks dis­tinct­ly weird to my eye, kind of ragged with­out a sup­port­ing vi­su­al lat­tice of {’s }’s, and ;’s. But I’m sure you get used to it quick­ly.
 
NetBeans · I’ve been us­ing NetBeans to in­flate the Zep­pelin, and you know what, it’s not bad. The Mac in­te­gra­tion could be a lit­tle bet­ter, but a whole lot of things I need to do are one keystroke away. It runs plen­ty fast enough on the Pow­erBook (mind you, on­ly a few thou­sand lines of code so far). JUnit’s right there, which is nice. The de­bug­ger makes it a lit­tle too hard to to keep an eye on class vari­ables, but aside from that does about what I need; when I was driv­en to “print” state­ments the oth­er day I was fight­ing a com­plex sock­et con­ver­sa­tion be­tween two ma­chines where one side sud­den­ly start­ed see­ing EOFs and I couldn’t even tell which side was wrong, I’m not sure there’s a de­bug­ger in the world that would have been much help there. Now all I need is to get Jython in­te­grat­ed, and we’re mak­ing progress on that, stay tuned.
 
A Really Satisfying Feeling · Go­ing through a bunch of source-code files and and, one by one, re­mov­ing the dozens of “print” state­ments that let you fo­cus in tighter and tighter and tighter on a re­al­ly ob­scure prob­lem un­til you could fi­nal­ly see it. De­bug­gers are OK, but when the go­ing gets tough, the tough use “print”.
 
Yet Another TDD Sermon · I’ve preached here be­fore (more than once) about the virtues of Test-Driven Devel­op­ment (TDD), but nev­er giv­en it top billing, so here goes. Over the last twen­ty years I’ve seen the rise of Struc­tured Pro­gram­ming and Object-Oriented Pro­gram­ming and Mes­sage Pass­ing and the Re­la­tion­al Model and those are all good things, but TDD is the sin­gle biggest ad­vance in my life­time. It might (fi­nal­ly) turn soft­ware from an amateur’s kitchen to an en­gi­neer­ing dis­ci­pline. Here­with some more anec­do­tal ev­i­dence, and prac­ti­cal ad­vice for Soft­ware Devel­op­ment man­ager­s. [Up­dat­ed with point­ers to PyUnit, NUnit and PHPUnit.] ...
 
Coding Makes You Dumb · I quote from an ar­ti­cle in this week’s Economist (read it here if you’re a sub­scriber) ar­gu­ing that the neg­a­tive im­pact of “Offshoring” is ex­ag­ger­at­ed. The rea­sons we need not wor­ry in­clude ... the bulk of these ex­ports will not be the high-flying jobs of IT con­sul­tants, but the mind-numbing func­tions of code-writing. [Up­date: my first cut of this had a snarky aside, but I de­cid­ed to lose that and let the as­ser­tion above stand or fall with­out com­men­tary.]
 
Genx Alpha · I just post­ed a Genx tar­ball; the doc­u­men­ta­tion is sep­a­rate­ly avail­able here. This is Al­pha code, not be­cause it’s all that bug­gy (it doesn’t do that much, af­ter al­l) but be­cause it’ll quite like­ly change once some oth­er smart peo­ple see the prob­lems I haven’t. There are quite a few de­par­tures from the de­signs I post­ed ear­li­er and where the en­su­ing dis­cus­sion got to, sim­ply be­cause I’ve now writ­ten the code; and I’m nev­er smart enough to un­der­stand the prob­lem un­til I’ve writ­ten the code. For those who care about such things, dis­cus­sion will prob­a­bly be most­ly on the XML-dev mail­ing list. Genx cur­rent­ly has an ultra-minimal copy­right state­ment but I plan to adopt the lat­est rev of the Apache copy­right be­fore I do an­oth­er re­lease. [Up­dat­ed: Oop­s, tar­ball was mis-placed; it’s there now.]
 
Writing Genx · In be­tween beach time and rain­for­est time, I’ve been cod­ing away on genx; here­with some im­pres­sions with one im­por­tant les­son and an in­ter­est­ing bit of his­to­ry ...
 
Genx · It seems there’s some con­sid­er­able de­mand for a C-callable API which will write XML safe­ly and ef­fi­cient­ly. I sketched out an in­ter­face de­sign which you may pe­ruse here; I think it’ll be pret­ty self-evident to the C-literate. It com­piles and I wrote and test­ed the genxS­canUTF8() method, so it’s not en­tire­ly va­por. Upon con­sid­er­a­tion, I think it will be vir­tu­al­ly no ex­tra work to make it emit Canon­i­cal XML, ready to be signed, sealed and de­liv­ered (and Rich Salz said he would help) so why not? Ma­jor thanks to An­tho­ny J. Starks for the name—I am not a mem­ber of Gen X my­self, but I do share a city with Cou­p­land, so there you go. Since on­go­ing doesn’t have com­ments, I’ll post a point­er to this item over in the xml-dev mail­ing list, which is a nat­u­ral place to dis­cuss it. It would be very sur­pris­ing if this first-cut sketch didn’t con­tain some stupid er­rors, so go get ’em.
 
On Writing XML · In a re­cent es­say I of­fered, giv­en de­mand, to au­thor some XML-writing soft­ware. There’s been quite a bit of feed­back, and the con­sen­sus seems to be that the Ja­va com­mu­ni­ty is fair­ly well-served with XML writ­ing soft­ware, but that this would be re­al use­ful at the C lev­el. So that’ll be my cod­ing fun for the month of Fe­bru­ary. The rest of this es­say lists some of the Ja­va op­tions that peo­ple told me about, and in­tro­duces some is­sues around the C im­ple­men­ta­tion ...
 
The Three-Legged Future · There’s a re­al in­ter­est­ing note from Camp­bell and Swigart lament­ing the fact that, down in the cod­ing trench­es, the worlds of ob­jects and of RDBMSes and of XML are far from uni­fied, and that at­tempts in that di­rec­tion have been less than en­thralling. I think we just have to get used to it, and from here on in, the prac­tice of soft­ware en­gi­neer­ing is a three-legged dis­ci­pline ...
 
Do Databases Suck? · A cou­ple of month ago I was writ­ing about a C cod­ing project; that code is now wired in­to the 4.1 re­lease of Visu­al Net, which comes out some­time ear­ly next year, and there’s an in­ter­est­ing op­ti­miza­tion les­son or two buried in there ...
 
Millennial C · Re­cent­ly it be­came ob­vi­ous that the Visu­al Net data-prep and index-build sub­sys­tems need­ed refac­tor­ing, and I took on the job. So I’ve been up to my el­bows in heavy C cod­ing for a week now—my first such ex­cur­sion this mil­len­ni­um. Here­with some ex­treme­ly tech­ni­cal low-level notes on the sub­jec­t, prob­a­bly not of in­ter­est to non-professionals, ex­cept per­haps for a para­graph on the world-view of the ag­ing coder. There is some dis­cus­sion of XML and scal­ing is­sues ...
 
Selecting Fast · This is a pro­gram­ming war sto­ry with a moral that I think is is im­por­tant for those who care about their code run­ning fast ...
 
Ouch 32 · I just had a big Visu­al Net in­dex up­date blow up be­cause the da­ta struc­tures got to be big­ger than 231 bytes (on­ly a cou­ple mil­lion record­s, but each with lots of wordy text and tons and tons of meta­data). We’re OK, the so­lu­tion is to use the more ex­pen­sive 64-bit iron, but this does mark a turn­ing point ...
 
Perl Angst · Perl is such a great lan­guage, ex­cept for when it’s not. There’s this prob­lem, which is best il­lus­trat­ed by ex­am­ple: a col­league came in­to my of­fice with a testy ex­pres­sion and said “You wrote this; what the $#@!%! does it do?!?” I told him I’d get right back to him. [Up­date: I get spanked.] ...
 
Nifty Javascript Pattern · At work, we’ve been putting a lot of time in­to what used to be called “Dynamic HTML,” i.e. mak­ing web pages more dy­nam­ic and live­ly with a va­ri­ety of Javascript tech­niques. There’s this one de­sign pat­tern that keeps turn­ing up, and for those who aren’t al­ready JS hack­s, it may be worth steal­ing. Il­lus­trat­ed with pret­ty pic­tures ...
 
Loopy · I read, via Don Box, Jan Gray’s mon­u­men­tal piece about per­for­mance of man­aged code in .NET. If you care about per­for­mance in gen­er­al it’s a good read. This pro­voked a lot of thought and I’ll write more, but al­so sug­gest­ed a spe­cif­ic cod­ing tech­nique for mak­ing loops faster; I tried it out and it failed the first rough-cut test, but sug­gests an im­prove­ment for fu­ture lan­guage de­sign­s. (Warn­ing: in-the-trenches geeky.) (Up­date: on it­er­a­tors and dy­nam­ic lan­guages and Ja­va and C#, with more bench­mark­s.)
(Up­date: massively-erudite write-up from Erik van Koni­j­nen­burg.)
 ...
 
On Software Performance · This is pro­voked by a mon­u­men­tal es­say over on MSDN by Jan Gray en­ti­tled Writ­ing Faster Man­aged Code: Know What Things Cost. I think peo­ple who care about per­for­mance in mod­ern pro­gram­ming en­vi­ron­ments, even those who don’t plan to go near the .NET CLR, ought to read this. A bunch of re­ac­tions and ob­ser­va­tions at vary­ing lev­els of meta-ness ...
 
Language Fermentation · If you're a pro­gram­mer, I think you're luck­y, be­cause this is an ex­cit­ing time we're liv­ing in: there's some pow­er­ful in­tel­lec­tu­al fer­ment in progress out there. This may be the gold­en age of pro­gram­ming, as Paul Gra­ham ar­gues, and maybe ev­ery­thing we thought we knew about strong typ­ing is wrong. Here­with a bit of sur­vey­ware with a touch of de­bunk­ing and a prac­ti­cal foot­note on Ja­va ex­cep­tion han­dling. (Warn­ing: geeky.) (Up­date May 9, good feed­back on Ja­va Ex­cep­tion­s.) ...
 
I Was Going to Write About Programming Languages · Be­cause there've been a cou­ple won­der­ful es­says pub­lished re­cent­ly about test­ing and typ­ing and oth­er deep stuff, and of course it's not long since Paul Graham's ex­cel­lent The Hundred-Year Lan­guage. But when I hit Paul's site to grab the hundred-year URI, what do you know but he's post­ed an­oth­er one, Hack­ers and Pain­ters, and now I'm go­ing to have to think some more be­fore I write on this sub­jec­t. Se­ri­ous­ly, check it out.
 
Lap to Lamp · A slight re­work this evening for on­go­ing, most vis­i­ble in the side­bar ma­te­ri­al to the left and right. The pre­vi­ous cut was Lin­ux/Apache/Per­l, this one adds Mysql to the mix. But the LAMP acronym comes up short, there re­al­ly ought to be an X in there for XML, time for Udell to think up some­thing. I thought it might be in­ter­est­ing to write up some of the de­sign is­sues, but then I de­cid­ed no, that wouldn't be in­ter­est­ing at al­l, so this is just to ask for feed­back if I've bro­ken any­thing, make a cou­ple of gen­er­al ob­ser­va­tion­s, and note that I now hate SQL much less ...
 
The Joy of Refactoring · I want­ed to make some changes to the code that gen­er­ates on­go­ing (s­tand by: re­design in­com­ing), and this re­quired some fair­ly se­ri­ous refac­tor­ing. Re­fac­tor­ing is right at the cen­ter of good cod­ing prac­tice; pro­gram­mers of­ten bend over back­wards to avoid it, which is al­most al­ways wrong. This theme shows up in the best writ­ing on the subect go­ing back decades, and il­lus­trates an even more cen­tral les­son about soft­ware de­vel­op­men­t ...
 
On Hating SQL · The ini­tial cut of the soft­ware that drives on­go­ing is not scal­ing well as the num­ber of es­says grows, and it's keep­ing me from mak­ing a cou­ple of changes I have in mind. So, I'm stum­bling from LAP­dog to LAMP­light sta­tus, that is to say adding Mysql to the ex­ist­ing Lin­ux/A­pache/Perl soft­ware ba­sis. Which means that there are splodges of SQL dot­ting my perl code like zits on a teenage face. In the­o­ry, I like SQL a lot. In prac­tice it re­volts me, and I'm not sure why ...
 
In the Perl Mines · I spent most of Fri­day grind­ing out Perl code to pull da­ta out of six dif­fer­ent big Ex­cel spread­sheets and in­te­grate it and cross-match it and feed it in­to one of our maps. It gets hard­er to code as you get old­er, but there are re­ward­s ...
 
Writing the Hard Line of Code · When I'm writ­ing code, and build­ing some­thing com­pli­cat­ed, there's this place I usu­al­ly get to where I'm about to write "the hard line of code". Usu­al­ly, I've just fin­ished set­ting up a bunch of code to ag­gre­gate the da­ta I need both to read and up­date, get­ting the locks I need, and oth­er house­keep­ing chores, and now I're go­ing to write the com­pli­cat­ed bit of arith­metic or re­al­ly sub­tle con­di­tion­al that's go­ing to com­pute the out­come val­ue or de­cide whether to in­clude the record or what­ev­er the goal is. I al­ways pause in­vol­un­tar­i­ly and lean back. Then one of a few things hap­pen­s:
 
author · Dad · software · colophon · rights
Random image, linked to its containing fragment

By .

I am an employee
of Amazon.com, but
the opinions expressed here
are my own, and no other party
necessarily agrees with them.

A full disclosure of my
professional interests is
on the author page.