sábado, 10 de mayo de 2014

Java 8 Lambdas and Devices with Stephen Chin (recap)

Hi devs!

The last 14th of april we organized Stephen Chin's talk on Java 8 lambdas and devices, a terrific evening at the Official College of Technical Engineer in Computer Science in Catalonia (COETIC). We had a blast with robots, raspberry-made tablets, and a cute gal RPG character leading a herd of sheeps with the power of Lambdas!


To show us how to use Lambdas, Stephen led us through an incremental series of steps enhancing the funcionality of Mary, the JavaFX sheep herd leader RPG lady of the evening:


Lambdas were used to provide a chain of transformations on the behaviour of Mary and it's herd of sheeps. Treated as a collection of animals, lambdas provided us with the ability to apply filtering, selecting the animals we wanted to affect using reduction algorithms, like this one:
Predicate<SpriteView> pure = a -> a.getColor() == null;mealsServed.set(mealsServed.get() + s.getAnimals().filtered(pure).size());s.getAnimals().removeIf(pure);

Lambdas also served to provide collections of different types to transform our sheeps into chickens with mapping and collector!

  
Like so:
s.getAnimals().setAll( s.getAnimals()
    .stream()
    .map(SpriteView::getFollowing())
     .map(Chicken::new)
     .collect(Collectors.toList())
 );

All in all, a very informative and practical talk on using lambdas. But that wasn't all there was to it, since we got to see a demo of Duke, the java mindstorm robot, with whom we interacted:

It's all fun and laughs until the lasers come out
Duke was remote-controlled by a java-enhanced Rasperry Pi motherboard.

There was so much more that we did; I encourage you to see the whole thing on our youtube channel or in the Nighthacking website!

We're looking forward to see you on the next event!

No hay comentarios:

Publicar un comentario en la entrada