Sunday, February 9, 2014

Language Functionality

I like to think of myself as adaptable. Having said that, I've been living in the Java stack for quite some time & am perhaps too comfortable in a strictly OO world.

To prove adaptability in the extreme, I've taken to a functional bent with my programming. If you don't know why anyone would deviate to functional, some light reading might help:
I decided to implement a problem in several languages that I am only now learning to use in a serious sense, each with some level of functionalism (picked at random):
  • Java 8 (beta)
  • Java with Guava
  • Scala
  • Ruby
  • Groovy
  • Python
I don't want to get into the nitty-gritty of comparing the languages, as such, because that's not the point, except to say that Java is not functional, & therefore adding the Guava libraries to it doesn't make it so.

I started each dev task with a perusal of simple tutorials to orient myself in the language. In the case of Scala, that was already aimed at Java devs (thankfully), & in the case of Ruby & Groovy, I left off the Rails/Grails bits for later.

I kept thinking "Oh, this language's approach is like that language except for ..." & then it dawned on me that each of the languages actually had their own distinct (if only slightly different) approach to doing exactly the same thing.
It got to a point of being annoying. I could take the structure of a Scala class & turn it into a Ruby class, & there would be line equivalences in almost all cases - but each line would be different. The symbols for making lists or maps or key-value pairs would have to change, the names of simple methods would change (key?, containsKey, etc), to the point where a cursory examination would elicit the question "How are these languages different?", yet a thorough examination would rather ask "WHY are these languages different??"

My answer? I don't know. I honestly don't. It's easy enough for a proficient professional to learn one of these languages quite quickly given another, but what do they gain in doing so? Most of the list have been ported to the major operating systems (with varying degrees of usefulness).
I even managed to get some joy out of developing my solutions from within the one IDE (eclipse with a lot of plugins, coercion & stress - & some loss of functionality).

But then, haven't we already gone through this - if you take C++ & Java, you can look at the implementation of methods & see strong correlations (fundamentally procedural), but the structure of a solution will likely vary because of specific things you can & can't do in their object-orientedness - inheritance being a classic difference.

My point? We keep trying to reinvent the wheel by using different materials to create smoothness or hardness or roundness, but it's still a wheel, & it's well past time we got on with inventing hover boots.

No comments:

Post a Comment