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/BeforeTime Feb 22 '15

Java has classes and objects. You'd be looking long for a more powerful abstraction mechanism than that. Other languages might have more abstraction tools that are more suited to some situations, but objects can almost always get the job done. Other mechanisms are just more terse, which can be valuable, but they are not strictly speaking more powerful.

What Java lacks is some sort of syntactic abstraction such as e.g. macros or haskells handling of two argument functions.

4

u/gingenhagen Feb 22 '15

I'd say that the two things that Java is really hurting for are first-class functions and closures.

5

u/aradil Feb 22 '15

And the lack of a not brain-dead datetime/calendar library.

Wooo Java 8. I'll probably never be able to upgrade to Java 8. Also, I'm pretty sure it's anonymous functions are internally just converted to classes anyway, and are really just sugar. But I like sugar.

2

u/bluestorm96 Feb 22 '15

Anonymous functions in Java 8 are not implemented as inner classes. You'll note that compiling a class with lambdas doesn't spit out multiple class files, as opposed to ones with inner classes. The compiler spits out different bytecode, and the JVM also each differently at runtime. There's a good read about it here.

1

u/aradil Feb 22 '15

That's very awesome. I could have sworn I read something saying the opposite, but that may have been a very long time ago back when they were still deciding what features to put into Java 8.

1

u/gingenhagen Feb 22 '15

You don't like joda?

1

u/aradil Feb 22 '15

We don't use joda. And the builtins are infuriating.

I think I'm going to jam it in on Monday and see if anyone notices. We have a ton of garbage date and time code that should have been using joda forever ago, but we haven't had time to rewrite it all. So for some reason that meant we just never started using it.

3

u/alloec Feb 22 '15

Java has classes and objects

In Java context those two are more of less same thing. I think you mean interfaces and objects and it is an okayish abstraction mechanism, but not exactly powerful.

Am I wrong to assume you don't really understand other abstractions other those found in OOP nowadays? Because terseness in the non-oop abstractions you refer to are not the strengths of these abstractions.

2

u/[deleted] Feb 22 '15

Because terseness in the non-oop abstractions you refer to are not the strengths of these abstractions.

If you're saying what I think you're saying, I agree with you.

Java is predominant in the enterprise, and OOP abstractions are more communicable for the concepts an people in that environment than non-OOP abstractions. For example, it is easier to explain the concept of an Account.withdraw() operation to an entire team than explaining a monad.

On the other hand, if you were to write software in a team where mathematics is predominant, functional abstractions would be better suited.

0

u/BeforeTime Feb 22 '15

I think you are wrong to assume that. Objects (and by the same token, closures) are the most general purpose abstraction mechanisms there are, even the things done with call/cc and friends can be done using objects, just in different ways.

This is not to say that objects are the most optimal way to do things, it is just to say that Java has a very powerful abstraction mechanism at its disposal which means it very rarely leaves you hanging even if it might be a bit (quite even) verbose.

1

u/llogiq Feb 25 '15

Lua uses tables (=map/list hybrid) for great effect. You'd be surprised what you can get done with just this one fairly simple data structure.