r/programming • • Feb 22 '15

Java Makes Programmers Want To Do Absolutely Anything Else With Their Time

http://www.forbes.com/sites/quora/2015/02/21/java-makes-programmers-want-to-do-absolutely-anything-else-with-their-time/
35 Upvotes

636 comments sorted by

View all comments

Show parent comments

1

u/nickguletskii200 Feb 22 '15

I've been using Clojure professionally for the past 4 years and I can definitively tell you there's nothing wrong with its implementation. The error messages certainly could be better, but figuring them out is not all that difficult once you learn what the errors mean. My experience has been that errors do trace precisely where the problem occurred vast majority of the time. In fact I've practically never had a reason to use a debugger when working with Clojure, something that I relied on constantly with Java.

When I first used it I kept getting NullPointerExceptions. Maybe you don't use macros that much, but the first thing I did was try to implement a DSL based on Clojure and it was very frustrating.

That said, if/when they do fix the stupid compiler, I will give it another go, because I really like the concept.

2

u/yogthos Feb 22 '15 edited Feb 22 '15

Using macros is generally discouraged and vast majority of problems can be solved with regular functions. Beginners often get overexcited about using macros and that's a mistake in my opinion. Macros are a useful tool, but that's really not the main appeal of Clojure. If you look at popular Clojure libraries in the wild you'll see that there are very few macros in them. As the style guide says: don't write a macro if function will do.

One of the main benefits I see using Clojure over Java is actually how rare null pointers happen, typically when doing Java interop. Since all the standard library functions handle nil values intelligently, they simply bubble up to the top in most cases. Instead of having to pepper null pointer checks all over the place, you can simply check for a value at the end of the transformation.

Again, I'm not sure what you mean by "fix the compiler". The compiler works exactly as it's supposed to, but you have to understand the intricacies of the language in order to use the most advanced features.

Macros require you to understand the details of how the reader and the evaluator work, what macro expansion is, when it happens, how macros interact with one another and so on. It's hands down the most complex feature of the language and I definitely would not recommend focusing on it as a beginner.

-1

u/nickguletskii200 Feb 22 '15

Using macros is generally discouraged and vast majority of problems can be solved with regular functions. Beginners often get overexcited about using macros and that's a mistake in my opinion. Macros are a useful tool, but that's really not the main appeal of Clojure. If you look at popular Clojure libraries in the wild you'll see that there are very few macros in them. As the style guide says: don't write a macro if function will do[1] .

It wasn't enough in my case. Why would I waste my time on fighting macros if it were?

One of the main benefits I see using Clojure over Java is actually how rare null pointers happen, typically when doing Java interop. Since all the standard library functions handle nil values intelligently, they simply bubble up to the top in most cases. Instead of having to pepper null pointer checks all over the place, you can simply check for a value at the end of the transformation.

But the compiler still nullpointed.

Again, I'm not sure what you mean by "fix the compiler". The compiler works exactly as it's supposed to, but you have to understand the intricacies of the language in order to use the most advanced features.

Throwing NullPointerExceptions instead of syntax errors isn't "working as it is supposed to" in my book.

1

u/yogthos Feb 22 '15

It wasn't enough in my case. Why would I waste my time on fighting macros if it were?

There's nothing that macros let you do that can't be done without macros. They're a way to template code when you see repetitive patterns. You still haven't described what it is that you were trying to do in the first place.

But the compiler still nullpointed.

I'm not sure what you mean by "compiler nullpointed", are saying you crashed the compiler. I've certainly never seen that happen myself.

Throwing NullPointerExceptions instead of syntax errors isn't "working as it is supposed to" in my book.

Again, perhaps you could actually described exactly you did and how you got a null pointer. Perhaps you can paste your code. I have a rather hard time believing that you managed to crash the compiler.

→ More replies (8)