RSS

Tag Archives: clojure

Is the JVM a viable release platform?

I have written a number of server applications based on Sun’s JVM and luckily for me I have not had to code anything beyond a few interview questions under Oracle’s stewardship. In the last year or so Oracle has released two versions of it’s JVM with well publicized security holes. Normally this sort of thing would go unnoticed or at least pass quietly so what does it mean?

Back in the day when Sun was touting the benefits of Java it was “rewrite once and run anywhere”, “the network is the computer” and security. Whether “security” is defined by phone home, crypto, private and protected modifiers… or the effects of recent attacks you really have to start thinking about Java a little differently.

So when I watched an interview with Rich Hickey this weekend where he talked about Clojure, and by extension Datomic, just plugging into the JVM on your local machine I could not help but get a little concerned. First of all while Clojure is interesting and probably functional and plenty of first-class implementations of things… the hangers on and other libs still use basic JDK libs thus infecting the pure implementation(see that Lift embeds Jetty). And while Clojure is supposed to implement similar read-only features of erlang and other functional languages… what happens when the JVM is attacked sideways?

I like java for what it is and what it might be again. I categorically disagree with some of the language features that are clearly designed for the proprietary sect of this business. And frankly so many more have accomplished much more with less effort using dynamic languages like Ruby, Perl and Python.

One of my strongest beliefs is that in order to scale you need the following: (a) a reasonable ROI on the initial development. (b) ability to automate administration/deployment of the second wave of hardware. (c) ability to automate the automation of the crazy scaling where the application, infrastructure, and people scale organically. At the end of the day scaling must be achieved by applying the lessons of Henry Ford and the assembly line.

 
Leave a comment

Posted by on 2012/09/03 in architecture

 

Tags: , , , , , ,

Response to “Seven Languages in Seven Weeks”

Bruce Tate is a good writer and recently he published a book titled: “Seven Languages in Seven Weeks”. I do a lot of career development so I completely agree with the premise, however, the first place I get lost is the selection of languages:

  • Ruby,
  • IO
  • Prolog
  • Scala
  • Erlang
  • Clojure
  • Haskell

Initially there is nothing wrong with this selection. Tate tells the reader that the choices were made my asking his readers. And at first glance this might makes sense (blame the reader), however, it’s more dubious than that.

As I rebuked a recent blog for it’s survey results pertaining to Agile because the sample group were in relative social circles to the author. I believe the same can be said here. About the only thing in Tate’s favor, however, is that the words “practical” or “pragmatic” were omitted. Had they been present then I believe that the language selection might have echoed github’s language survey.

In hindsight I should have read the TOC before I purchased the book. I already had a cursory knowledge of Ruby, I’ve been coding erlang professionally for 3 years, prolog was deprecated when Borland’s Turbo Prolog was decommissioned, I’ve reviewed Haskell and it’s of no general interest… I think erlang got it right. And as the saying goes, “lipstick on a pig, it’s still a pig” when it comes to Scala and Clojure.

If it were my book I think the list would have been a little different:

  • go – the languages solves some concurrency and messaging issues in many other languages, it’s also statically linked.
  • erlang – lightweight processes, fast, has momentum
  • python 3 & perl 6 and PHP(Facebook) - These updates have been in development a long time. It’s critical to understand whether the new versions are worth the mid share or if they should be deprecated.
  • modern C or C++ -
  • groovy – It’s java lite and while I do not have any practical experience with it, since I do a lot of development in python, perl and ruby this makes sense in the JVM environment.
  • serverside javascript (NodeJS, MongoDB, etc) – another up and comer. This is probably more like a 1/2 week experience, however, just because you know browser javascript does not mean that you’ll be successful on the server side.
  • R – The google-ites and Facebook-ies are going crazy with analytics and now that the “social” aspect has entered just about every website tools that render information about the business are becoming critical. R has a great many tools to help out. Hopefully one does not need a Phd in math to be successful.

What sets my list apart from Tate’s is that they are look to the future. “Where are we going?” not “What’s slipped between the cushions?”

As a sidebar, I have another list that I think might be interesting: “Seven Frameworks in Seven Days”. You’re not going to become an expert in seven days but you might know enough to make a choice for your next project based on that experience:

  • TornadoWeb or Cyclone (python) – very capable frameworks but they are even driven.
  • Mojolicious (perl) – another event driven framework.
  • Sinatra (Ruby) – something to attract ruby-ists. It’s as capable as those above.
  • Limonade (PHP) – PHP is powering back up thanks to Facebook’s compiler.
  • Orbit (Lua) – Lua was conceived in the vacuum of Brazil and has an adopted home in World of Warcraft. At some point those programmers are going to want to break out of the game into the real world.
  • Snap (Haskell) – It’s fast.
  • Nitrogen (erlang) – interesting GUI, comet, baked right in.

One reason for the entries in this list is that the language portion of the exercise is trivial. Micro frameworks are not capable of running an enterprise but it’s low cost of entry is going to get things started so that your burn rate is smaller.

While Snap and Nitrogen are interesting in their own right that’s about it. They will not likely be here in 2 or 3 years but the ideas are great.

Thanks for reading.

 
Leave a comment

Posted by on 2011/12/20 in future

 

Tags: , , , , , , , , , , , ,

Clojure and Scala… again

[Update 2011-08-09: I am returning from a failure to install scala and clojure. I was able to install OpenJDK from the Ubuntu packages, however, I wanted to build ant from source. And that does not appear to be possible. Ant depends on JUnit and JUnit depends on Ant. This makes it impossible to install everything from source. What's worse is that the build instructions are so much worse than I remember. There was a time when I would install all my Java tools except the JDK and my commercial JDBC drivers by hand.]

I just watched a video presentation from one of the Twitter geeks and he was going on and on about the JVM. What make it interesting is that Twitter is moving from Ruby to the JVM, in fact everything is now written in Java or Scala; and there are some research projects in Clojure.

I was looking over my resume recently as I was reviewing my Java experience for a potential position. And with about 10 practical years experience from the first version of Java (1.02) until a few years ago… it was an uphill battle with most managers. Now “Java is the new Cobol” or “nobody ever got fired for using Java”.

I find myself looking back at dynamic languages with a little more interest. Perl and I have a long history and Python and I are getting there.

But I have some criticisms:

  • Eclipse was a wonderful project once. Now it’s total chaos.
  • NetBeans is a nice platform but with a little FUD I’m concerned about Oracle and eating your own dog food. We might not be getting the best tools from them.
  • There are other Java IDEs but they are expensive or single purpose. (IntelliJ’s Idea is $199 for an individual license; but it supports Groovy, Clojure, and Scala.)
  • I tried to install Scala and Clojure using packages, however, the version numbers were so far back that it’s scary. I have heard “please upgrade” too many times.

On the positive side I have a couple of books already. I’m sure they are good enough. I’m still a little bitter about the dependency on Java libs for Scala and Clojure but if you’re a functional programmer I think that Scala and Clojure are going to be easier to sell than Erlang or Haskell… as they are incremental steps (baby steps) and they still use the JVM.

So what is the plan or roadmap?

  • deploy jars and wars
  • instrument deliverables in a consistant way
  • use event driven design with MQs
  • watch your TPS rates in terms of events
  • log in a way that makes sense
  • plan to deploy in a cluster (see MQ)
  • plan to use 3 types of databases (OLTP, OLAP, DW)
  • use one-way replication in a rollup fashion
  • Keep it simple by making sure that the unit of work is something the average programmer can pick up.
  • Stay native. If you’re writing a Scala app then use Scala libs. And when you cannot, write it yourself. And when that’s not possible then use a Java version; and plan to write it when you can.

Scala and Clojure are going to get another shot real soon.

PS: and so I’ll probably launch a jar framework for application monitoring. Anyone want to play?

 
2 Comments

Posted by on 2011/08/09 in beta, ProgLang

 

Tags: , , , ,

What is the attraction to Function Programming?

In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state. -Wikipedia

I’ve been a programmer for 25+ years and back in the earliest days a lot of PC-based code was implemented in x86 assembler. Later on ‘C’ became the de facto standard yet we still counted CPU instructions and IO operations.

As the web evolved and programming languages have come and gone many of the oldies are still in play. In fact many of the benefits of functional programming languages are limited or obscured by the non-functional OS and systems they rely on. Both scala and clojure rely on Java’s JVM and they also depend extensively on standard old java libs, which are not functional, instead of replacing everything with native versions as one would expect.

Haskell and Erlang, on the other hand, while they are basically clean room implementations with few dependencies other than GCC and many of those libs; at some point in the stack they touch the libs for the OS. Erlang has the benefit that the libs and overall packaging seems contained and professional where Haskell seems more chaotic and scientific. Not that one is actually better than the other… Haskell’s Snap seems to be a better platform than Erlang’s yaws, webmachine or nitrogen.

Recently there was a post on slashdot in which an anonymous coward indirectly suggested the smartest programmers don’t work for Google. I’m sure there is truth to the statement but the description that this person gives of his day to day activities are no different than I have experienced depending on the circumstances. In fact it takes more balls and bravado than high IQ to hack trading systems in the way he described. In fact I dare say that the SEC might consider an investigation into this individual; while he might be smart, some day he’s going to write a patch that his bank cannot cash.

What initially attracted me to Erlang was it’s sigma references. It seemed to me that if a phone switch was to operate at 9-sigma then my bank software should too. Now that years and several applications have passed, all written in Erlang, I have come to the conclusion that sigma is not a good enough justification for a business application. And that it should be a business decision as to which language one implements the business in.

I think there are two main reasons why functional programming is popular: 1) because it is different. 2) because the smart guys are making a lot of money with it.

Just because you say you are “different” does not make you different wen you are standing in a crowd of people who are all different too.

In response to being “different”. There is no real justification here other than curiosity. There was a time when C and Pascal, forth competed for mindshare. In fact P-Code almost became the foundation for an operating system/platform but it never had the performance or mindshare. Once serious development began on *nix ‘C’ took hold although MS-DOS was still written in x86 assembler. And so were a number of desktop environments like TopView, DesqView and many others. C was low enough to let the programmers tinker and high enough to be useful for cross platform development. And easier to debug than assembler.

And as far as what the smart guys are doing… it also reminds me of a time when I almost went into smalltalk development. At the time consultants were making 100 – 150% more than the average programmer at the time. And while a lot of good work had been accomplished at the time. Where are these guys now? Where are their applications? Who is maintaining them?

As a side note; part of the reason why Microsoft invested in .NET was partly because they wanted to give their platform a name. Some way they could bolster OS, it’s development platform and the collective ego of the .NET certified programmer. Microsoft’s choice to alter java with J++ and moving everything to their CLR was all about mindshare.

I recall interviewing for a company that did datamining of personal information. I liked the idea and complexity of the problem, however, after making it through the interview process I was told that the position required that the programmer use their internal programming language. It was internal and proprietary. Needless to say I never accepted the position.

Yahoo is primarily a PHP shop. a) to be different from the other web properties. b) to keep their employees from jumping ship.

Google is primarily a python shop.  a) to be different from the other web properties. b) to keep their employees from jumping ship.

These companies have functional applications too. But why? Is it really worth the effort? Should we really re-tool for functional programming? Consider the amount of Java code that is out there. Why would anyone rewrite it in the functional fashion? Consider all of the non-functional code that we have come to rely on. Should we really rewrite it all in a functional environment (this is the only reason I like scala and clojure)

This topic makes my head ache.  There is no rational justification for the attention to functional programming. It’s just a game.

 
 

Tags: , , , , , , , , , ,

Concurrency on the JVM

I just purchase a couple of books from PragProg; Programming Clojure, Programming Scala, and Programming Concurrency on the JVM. (I’m starting to think that I already purchased the Scala book some time ago and that now I have  a dupe.)

As I’m about to embark on Clojure and Scala for the 2nd or third time I’m beginning with many of the questions I had when I started on Erlang and LUA. What does it mean to me? What is the current mindshare out there? Are there any real projects? Is there enough full-time and contract work out there to warrant even the cost of the books and the time lost reading them?

And that’s when I get really frustrated because Scala has a section on “intermixing with java” and then my head starts to spin as I remember that Lift-web (a webserver written in scala) is not really written in scala. It’s actually a combination of Scala and intermixed java (notably Jetty).

And right about there is when I lose my steam. When you are a fully vested java programmer and you know all 100B jar file filled APIs with all that it means to you… it’s hard to implement anything 100% native. So that’s the dark cloud hanging over Clojure and Scala. How can they implement all the functional goodness without getting twisted up by all that legacy poison? And so I read on.

[UPDATE: Scala and Clojure seem to intermix with Java a lot. I find this painful because I be not believe that there is a way to determine where the warts are automatically. It sure would be nice if there were some sort of dependency checker so that the graph provided some illumination before projects were implemented. Or at least some developers might contribute where the holes are. I'm about to put these books on the stack again.]

 
Leave a comment

Posted by on 2011/07/05 in ProgLang, Tools

 

Tags: , , , , , , , , ,

In response to your interest – in case you want to hire me.

Hi Richard,

Thank you for considering this position. I have been going over your CV and it looks interesting enough to take it to the next stage.  As for helping us better understand where your strengths are as far as your current software engineering capabilities I would like you to answer the following questionnaire.

Cheers,
Ofer

 

Question: Write a simple sorting algorithm (array of numbers) in python and explain it.
Answer:

my_numbers_that_need_sorting = [4,3,4,6,3,6,9]
my_numbers_that_need_sorting.sort()
## there are plenty of APIs out there that do sorting. 
## There is absolutely no reason for me to open my 
## Knuth books and read anything on merge sorts, hash sorts, 
## btree sorts, insert sorts etc. People smarter than me 
## are getting their Phd(s) on the subject.

 

Question: What parts of Python don’t you like and why?
Answer:

I hate the indenting.

 

Question: What is Bitcoin and what do you think about it?

Answer:

 I’m not an economist so I don’t know what the long term ramifications are. As a skeptical systems person I hope there are no bugs.

 

Question: What other software projects have you been involved with? Do you have a github account/website with code you wrote?
Answer:

My code is proprietary. I do give back from time to time. Recently I patched a bug for MongoDB… for fun. Their data “import” utility supports importing JSON, CSV and TSV.  When loading TSV and CSV files the leading and trailing whitespace is removed from each cell, however, the TAB character is considered whitespace in the TSV file import code. Therefore, if the first field were an empty field then the data would skew(shift by one cell) and the load would fail. So I identified the offending line of code, wrote a patch, tested it and submitted a patch to the dev team.

 

Question: What’s your favorite programming language (besides Python)?

Answer: 

I do not have a specific favorite… but if I had to choose it would be one that does that job. And as a manager I want to make sure that there are resources that pick up the standard when the time comes. (business continuity see
http://github.com/languages
)

ASM – when performance is absolutely necessary and I don’t need floating point. I hate floating point in assembler)

C – when performance is absolutely necessary and I need floating point or integration with other APIs like libcurl or the gtk.

C++ – when I have to bugfix someone else’s code.

perl – nice for reporting, ETL and other batch operations. (parrot and perl 6 have me concerned about compatibility)

python – same as perl. many of the APIs make things easier than perl. I also like tornado/cyclone and Django for webapp frameworks. (I like easy_install!!)

Java – java is the new cobol. there are APIs and frameworks for just about everything. There was a time when java had a manageable library but now it’s too big and it has fractured. Not to mention that the JDK is semi open source and then there is the Oracle factor.  J2EE is also a well known framework but it is the 1200lb gorilla in the room.

Scala and Clojure – interesting functional languages. If they were real languages instead of using the JDK. During initial development it is interesting that the languages can interop with traditional JDK libs, however, in the end apps like “lift” are simply calling Jetty. That makes a functional call stack not to functional.

erlang – interesting but not all ‘that’. While it works well for long running process and it’s lightweight processes make for some interesting parallelization it’s better for longer running tasks like phone switches and audio codecs. It’s not well suited for messaging. There are so many other better solutions. Mnesia is useful. It’s nice that it’s integrated into the language, however, there are plenty of warts there and there are so many other DBs that make more sense.

haskell – bloated and disorganized package manager.

prolog – In 20 years I have not found it useful… or in production. Erlang does a better job and Turbo Prolog is long since gone.

R – I would like to use this language, however, I have not found a use-case for it yet. It generates nice graphs and charts… but it requires Intel Fortran to build it. So I’m not sure I want this many dependencies.

LUA – another interesting idea.  Nice that the language is small enough to compile quickly and there is a jit. It’s also interesting that it integrates with C instead of the JDK.

.NET – I’m not a fan of anything that creates a lock-in and Mono while it runs on *nix is not a real viable solution in the long term. Mono is loosely glued together.

Thank you. I hope to hear from you shortly.

/r

 
Leave a comment

Posted by on 2011/07/01 in for hire, ProgLang

 

Tags: , , , , , , , , , , , , , , ,

 
One Page Docs

Creating a library one page at a time.

One Page Bugs

Reducing the friction of writing and fixing bugs or features.

Follow

Get every new post delivered to your Inbox.

Join 223 other followers