{"id":238,"date":"2009-01-17T15:58:18","date_gmt":"2009-01-17T20:58:18","guid":{"rendered":"http:\/\/dilettantes.code4lib.org\/?p=238"},"modified":"2009-01-17T17:03:32","modified_gmt":"2009-01-17T22:03:32","slug":"im-only-here-for-the-closures","status":"publish","type":"post","link":"https:\/\/rossfsinger.me\/blog\/2009\/01\/im-only-here-for-the-closures\/","title":{"rendered":"I&#8217;m only here for the closures"},"content":{"rendered":"<p>I am not a programmer.<\/p>\n<p>Since I first began writing code, my approach to learning a new language has been to take something that does the sort of thing I am looking for and start fiddling, seeing the results of the fiddling (most likely through some sort of error message) and refiddle until I start seeing the outcome I was looking for.\u00c2\u00a0 In mechanical terms, I open the hood, get out my biggest wrench and start whacking at things until the noises stop.\u00c2\u00a0 Or, in this case, start.<\/p>\n<p>The arc of languages I primarily worked in at any given time is a pretty good reflection of this approach:\u00c2\u00a0 Perl, TCL, PHP, then Ruby with a small foray into Python.\u00c2\u00a0 All dynamic, all extremely whackable.\u00c2\u00a0 Where whacking doesn&#8217;t work, Google (or, previously, Yahoo or, previously, Alta Vista) generally does.\u00c2\u00a0 Cut, paste and resume whacking.<\/p>\n<p>The same philosophy applies when it comes to developing new projects.\u00c2\u00a0 I know, basically, what I want on the other side, but I have absolutely no idea what it will take to get there.\u00c2\u00a0 Generally this means I&#8217;ll pick up the nearest tool on hand (usually a red colored wrench) and start whacking until I see what I want.\u00c2\u00a0 That the red wrench isn&#8217;t the right tool for the job isn&#8217;t the point, since I&#8217;m only looking for the destination, not the best route there (since I have no idea how to get there in the first place).\u00c2\u00a0 The more comfortable I get with a tool, the more likely I am to nest with it, since the detour of finding (and learning how to use) another tool slows me down from reaching the goal.<\/p>\n<p>The perfect example of this was <a href=\"\/projects\/the-wag-the-dog-web-localizer\/\">WAG the Dog<\/a>.\u00c2\u00a0 PHP was a ridiculous language to try to use for it, but <em>ping, ping, ping, ping<\/em>, it worked!<\/p>\n<p>So it stands to reason that I&#8217;ve never really taken to Java.\u00c2\u00a0 Java is not whacking.\u00c2\u00a0 Java is slowly, verbosely and deliberately constructing the specific parts you need to accomplish your goal.\u00c2\u00a0 Java is a toolbox full of parts and pieces I do not know the names of, what they do or how they would even do <em>anything<\/em>, much less the job I&#8217;m trying to accomplish.\u00c2\u00a0 Java is to my career what a Masters in Mechanical Engineering is to a wrench.\u00c2\u00a0 I don&#8217;t use Java because I don&#8217;t even know the questions to ask to get started in the right direction.<\/p>\n<p>The irony is that when I was hired by Talis, I was &#8216;assigned&#8217; (that&#8217;s a stronger term than really applies) to an entirely Java-based project, <a href=\"http:\/\/www.talis.com\/integration\/\" target=\"_blank\">Keystone<\/a>.\u00c2\u00a0 To this day, some 15 months later, I have contributed exactly 0.0 lines of code towards Keystone.<\/p>\n<p>I am not a programmer.<\/p>\n<p>However, I am a tinkerer.<\/p>\n<p>In an effort to eat our own dogfood, I had begun to write a <a href=\"http:\/\/jangle.org\/\" target=\"_blank\">Jangle<\/a> connector for our library management system, <a href=\"http:\/\/www.talis.com\/alto\/\" target=\"_blank\">Alto<\/a>.\u00c2\u00a0 Alto is built on Sybase and we already had a RESTful SOA interface, the aforementioned Keystone.\u00c2\u00a0 It would have been logical for me, <em>were I a real programmer<\/em>, to take Keystone, add some new models and routes and call it a connector.<\/p>\n<p>But that&#8217;s not how I roll.<\/p>\n<p>Initially, I took to using the <a href=\"http:\/\/jangle.googlecode.com\/svn\/trunk\/jangler\/\" target=\"_blank\">JangleR<\/a> Ruby framework to build the Alto connector, since all it would require is to query the appropriate tables and <em>ping, ping, ping, ping<\/em> things until <a href=\"http:\/\/jruby.codehaus.org\/\" target=\"_blank\">JRuby<\/a> and <a href=\"http:\/\/caldersphere.rubyforge.org\/warbler\/\" target=\"_blank\">Warbler<\/a> could give me a .war file.<\/p>\n<p>Sybase, however, does not take well to whacking.\u00c2\u00a0 Especially from Ruby.\u00c2\u00a0 <a href=\"http:\/\/jruby-extras.rubyforge.org\/ActiveRecord-JDBC\/\" target=\"_blank\">ActiveRecord-JDBC<\/a> didn&#8217;t work.\u00c2\u00a0 Not sure if it was our particular schema or JDBC setup or just ActiveRecord, but no dice.\u00c2\u00a0 I couldn&#8217;t get <a href=\"http:\/\/olabini.com\/projects\/ribs\/doc\/\" target=\"_blank\">Ribs<\/a> to work at all, which is just as well, probably.\u00c2\u00a0 Finally, I had success just using java.sql objects directly in JRuby, but, since I really didn&#8217;t know what I was doing, I started worrying about connection pooling and leaving connections open and whatnot.\u00c2\u00a0 No need to show off that I have no idea by gobbling up all the resources on some customer&#8217;s Alto server.<\/p>\n<p>At one point, on a lark, I decided to try out <a href=\"http:\/\/grails.org\/\" target=\"_blank\">Grails<\/a>, <a href=\"http:\/\/groovy.codehaus.org\/\" target=\"_blank\">Groovy<\/a>&#8216;s web framework inspired by Rails, to see if I could have more luck interacting with Sybase.\u00c2\u00a0 My rationale was, &#8220;Keystone uses <a href=\"http:\/\/www.hibernate.org\/\" target=\"_blank\">Hibernate<\/a>, <a href=\"http:\/\/grails.org\/GORM\" target=\"_blank\">GORM<\/a> (Grails&#8217; ORM) uses Hibernate, maybe it will work for me!&#8221;.\u00c2\u00a0 And, it did.<\/p>\n<p>So here I am, one week into using Groovy.\u00c2\u00a0 Just like I used Rails as an introduction to Ruby, Grails serves that purpose with Groovy pretty well.\u00c2\u00a0 I can&#8217;t say I love the language, but that&#8217;s purely my bias; anything that isn&#8217;t Ruby, well, isn&#8217;t Ruby.\u00c2\u00a0 I am certainly doing some thing inefficiently since I am learning the language as I go along.\u00c2\u00a0 The fact that there just isn&#8217;t much documentation (and the existing documentation isn&#8217;t all that great) doesn&#8217;t help.<\/p>\n<p>For example, none of my GORM associations work.\u00c2\u00a0 I have no idea why.\u00c2\u00a0 It could very well be the legacy Sybase schema, or I might be doing something wrong in my Domain Model class.\u00c2\u00a0 I don&#8217;t have any idea and I don&#8217;t have any idea where to look either for an appropriate error or for a fix.\u00c2\u00a0 It&#8217;s not a huge issue, though, and so far I&#8217;ve just worked around it by writing methods that do roughly what I would have needed the associations to do.\u00c2\u00a0 <em>Ping, ping, ping<\/em>.<\/p>\n<p>I also cannot make Services work the way they show in the documentation.\u00c2\u00a0 My controllers can&#8217;t find them when I do it like the docs, my domain models can&#8217;t find them when I do it like the doc&#8230;\u00c2\u00a0 But it&#8217;s no big deal.\u00c2\u00a0 I set my methods to be static, call the class directly, and everything works fine.\u00c2\u00a0 I&#8217;m not doing anything remotely sophisticated with them, so I can keep my hacks for now.<\/p>\n<p>Being able to dynamically load Java classes, iterate over things with a call like <em>foo.each { bar = it.baz }<\/em> is pretty nice.\u00c2\u00a0 I am really amazed at what Groovy offers when it comes to working with Java classes, it&#8217;s like being able to audit those M.E. Master&#8217;s classes.\u00c2\u00a0 I am learning a considerable amount about Java by being able to whack away at objects and classes within the Groovy shell.<\/p>\n<p>I&#8217;m not sure that Groovy was really intended for people like me, however.\u00c2\u00a0 All of the documentation and even some of the syntax seem to have the expectation that you are a Java developer looking for something dynamic.\u00c2\u00a0 It reminds me of a Perl developer going to PHP.\u00c2\u00a0 They are syntactically and functionally similar.\u00c2\u00a0 In many ways, a Perl developer will find PHP an easier language to use to get a simple, running web application.\u00c2\u00a0 And they always have the fallback of Perl, if they need it.\u00c2\u00a0 A Python developer that has to use PHP will probably curse a lot.\u00c2\u00a0 Groovy seems to have the same sort of relationship to Java.\u00c2\u00a0 A Java developer would probably immediately feel comfortable and find it amazingly easy to get up and running.\u00c2\u00a0 A Ruby developer (well, this Ruby developer) finds it a little more alien.<\/p>\n<p>Groovy doesn&#8217;t have a tremendous amount of native language support for specific tasks, relying instead on the vast amount Java libraries out there to do, basically, anything.\u00c2\u00a0 This makes perfect sense and I don&#8217;t fault Groovy in the slightest for this choice, but relying on Java for functionality means factories and stream buffers and all the other things Java consists of.\u00c2\u00a0 Java developers would feel home.\u00c2\u00a0 I find it needs some getting used to.<\/p>\n<p>Also needing to declare your variables.<\/p>\n<p>And I&#8217;m sure I&#8217;m not really using closures to their fullest potential.<\/p>\n<p>Overall, it&#8217;s nice to have this new addition to my toolbox.\u00c2\u00a0 Groovy is definitely whackable and development for the Jangle connector has been remarkably fast.\u00c2\u00a0 I expect the <a href=\"http:\/\/www.talis.com\/list\/\" target=\"_blank\">Aspire<\/a> (n\u00c3\u00a9e List) and <a href=\"http:\/\/www.talis.com\/prism\/\" target=\"_blank\">Prism<\/a> teams to have something to try out by the end of the month.\u00c2\u00a0 And for basically being Java, that ain&#8217;t bad.<\/p>\n<p>When and if I rewrite the Alto connector, I&#8217;ll probably opt for <a href=\"http:\/\/groovy.codehaus.org\/GroovyRestlet\" target=\"_blank\">GroovyRestlet<\/a> over Grails, but I definitely couldn&#8217;t have gotten where I have at this point without the convention and community of Grails.\u00c2\u00a0 It&#8217;s a really good starting point.<\/p>\n<p>Of course, none of this would have been necessary if it wasn&#8217;t for Sybase.\u00c2\u00a0 Consider this day one of my campaign to eventually migrate Talis Alto from Sybase to <a href=\"http:\/\/www.postgresql.org\/\" target=\"_blank\">PostgreSQL<\/a>.\u00c2\u00a0 <em>Ping, ping, ping.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am not a programmer. Since I first began writing code, my approach to learning a new language has been to take something that does the sort of thing I am looking for and start fiddling, seeing the results of the fiddling (most likely through some sort of error message) and refiddle until I start [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,55,54,8],"tags":[],"class_list":["post-238","post","type-post","status-publish","format-standard","hentry","category-coding","category-grails","category-groovy","category-philosophizing"],"_links":{"self":[{"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/posts\/238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/comments?post=238"}],"version-history":[{"count":9,"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/posts\/238\/revisions"}],"predecessor-version":[{"id":247,"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/posts\/238\/revisions\/247"}],"wp:attachment":[{"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/media?parent=238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/categories?post=238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rossfsinger.me\/blog\/wp-json\/wp\/v2\/tags?post=238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}