Thursday Aug 15, 2013

Trying Out Lambda Expressions in the Eclipse IDE

A new article, now up on otn/java, by Deepak Vohra, titled “Trying Out Lambda Expressions in the Eclipse IDE,” demonstrates how to take advantage of lambda expressions in Java SE 8 using the Eclipse IDE and virtual extension methods.

Vohra begins with the basics:
“Lambda expressions, also called closures, are a short-form replacement for anonymous classes. Lambda expressions simplify the use of interfaces that declare a single abstract method, which are also called functional interfaces. In Java SE 7, a single method interface can be implemented with one of the following options.
* Create a class that implements the interface.
* Create an anonymous class.”

Vohra explains that while lambda expressions can be used to implement a functional interface without creating a class or an anonymous class, they can be used only with interfaces that declare a single method.

Benefits of lambda expressions include:
* Concise syntax
* Method references and constructor references
* Reduced runtime overhead compared to anonymous classes

Vohra gets under the hood to explain the basics of lambda syntax, along with the nature of functional interfaces and target types, offering copious examples. All in all, the article offers a first-rate primer on how to make use of lambda expressions and virtual extension methods using the Eclipse IDE.

Check out the story here.

Wednesday Mar 28, 2012

Java Champion Jorge Vargas on Extreme Programming, Geolocalization, and Latin American Programmers

In a new interview, up on otn/java, titled “An Interview with Java Champion Jorge Vargas,” Jorge Vargas, a leading Mexican developer, discusses the process of introducing companies to Enterprise JavaBeans through the application of Extreme Programming. Among other things, he gives workshops about building code with agile techniques and creates a master project to build all apps based on Scrum, XP methods and Kanban. He focuses on building core components such as security, login, and menus. Vargas remarks, “This may sound easy, but it’s not—the process takes months and hundreds of hours, but it can be controlled, and with small iterations, we can translate customer requirements and problems of legacy systems to the new system.”

In regard to his work with geolocalization, he says: “We have launched a beta program of Yumbling, a geolocalization-based app, with mobile clients for BlackBerry, iPhone, Android, and Nokia, with a Web interface. The first challenge was to design a simple universal mechanism providing information to all clients and to minimize maintenance provision to them. I try not to generalize a lot—to avoid low performance or misunderstanding in processing data. We use the latest Java EE technology—during the last five years, I’ve taught people how to use Java EE efficiently.”

Check out the interview here.


Thursday Jan 19, 2012

A File I/O Tutorial Featuring NIO.2

A tutorial on the front page of otn/java titled “A File I/O Tutorial Featuring NIO.2” explains the new file I/O mechanism introduced in the Java 7 release. The java.nio.file package and its related package, java.nio.file.attribute, provide comprehensive support for file I/O and for accessing the default file system. Though the API has many classes, developers need only focus on a few key entry points. The tutorial makes it clear that the API is intuitive and easy to use.

The tutorial begins by asking, “What is a path?” and then introduces the Path class, which is the primary entry point for the package. It explains Methods in the Path class related to syntactic operations and moves on to the other primary class in the package, the Files class, which contains methods related to file operations. It then introduces some concepts common to many file operations and explains methods for checking, deleting, copying, and moving files.

The tutorial offers a concise summary of the API with suggestions for further learning.

“The java.nio.file package provides extensive support for file and file system I/O. This is a very comprehensive API, but the key entry points are as follows:
•    The Path class has methods for manipulating a path.
•    The Files class has methods for file operations, such as moving, copy, deleting, and also methods for retrieving and  setting file attributes.
•    The FileSystem class has a variety of methods for obtaining information about the file system.”

More information on NIO.2 can be found on the OpenJDK: NIO project website on java.net. This site includes resources for features provided by NIO.2 that are beyond the scope of this tutorial, such as multicasting, asynchronous I/O, and creating your own file system implementation.


Read the complete article here.

Friday Nov 18, 2011

Blog Buzz - Devoxx 2011

Some day I will make it to Devoxx – for now, I’m content to vicariously follow the blogs of attendees and pick up on what’s happening.  I’ve been doing more blog "fishing," looking for the best commentary on 2011 Devoxx. There’s plenty of food for thought – and the ideas are not half-baked.

The bloggers are out in full, offering useful summaries and commentary on Devoxx goings-on.

Constantin Partac, a Java developer and a member of Transylvania JUG, a community from Cluj-Napoca/Romania, offers an excellent summary of the Devoxx keynotes.

Here’s a sample:

“Oracle Opening Keynote and JDK 7, 8, and 9 Presentation
•    Oracle is committed to Java and wants to provide support for it on any device.
•    JSE 7 for Mac will be released next week.
•    Oracle would like Java developers to be involved in JCP, to adopt a JSR and to attend local JUG meetings.
•    JEE 7 will be released next year.
•    JEE 7 is focused on cloud integration, some of the features are already implemented in glassfish 4 development branch.
•    JSE 8 will be release in summer of 2013 due to “enterprise community request” as they can not keep the pace with an 18    month release cycle.
•    The main features included in JSE8 are lambda support, project Jigsaw, new Date/Time API, project Coin++ and adding   support for sensors.

JSE 9 probably will focus on some of these features:
1.    self tuning JVM
2.    improved native language integration
3.    processing enhancement for big data
4.    reification (adding runtime class type info for generic types)
5.    unification of primitive and corresponding object classes
6.    meta-object protocol in order to use type and methods define in other JVM languages
7.    multi-tenancy
8.    JVM resource management”

Thanks Constantin!

Ivan St. Ivanov, of SAP Labs Bulgaria, also commented on the keynotes with a different focus.  He summarizes Henrik Stahl’s look ahead to Java SE 8 and JavaFX 3.0; Cameron Purdy on Java EE and the cloud; celebrated Java Champion Josh Bloch on what’s good and bad about Java; Mark Reinhold’s quick look ahead to Java SE 9; and Brian Goetz on lambdas and default methods in Java SE 8.

Here’s St. Ivanov’s account of Josh Bloch’s comments on the pluses of Java:

“He started with the virtues of the platform. To name a few:

    Tightly specified language primitives and evaluation order – int is always 32 bits and operations are executed always from left  to right, without compilers messing around
    Dynamic linking – when you change a class, you need to recompile and rebuild just the jar that has it and not the whole application
    Syntax  similarity with C/C++ – most existing developers at that time felt like at home
    Object orientations – it was cool at that time as well as functional programming is today
    It was statically typed language – helps in faster runtime, better IDE support, etc.
    No operator overloading – well, I’m not sure why it is good. Scala has it for example and that’s why it is far better for defining DSLs. But I will not argue with Josh.”

It’s worth checking out St. Ivanov’s summary of Bloch’s views on what’s not so great about Java as well.

What's Coming in JAX-RS 2.0

Marek Potociar, Principal Software Engineer at Oracle and currently specification lead of Java EE RESTful web services API (JAX-RS), blogged on his talk about what's coming in JAX-RS 2.0, scheduled for final release in mid-2012.  

Here’s a taste:

“Perhaps the most wanted addition to the JAX-RS is the Client API, that would complete the JAX-RS story, that is currently server-side only. In JAX-RS 2.0 we are adding a completely interface-based and fluent client API that blends nicely in with the existing fluent response builder pattern on the server-side. When we started with the client API, the first proposal contained around 30 classes. Thanks to the feedback from our Expert Group we managed to reduce the number of API classes to 14 (2 of them being exceptions)! The resulting is compact while at the same time we still managed to create an API that reflects the method invocation context flow (e.g. once you decide on the target URI and start setting headers on the request, your IDE will not try to offer you a URI setter in the code completion). This is a subtle but very important usability aspect of an API…”

Obviously, Devoxx is a great Java conference, one that is hitting this year at a time when much is brewing in the platform and beginning to be anticipated.


About

Insider News from the Java Team at Oracle!

duke
javeone logo
Links


Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
2
5
6
7
12
13
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today