Earlier quoted context omitted.
Rigth tool for the right job is key here. I personally like to add Groovy to the devops list.
I think groovy is sensless language. You lost all Java benefits like checked exceptions, robust code... what is about debugging? And you is not faster developing with groovy. You developing faster if you ensure quality and not inline filters or other crap. If you like groovy, look at Python.
Ask HN: Why not Java?
101–110 of 112 posts
Re: Ask HN: Why not Java?
#102Earlier quoted context omitted.
The two areas that most frequently annoy me are processing collections and (lack of) first-class functions. Java: List firstNames = new ArrayList (); for(Person p : people) { firstNames.add(p.getFirstName()); } addCallback(new Runnable() { public void run() { doSomething(); } }); Python: first_names = [p.first_name for p in people] add_callback(do_something) Scala: val firstNames = people.map((p) => p.firstName); add…
This is, because you can't Java. How you will find out, where you use first_names = [p.first_name for p in people] ? More verbose, but right way in Java is like (you can do this better with enums and/or guava, it's just example): class PersonTransformer implements Transformer { public Object transform(Object o) { return ((Person)o).getFirstName(); } } and then: Collection firstNames = CollectionUtils.collect(people,…
Re: Ask HN: Why not Java?
#103> Why is it so horrible as a systems language above C? * First class functions (interfaces with one method) plus garbage collector eventually encourage a functional programming style, with lots of little objects created on the heap. Alas, the per-object memory overhead of popular Java implementations is horrendous. * Strong emphasis on using threads for concurrency. Alas, in practice, threads are incredibly large mem…
* My beef with threads for concurrency revolves not around memory footprint (can you substantiate threads as "memory hogs"?), but instead around the necessity to be mindful of resource sharing. Yes, the JDK gives you lots of useful tools in this quest, but it's still not all that difficult to end up with a deadlocked app.
Re: Ask HN: Why not Java?
#104Earlier quoted context omitted.
Python has threads. In Python classes are first class objects, and you can easily do anything you could do with Java anonymous classes on the fly. Furthermore Java anonymous classes are usually used as a verbose replacement for a lack of closures. But in Python you can create closures and pass them around. (You do have to do some juggling to mutate variables, but 1 element arrays are only a slight pain to work with.)
Yes, but again, there is no Python syntax for anonymous classes. That you can "easily do" something a different way is not proof that two things are the same, it's proof that they are in fact different. Which again, is my point. That Python has other, different features that can be used for other different effects just makes it that much more different. Python has green threads, but if you want concurrency, you have…
type('', (dict,), {'__init__': lambda self, *args, **kwargs: not super(self.__class__,self).__init__(*args, **kwargs) and setattr(self,'__dict__',self)})
Python easily allows multiple threads to exist at once. The only reason they don't run at the same time is an implementation detail of the most common Python implementation. Python running on the CLR, the JVM, and extensions for both CPython and PyPy show that you can run multiple threads concurrently if you really want to.Re: Ask HN: Why not Java?
#105Earlier quoted context omitted.
You can ditch the xml almost entirely in spring 3, which I've been using for 2 years now. All you need is 50-100 boilerplate lines and the rest is annotations. I agree that 2.x was xml hell, but it is worlds better now.
> All you need is 50-100 boilerplate lines That answers "Why not Java?" perfectly ;)
Saying it politely as possible: don't be a hater.
Re: Ask HN: Why not Java?
#106Earlier quoted context omitted.
Well, for starters the whole idea of programming in XML. That and gems such as http://static.springsource.org/spring/docs/2.5.x/api/org/spr... or http://static.springsource.org/spring/docs/2.5.x/api/org/spr... Of course I can't a priori prove that Spring is garbage, much like I can't a priori prove that it's better to be healthy and rich than to be poor and sick. It is a judgement call, but a judgement call that I be…
The word "SimpleBeanFactoryAwareAspectInstanceFactory" reflects everything I hate about Java and it's intended approach to OOP.
Re: Ask HN: Why not Java?
#107Earlier quoted context omitted.
Rigth tool for the right job is key here. I personally like to add Groovy to the devops list.
I think groovy is sensless language. You lost all Java benefits like checked exceptions, robust code... what is about debugging? And you is not faster developing with groovy. You developing faster if you ensure quality and not inline filters or other crap. If you like groovy, look at Python.
And for the record Groovy is awesome. I used to develop in it alot, but now do more Rails and JavaScript, and I miss it's power and simplicity.
Re: Ask HN: Why not Java?
#108We may say that with the current crop of languages running on the JVM, Java is a low-level language. It is to the JVM what C is to hardware. You avoid coding in both when you have higher-level languages available which will make you more productive.
But when you want to optimize performance on the JVM for specific chunks of your application - without resorting to JVM bytecode of course - Java is the right choice.
Re: Ask HN: Why not Java?
#109Earlier quoted context omitted.
From what I see, knowledge comes from experience and study. An IDE doesn't magically separates you from the need to know how stuff works. What you describe is a unexperienced programmer, but those exist in any area, using or not a IDE. From what I understood you, your see a problem with code generated by a wizard or by an automated process and if that's your point I agree, but that's not how eclipse is used. Besides…
I agree that an IDE does not separate from the need to know how stuff works. But I certainly know a few programmers who do not dare to think beyond what their IDE allows them to do. They use built-in wizards and refactorings, but they do not seek solutions that are not easily expressible with those. Hence, their code is factored just the way the IDE would, even if there are better alternatives available. This is the…
Re: Ask HN: Why not Java?
#110> Why is it so horrible as a systems language above C? * First class functions (interfaces with one method) plus garbage collector eventually encourage a functional programming style, with lots of little objects created on the heap. Alas, the per-object memory overhead of popular Java implementations is horrendous. * Strong emphasis on using threads for concurrency. Alas, in practice, threads are incredibly large mem…