Showing posts with label JVM languages. Show all posts
Showing posts with label JVM languages. Show all posts

Wednesday, November 20, 2013

geeky Cucumber



Our GeekyBookClub is the best! Last night was a perfect illustration. TheHackerCIO came in totally unprepared. Unread Chapters. No time to read them. Too much client Hacking this week. Plus the Bus. Dev for the coming year!

Some would be intimidated by going to a book club, especially where the reputation of the club members is so high. I've heard that this is a "Guru's group."

TheHackerCIO is intrepid. Guru's don't intimidate.  Plus, we completely lack Prima-Donnas in the group anyway!

So, we had a wonderful time. Earl, as always, had performed the reading with his usual highlighting of every relevant passage and lots of sticky tabs along the edge to locate them the faster. Thank Deity for the "Earls" of the world.

The way we structure our club, members "bid" the page number of their next comment or question. The lowest bid wins. It makes everything flow along smoothly. We also allow backtracking to pages covered in prior meetings.  Which means that next week, when I get caught up on the reading, I'll be able to revisit everything that I just got a nice conversational and high-level introduction to at last nights Meetup.

In Chapter 5 we noted with interest the principle that:

 DAMP (Descriptive and Meaningful Statements)  
trumps DRY (Don't Repeat Yourself), 
when writing examples, because readability is paramount.

Someone remarked about the "bug magnet" -- that they had heard of a chick-magnet, but not a bug magnet. There was a general consensus that chick-magnets were preferable.

One member is moving away from a proprietary CMS to Magnolia, which came top of list, for:

  •  working easily, 
  • runs locally, 
  • doesn’t have to be deployed on a dev environment.
Which puts it onto the radar for consideration, at least by me.

Our local Groovy bigot held forth about the wonders of that JVM language, in support of closures. He expressed his wonder and indignation at Java's implementation of lambda expressions versus the superior work in Groovy. TheHackerCIO needs to get more into Groovy to follow this, but for those geeks interested and not in-the-know, here is the difference between a Lambda and a Closure:

A Closure has access to the static variables.

That is to say:

1. a Closure:
x=5
y=7
Z = {a, b : (a+x * y +z)}

2. A Lambda is the same as above, but without access to the static x, y which are now out of scope.

Then they discussed "Gstring", which is apparently another Groovy idiom, and not a racy nightclub exhibit. It's some kind of a templating expression language that will fit into a string to replace items.

I asked for the best book/resource to learn Groovy, and was recommended this:



The Definitive Guide to Grails 2, by Greame Roche, which apparently covers Groovy in an appendix which should be read first. Going by what the reviewers say, anyway. 

Then we started discussing Clojure (yes, Clojure the functional language, not to be confused with closures, the functional programming idiom that, when called returns another function)

We talked a bit about how Clojure is so hard to follow/read, at least for us, mere mortals. I remarked about how nice it would be to work with the smart people who DO work in it, for instance the people at Factual. And we got this capper:

"Clojure is ok when the system is small enough to be retained entirely in the head. When it outgrows that, or a mere moral must deal with it, it collapses." A whole lot of wisdom is contained in that epigram.

And for that Wisdom I am Grateful to the GeekBookClub Members &

I Remain,

TheHackerCIO



Wednesday, November 6, 2013

Can Natural Language be Groovy?



Groovy is not just the mantra of Hippies from the 60s. It's also a jvm language, sometimes referred to as java++. Last nights presentation by Jim White, at the LAJUG was on Groovy, specifically as used to perform natural language processing (NLP), or computational linguistics (CL).

TheHackerCIO is only peripherally knowledgeable about groovy.

From what I saw of it, it seemed like java without a semicolon terminating a line.

But that is just the starting point. From there, they have added a number of features from other programming languages to make you a more productive programmer. It looks worth taking a more detailed look at. Because the speed of agile prototyping possible in the untyped world is so overwhelmingly fast by comparison to the java world, and anything I can get that would give me that edge, while building on the type safety and huge ecosystem of the java frameworks world, is something that bears further serious investigation.

Jim's claim is that Groovy affords the most productivity possible to the Java programmer while building on what he already knows. That's a pretty compelling sales job!

He pointed out the use of the traditional shebang from Unix, so that a groovy script can easily invoke the groovy shell thusly:

#!/usr/bin/env groovy

which, as java programmers know, could not be the first line of a java program, but which is fine in groovy, and allows direct unix command line invocation of a script without the need to set environment variables and then compiling and executing.

I always like to follow along with a presentation, so if you are doing likewise, you can install the GVM (Groovy enVironment Manager) with a curl command:

curl -s get.gvmtool.net | bash

followed by:

gvm install groovy

this will allow you to enter and run this simple shell program:

#!/usr/bin/env groovy
System.out.println("Hello, world")
which can just be chmod-ed and run from the command line.

Groovy, apparently, has lots of interesting features to munge data.

And the quotation of the presentation was:
"Most of the work in CL is in fricking around with formats!"
Which is why Jim found groovy so helpful in his Graduate work.

I learned about two operators in Groovy, pulled from other languages:

1. The spaceship operator: <==> [name derived from resembling Darth Vader's ship]
2. The Elvis operator:        ?:       [name derived from resembling Elvis' hair]

both named after various resemblances. But you'll need to follow the links if you want to know more, because I've run over the limit on this posting already.

I Remain,

TheHackerCIO

Sunday, September 22, 2013

Why Losing Your House and Lisp-JVM Are Unrelated

Web sites are a great way to learn new languages. They offer a prebuilt compiler with a web input interface, so there's nothing to install to start learning. Plus, some sites offer Programming Koans, not to be confused with Hacker Koans. A programming Koan is a problem designed to test your ability to code and help teach you a particular language feature.

Yesterday, I mentioned how TheHackerCIO is learning Clojure, a functional language on the JVM. In fact, Clojure is a Lisp for the JVM. Again, the motivating reasons for this will have to await a future post. But the online Koans are a wonderful way to learn Clojure. They also will introduce the reader to a wonderful type of learning site.

So direct your browser to the 4Clojure site -- a site derived from Clojure-Koans -- as you continue to read my blog. Scroll down on the home page, to the section titled:

So wait, I can't buy cheap real estate here?

So now you will understand the cryptic title of this blog post! The 4clojure site says:

 "At this time, 4clojure.com does not provide information regarding the sale of foreclosed homes, and has no plans of doing so in the future."

which explains Why Losing Your House and Lisp-JVM Are Unrelated!
On the site, which you should set up a free account and start playing with, you will find:
  1.  a problem, stated in text, 
  2. a test suite of 2 -4 tests, and 
  3. a section for code entry.
when you enter the section of code, and click the "Run" button, the test suite will be used to test your answer code, and will graphically indicate pass or fail (green vs. red). When you correctly answer a Koan, your status will be updated, so you can track your progress by the number of problems you have correctly answered. You can also see top answerers, so there is a social component to it. 

Enjoy learning about Koans! And Clojure!

I Remain,

TheHackerCIO