I need some Java inspiration

Maybe because I'm running on empty, waiting for lunch, but I'm not feeling inspired.

So, I need some Java inspiration. What was the last Java-"thing" (anything, from a coding trick, to a class, package, tool, etc...) that made you say "giddy-up!"

[261 byte] By [Hippolytea] at [2007-11-27 11:07:38]
# 1

> Maybe because I'm running on empty, waiting for

> lunch, but I'm not feeling inspired.

>

> So, I need some Java inspiration. What was the last

> Java-"thing" (anything, from a coding trick, to a

> class, package, tool, etc...) that made you say

> "giddy-up!"

Generics...for inspiring frustration I guess

snic.snaca at 2007-7-29 13:23:26 > top of Java-index,Java Essentials,Java Programming...
# 2

Netbeans platform7 and the org.openide.* packages.

Ill doesn't begin to cover it.

Joe

Joe_ha at 2007-7-29 13:23:26 > top of Java-index,Java Essentials,Java Programming...
# 3

JavaFX?

Ive been working on an IDE that I think will be pretty great

as well as an amazing open source project I want to release

by the fall.

You might feel invigorated by working on an opensource or

sourceforge project? I have a website I dont use that ive been

looking for people to fill with stuff. You want in on that, lol?

TuringPesta at 2007-7-29 13:23:26 > top of Java-index,Java Essentials,Java Programming...
# 4

> So, I need some Java inspiration. What was the last

> Java-"thing" (anything, from a coding trick, to a

> class, package, tool, etc...) that made you say

> "giddy-up!"

Groovy.

#! /usr/bin/groovy

// from Groovy In Action

import groovy.swing.SwingBuilder

swing = new SwingBuilder()

frame = swing.frame(title: 'Demo') {

menuBar {

menu('File') {

menuItem 'New'

menuItem 'Open'

}

}

panel {

label 'Label 1'

slider()

comboBox(items:['one', 'two', 'three'])

}

}

frame.pack()

frame.show()

~

yawmarka at 2007-7-29 13:23:26 > top of Java-index,Java Essentials,Java Programming...
# 5

StressTest application for our database. I just love having the power to drive the database to its knees. When I explained what could happen in front of the DBA's they all looked very green and ill. I could hear their thoughts, "This JAVA developer has the power to bring our vaunted mighty incredible database down and crash it with his puny little application? Oh dear God say it isn't so, destroy it burn it crudify him."

BWAHAHAHAHAHAHAHAHAHAHA !!!

PS.

puckstopper31a at 2007-7-29 13:23:26 > top of Java-index,Java Essentials,Java Programming...
# 6

Groovy looks, well, groovy, but the last time I tried to learn a scripting

language -- just to better myself, not for work -- the language was Python,

and I had VLSI (very little sustained interest). So what's the benefit to

Groovy? Why code in it instead of Java, for example?

Hippolytea at 2007-7-29 13:23:26 > top of Java-index,Java Essentials,Java Programming...
# 7

I believe Groovy creates valid Java bytecode(?).

So you can write part of your program in Groovy.

Why? Well just the grammar of the language might help

you accomplish some tasks quicker or might inspire

interesting designs you wouldnt have done otherwise.

At the very least, it might keep things new.

Im always saying at work... if i have to write one more for statement...

TuringPesta at 2007-7-29 13:23:26 > top of Java-index,Java Essentials,Java Programming...
# 8

> So what's the benefit to Groovy? Why code in it instead of Java, for example?

I wouldn't recommend it as a wholesale replacement for Java, but when the need for a handy scripting language arises, Groovy:

1) Is standardized for and runs on the Java platform;

2) Uses a Java-like syntax;

3) Provides easy use of existing Java API;

4) Can be easily called from Java code;

5) Can be easily compiled to Java byte codes;

6) Offers interesting and useful features like closures, I/O enhancements, regex enhancements, collection literal, duck typing, and easy property access;

7) Washes your car, rubs your feet, and gets you a beer from the fridge.

~

yawmarka at 2007-7-29 13:23:26 > top of Java-index,Java Essentials,Java Programming...
# 9

> 7) Washes your car, rubs your feet, and gets you a beer from the fridge.

You had me at closures.

Hippolytea at 2007-7-29 13:23:26 > top of Java-index,Java Essentials,Java Programming...
# 10

i just installed groovy and ran that code you posted from the other

thread. super cool stuff.

TuringPesta at 2007-7-29 13:23:26 > top of Java-index,Java Essentials,Java Programming...
# 11

Spring.

%

duffymoa at 2007-7-29 13:23:26 > top of Java-index,Java Essentials,Java Programming...
# 12

> super cool stuff.

Another example from the book, but I'll write the Java-equivalent first.

List list = Arrays.asList(

Arrays.asList(1, 0),

Arrays.asList(0, 1, 2)

);

Collections.sort(list, new Comparator() { // sort by first element

public int compare(Object o1, Object o2) {

List list1 = (List) o1;

List list2 = (List) o2;

Integer a = (Integer) list1.get(0);

Integer b = (Integer) list2.get(0);

return a.compareTo(b);

}

});

List expected = Arrays.asList(

Arrays.asList(0, 1, 2),

Arrays.asList(1, 0)

);

assert list.equals(expected);

Here's the Groovy equivalent:

def list = [ [1, 0], [0, 1, 2] ]

list = list.sort { a, b -> a[0] <=> b[0] } // sort by first element

assert list == [ [0, 1, 2], [1, 0] ]

Oh, and I'm with duffymo. Spring is a blast.

~

yawmarka at 2007-7-29 13:23:27 > top of Java-index,Java Essentials,Java Programming...
# 13

Can you say "succinct"? Nice example, Steve.

I saw a great article today about JavaScript running in Java. I was really intrigued by the DSL and complex rules written once and used on both client and server:

http://weblog.raganwald.com/2007/07/javascript-on-jvm-in-fifteen-minutes.html?retitled

%

duffymoa at 2007-7-29 13:23:27 > top of Java-index,Java Essentials,Java Programming...
# 14

Is it possible to write and then execute Groovy and JavaScript from

within a running Java program? I know you can do this with BeanShell

so im assuming you can. Does anyone have a good link to a Groovy

tutorial on how to do this?

TuringPesta at 2007-7-29 13:23:27 > top of Java-index,Java Essentials,Java Programming...