Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Help For Clojure Addiction
12 points by metaforth on March 22, 2010 | hide | past | favorite | 14 comments
I have recently been playing with Clojure for personal projects. It is quite addictive. Also I am shocked by its leverage and how productive I am in it.

Now at work (Java and C++) I am constantly thinking of ways of getting my next Clojure fix.

How should I solve this problem? The problem is that I would rather program in Clojure than anything else. Here are some ideas and issues with them.

1. Switch jobs. Except that most of the jobs on Craigslist (SF Bay) that mention Clojure list it with five other buzz words. It sounds like interview bait. There is no guarantee there will be Clojure on the job.

2. Ask my company to use Clojure. I suspect they will not be open to this because they have a mob of Java programmers who won't understand the code. They rejected another person's request to use Scala a few months ago. Still worth a shot. But I can see the PHB eyes glazing over.

3. Create a web-based start-up using Clojure. Despite Clojure's productivity this will take some time. This is the path I am working on right now. But it seems like such a long slog.


I am a "PHP" developer at work. All day I sit around writing "PHP" code. Here is how I start my day: "You guys want this done quickly and reliably or should I do it in PHP" ..

We're a PHP shop with a huge Common Lisp code base.

Use Clojure to generate your Java code. As far as anyone else is concerned you're writing Java.

I've used code generation at work quite a bit, whenever I've had somewhat repetitive code to write that I couldn't factor away. It makes my job a lot less tedious and more fun.

Is there any public Clojure code for this?

I have no idea. It's easy enough to make special-purpose code generators yourself...don't bother trying to make some kind of universal system, just hack out code to generate exactly what you need for your current project. You may see ways to generalize it later.

I'm at a C# shop myself, and generally just write my generators in C#. Just spitting out strings of sourcecode and writing them into files. I would think Clojure would be better for this sort of thing, since it's got macros.

On the other hand, doing it in C# worked really well for one project, because after writing the generator I realized that I could convert it from a compiler into an interpreter, and make a program that didn't need a generator after all because it was so flexible at runtime.

There's quite a few examples of code generators (e.g. for GUI's, database access, write test fixtures/setup/teardown, etc) in ocaml. It is one of Harrop's success stories. The Manning Code Generation book by Harrington is from 2003, uses ruby 1.6, but i remember it being an excellent book


Get some busines knowledge in some domain. A lot of business folks do not care about what technology one uses as long as one can solve their problems using it.

We are actively using Clojure, located in New York City and looking for programmers with financial experience. Send resumes to (->> ["dimitry" :dot "gashinsky" :at "picotrading" :dot "com"] (replace {:at \@, :dot \.}) (apply str))

I recommend #3. Hang out on IRC & the groups, open source the non-secret-sauce from your startup. Build a brand around yourself as a badass Clojure programmer. Best case scenario, you have a successful startup. Worst case, you're a well known Clojure expert, and someone will hire you to work for them.

There is a company named WeatherBill which I personally know is interested in hiring Clojure users. (I think the only online advertising they did was a tweet which was maybe picked on disclojure.org.) One person there recently told me that they're very friendly to telecommuting -- but only within the US.

(This telecommuting thing probably doesn't matter much to you, given they're IIRC in SF, but others might like to know that...)

BTW, have you tried going to Clojure meetings, if there are any in your area? Some people prefer to go to them to find coworkers.

"One person there recently told me that they're very friendly to telecommuting -- but only within the US."

Just curious, but once you accept telecommuting what does it matter where someone is? quick in person meetings at a few hours notice?

Yeah, I didn't understand the reasoning either, and he didn't explain. The context was that a mutual friend introduced us, because he thought we'd work well together. (He knew that the WeatherBill fellow was actually going around to local Clojure meetings to try to find interested people.)

I mean, they have telecommuters on the opposite US coast. Dunno why crossing an ocean is a bridge too far. (And how would this apply to South America?)

Yeah, I'll try to ask him; these managerial decisions puzzle me. I have the suspicion it's two things: a) a gut feeling which is hard to articulate and b) the Google practice of not hiring if you have a whiff of doubt. (WeatherBill was founded by ex-Googlers, IRRC.)

You can sneak a lot of functional style programming into Java/C++. It's easier with C++ because they have first class functions, but you can do a lot even with Java. I think it's not optimal to do a 100% functional style, even though you can, because all the syntax junk gets in the way, but just by thinking in terms of higher order functions instead of objects it will make a lot of the pain go away.

> they have first class functions

No it doesn't. C++ has function pointers, and you can make functors objects. But that doesn't make first class functions at all. Thinking in terms of higher order functions in C++ is just a different sort of pain, though it's admiteddly usefull sometimes. But you better like making template functors then.

Challenge yourself by thinking whether you could write better java code, in the light of your new knowledge from the clojure side. Straightforward example: produce far more orthogonal java code by using composition and the strategy pattern more, programming more to interfaces and delegating more some "general" work on interfaced objects to static methods in helper classes, etc.

That is, don't throw the baby with the bath water. Though coming with more "boilerplate" (as in "more ceremony"), there are still ways of programming in java that can make you happy at the end of the day: when you feel that your code is more DRY (which does not necessarily mean less code, BTW), and more orthogonal (more interfaces -e.g. callback interfaces- are generally a step in the right direction, though not necessarily a general rule).

Don't ask for permission. Recognize the need for something important at work and write it in Clojure and often coworkers/bosses will be so glad to have it and not have had to write it themselves that they won't care what language it's in. Of course now you're responsible for it.

Applications are open for YC Summer 2021

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact