Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

August 23 2013

Ce sont les profs qui s'y collent …

Ce sont les profs qui s’y collent …
http://namok.be/blog/index.php?post/2013/08/22/ce-sont-les-profs-qui-s-y-collent

http://namok.be/public/images/esi/java/.Before_its_too_Late_by_RyuzakiLivesOn_m.jpg

En général, les profs posent les questions et les étudiants tentent d’y répondre tant bien que mal.

Parfois le résultat général n’est pas à la hauteur des attentes. Outre les classiques remises en question au sujet de la manière d’enseigner, du niveau d’exigences, … nous nous sommes dit que ce serait bien que nous fassions nous-même l’exercice de l’examen.

À froid !

Comme ça, sans se préparer …

Nous l’avons tous [1] fait avec nos sensibilités et nos attentes un peu différentes …

Je l’ai fait au (...)

#Cartable_au_dos #care #esi #geek #java
http://namok.be/public/images/esi/java/LGJ1-for-pbt.pdf

January 14 2013

Gilt die Empfehlung des BSI Java zu deinstallieren auch für Behörden, Gerichte und Anwälte?

Laut einer Meldung von Heise weist das Bundesamt für Sicherheit in der Informationstechnik (BSI) auf eine kritische Schwachstelle in der aktuellen Java-Laufzeitumgebung hin und empfiehlt Java zu deinstallieren, bis ein Sicherheitsupdate vorliegt.

Die Empfehlung finde ich als Anwalt deshalb besonders interessant, weil das Elektronisches Gerichts- und Verwaltungspostfach (EGVP) eine Javaanwendung ist und eine Java Runtime Environment erfordert.

Das EGVP wird von Gerichten, Justizbehörden, Anwälten und anderen Behörden zum elektronischen Datenaustausch genutzt und stellt das offizielle und amtliche Tool dafür dar.

September 07 2012

Four short links: 7 September 2012

  1. GS-Collections (GitHub) — Goldman Sachs open-sourced (Apache-licensed) their Java collection library, full of lambda goodness. No report on whether it requires a 750G bailout.
  2. Learning ZIL — old manual for the interactive fiction programming language that Zork and other Infocom games were written in. Virtual machines on a Z80 processor? They were hardcore before your time.
  3. NZ Government Web Toolkit — information and guides on accessibility standards.
  4. Workshop on Research and Resource Commons in Scientific Research: Final ReportThis diverse group discussed the current state of policy and technology as it relates to a scientific research commons, and identified key opportunities and challenges, as well as next steps, for the scientific community in general and Creative Commons in particular. Wilbanks describes as, “Sort of a wrapup after seven years of SC.” (via John Wilbanks)

May 25 2012

Developer Week in Review: Oracle's big bet fails to pay off

I've been taking the opportunity this week to do some spring office cleaning. Unfortunately, I clean my home office infrequently enough that at a certain point, cleaning it becomes more an exercise in archeology than organization. There's nothing like finding a six-month-old check you never deposited to encourage more frequent cleaning.

The same can be said for code, of course. It's far too easy to let crufty code build up in an application, and then be faced with the mother of all refactoring efforts six months down the road, when your code finally reaches a critical mass of flaky behavior. It's worth the effort to continually refactor and improve your code, assuming you can convince your product management that quality is as important as new features.

Android is almost out of the woods

It wouldn't be a Week in Review without the latest in Godzilla vs. Gamera Oracle vs. Google. Things aren't looking all too sunny for Oracle at the moment, as the jury in the case just threw out all the patent-related claims in the lawsuit. This doesn't leave Oracle with much left on the plate, as the case now boils down to the question of whether the Java APIs are copyrightable. That's a matter the jury is deadlocked on.

Like all things legal, this is going to drag on for years as there are appeals and retrials and the like. But for the moment, it appears that Android is out of the woods, at least as far as the use of Java is concerned. Of course, there's still all those pesky International Trade Commission issues keeping many Android handsets waiting at the border, but that's a battle for another day ...

Scripters of the world, rejoice!

For Perl developers, a point release of the language is a major event, as it only occurs roughly once a year. This year's edition has just been released, and Perl 5.16 packs a ton of improvements (nearly 600,000 lines' worth!).

Since Perl is such a mature language, most of the changes are incremental. Probably the most significant is further enhancements in Unicode support. Nonetheless, there should be something useful for the serious Perl developer.

FreeBSD bids GCC farewell

As the licensing on the GCC compiler has become increasingly restrictive, some of us have been wondering when the fallout would start. Wait no longer: The FreeBSD team has ditched GCC for the more BSD-friendly licensing of Clang.

GCC has spent decades as the compiler of choice for just about everything, but recent changes in the GPL have made it less attractive to use, especially in commercial development. With the Apple-sponsored Clang compiler now seen as a viable (and perhaps even superior) alternative, with a much less restrictive license, the Free Software Foundation may need to decide if it would rather stand on principle, or avoid becoming marginalized.

Got news?

Please send tips and leads here.

OSCON 2012 — Join the world's open source pioneers, builders, and innovators July 16-20 in Portland, Oregon. Learn about open development, challenge your assumptions, and fire up your brain.

Save 20% on registration with the code RADAR20


Related:


May 03 2012

Editorial Radar: Functional languages

Functional Languages are driving a broader set of choices for programmers. O'Reilly editors Mike Loukides and Mike Hendrickson sat down recently to talk about the advantages of functional programming languages and how functional language techniques can be deployed with almost any language. (The full conversation is embedded below.)

Andy Hunt and Dave Thomas have long recommend learning a new language each year, especially those languages that teach new concepts [discussed at the 02:02 mark]. Functional languages have made that easier. They behave in a different way than the languages many of us grew up on — procedural like C or languages derived from C. Plus, the polyglot programming movement has driven the interest in functional languages as one of the languages you might want to learn.

Programmers need to understanding the advantages of using a functional language, such as productivity, power of expressiveness, reliability, stateful objects, concurrency, natural concurrency, modularity, and composability [05:37]. Though a search still exists for a magic bullet [06:29] to make it easier for programers to better solve the problem of concurrency. CPU speeds have been stuck at roughly the same level for the last four to five years. Programmers have been given is more transistors on a chip, hence more CPUs and more cores to work with making concurrency one of the most difficult issues facing computer scientists today. Enter functional programming with improved debugging and the ability to write more reliable code in a concurrent environment.

Additional highlights from this conversation include:

  • Print book sales of functional languages are growing, especially books on R programming. And while Loukides doesn't consider R to be a functional language, some debate exists about its classification. Though it's clear the data science movement has driven the use of R because it's well designed for statistics and dealing with data. [Discussed at the 00:29 mark]
  • We'll see F# grow in the Microsoft development environment while Scala and Clojure are dominating the open source space. Erlang will also be around for a long time for building highly reliable concurrent systems. [Discussed at the 03:01 mark]
  • Since the publication of Doug Crockford's JavaScript: The Good Parts, coders have discovered the functional language abilities of JavaScript and Java. Google's release of Maps and Gmail revolutionized how JavaScript is used. Some of today's best examples include Node for high-performance websites and D3 for creating exotic and beautiful data visualizations. [Discussed at the 08:15 mark]
  • While JavaScript isn't a functional language, it's designed loosely, so it's easy to use as a functional language. You might also be interested in how functional programming techniques can be used in C++ — a blog post written by John Carmack. [Discussed at the 10:36 mark]
  • Java isn't intended as a functional language. Though Dean Wampler's Functional Programming for Java Developers provides an approachable introduction to functional programming for anyone using an object-oriented language. [Discussed at the 11:41 mark]
  • The use of a functional language or functional language techniques can make your code more robust and easier to debug. [Discussed at the 12:09 mark]

You can view the entire conversation in the following video:

Tune in next month for a discussion of NoSQL and web databases.

Fluent Conference: JavaScript & Beyond — Explore the changing worlds of JavaScript & HTML5 at the O'Reilly Fluent Conference (May 29 - 31 in San Francisco, Calif.).

Save 20% on registration with the code RADAR20

Related:

April 06 2012

Developer Week in Review: When giant corporations collide

The days of the April Fools' web joke are over, or should be. It's gotten too old, to institutionalized, and it's so widespread these days that serious news can slip through the cracks because everyone assumes it's a joke. If people want to pull hoaxes, pick a random day in the middle of the summer and do it then; you'll get much more bang for the buck because no one will be expecting it. I used to like a good fake article as much as the rest, back in the days when they would be buried somewhere in the pages of a magazine's April edition, but now it's just lame. Be assured, all the items in this edition of Developer Week in Review are 100% prank-free and were supervised by the American Humane Association.

Gentlemen, start your lawyers!

Like a large radioactive reptile, the lawsuit between Oracle and Google over the improper use of Java has been sleeping quietly in a courtroom in San Jose. But now, the slumbering monster is about to awake, potentially leaving a trail of broken companies scattered from California to Asia. After all attempts to broker a settlement between Larry's House of Java and the People's Autonomous Car and Search Engine Company failed, the judge involved has ordered the two parties to start sharpening their long-knives, in an unusually candid opinion.

It's hard to overestimate the potential impact that a ruling against Google could have on the smartphone industry. If Google was required to remove Java from Android phones, Android would essentially become useless because the entire stack that Android apps use is built on top of Java. More likely, Google would be required to shell out a significant license fee to Oracle, which added to the ones it already pays to Microsoft and (potentially) Apple, could make Android phones less and less profitable to the handset makers who actually end up paying the fees. Of course, given the glacial pace at which these proceedings move, Android may have already moved on by the time any such judgement actually comes down ...

Linux has a friend in ... Redmond?

In the past few weeks, we've made several references to Microsoft's increasing support of the open source model, and this week brought even more evidence of the sea change out of Washington state. For a technology that Steve Ballmer once described as akin to cancer, Linux is certainly getting a lot of love from Microsoft these days. The software behemoth is now in the top 20 corporate contributors to the Linux Kernel, committing more than 1% of all new lines of code last year.

It is worth bearing in mind that most of that code is in support of Microsoft technologies, such as Hyper-V, but even still, it's clear that Microsoft doesn't treat Linux like an ill-behaved street urchin anymore.

The art of game cheats

I'm not much (if anything) of a game programmer; I've always gravitated more to the web side of the force. But I certainly play my share of games. I'm currently racing my 17 year old to level 80 on "Call of Duty MW3" on the Wii (I'm [MLP]TwilightSparkle if you want to ally with a mediocre player who likes Akimbo FMG9 a bit too much for his own good ...). If you play enough multiplayer, you'll eventually come to recognize the players who have an almost psychic knowledge of where everyone is. They're the ones who always seem to come around the corner already sighted in on you. You know, the cheaters ...

Now, one game developer has stepped forward to explain some of the hacks that cheats use to become Chuck Norris clones and how they are implemented. Even if you are never going to get within 1,000 yards of a z-buffer, it's worth reading to see just how easily games can be tweaked to give unethical players an unbeatable edge.

Fluent Conference: JavaScript & Beyond — Explore the changing worlds of JavaScript & HTML5 at the O'Reilly Fluent Conference (May 29 - 31 in San Francisco, Calif.).

Save 20% on registration with the code RADAR20

Got news?

Please send tips and leads here.

Related:

March 22 2012

Developer Week in Review: The mysterious Google I/O machine

We're in the countdown days to the two big annual developer conferences (not counting OSCON, of course ...). Google I/O will open registration on March 27th, and if past history is any guide, WWDC should also start (and end) signups around the same week. So, get your credit cards warmed up and ready. Last year, both conferences sold out in less than a day (Google I/O in under an hour!).

And speaking of Google I/O

Google IO game

Just what is the purpose of the Rube Goldberg-esque physical puzzle that has gone up on the Google I/O website. Does it have something to do with a puzzle that potential attendees will need to solve to register? Will attendees be flung around from session to session by giant pendulums? Is it all just a cool demo of Chrome? And does it have anything to do with ancient Mayan prophecies?

In any event, it's a fun (if simple) game, worth a few moments of your time, but unlikely to absorb more than 15 minutes of your attention. Now, if they added achievements and a Zombie mode, that might be something.


So much for sandboxing

Reports of a successful exploitation against the Chrome sandbox appeared recently, and now word has broken that a new Java exploit not only breaks out of the sandbox, but manages to install itself into system memory, where it can mess around with privileged processes. Worse, unlike the Chrome exploit, which was reported to Google and not in the wild, this new Java hack is being actively distributed on popular Russian news sites.

Since the entire point of a sandbox is to keep malicious code from getting access to system resources, it is truly disheartening to see how frequently sandboxes are being penetrated these days. If there's one piece of code that needs to be rock-solid, it's the bit that keeps the bad guys from doing bad things. That it fails so often in reality either indicates that developers aren't doing a good job, or that it's a really hard problem and it may be time to rethink sandboxing as a valid security approach.

Go is almost a Go

For those who have been eagerly awaiting Google's attempt to reinvent the wheel new programing language, Go, the wait is almost over, as RC1 has just hit the street. According to the developers, this is very close to what the final 1.0 release will look like. If you've been waiting for a stable version of Go to kick the tires, now is probably the time.

As with most new programming languages, I am maintaining a healthy degree of skepticism as to the long-term viability of Go. This is not because of any inherent faults of the language, but because of the institutional inertia that new languages have to fight to gain acceptance. Whether Google's influence will be enough to get Go ensconced in the pantheon of mainstream languages is yet to be seen.

Fluent Conference: JavaScript & Beyond — Explore the changing worlds of JavaScript & HTML5 at the O'Reilly Fluent Conference (May 29 - 31 in San Francisco, Calif.).

Save 20% on registration with the code RADAR20

Got news?

Please send tips and leads here.

Related:

October 13 2011

Strata Week: Simplifying MapReduce through Java

Here are a few of the data stories that caught my attention this week:

Crunch looks to make MapReduce easier

Despite the growing popularity of MapReduce and other data technologies, there's still a steep learning curve associated with these tools. Some have even wondered if they're worth introducing to programming students.

All of this makes the introduction of Crunch particularly good news. Crunch is a new Java library from Cloudera that's aimed at simplifying the writing, testing, and running of MapReduce pipelines. In other words, developers won't need to write a lot of custom code or libraries, which as Cloudera data scientist Josh Willis points out, "is a serious drain on developer productivity."

He adds that:

Crunch shares a core philosophical belief with Google's FlumeJava: novelty is the enemy of adoption. For developers, learning a Java library requires much less up-front investment than learning a new programming language. Crunch provides full access to the power of Java for writing functions, managing pipeline execution, and dynamically constructing new pipelines, obviating the need to switch back and forth between a data flow language and a real programming language.

The Crunch library has been released under the Apache license, and the code can be downloaded here.

Web 2.0 Summit, being held October 17-19 in San Francisco, will examine "The Data Frame" — focusing on the impact of data in today's networked economy.

Save $300 on registration with the code RADAR

Querying the web with Datafiniti

DatafinitiDatafiniti launched this week into public beta, calling itself the "first search engine for data." That might just sound like a nifty startup slogan, but when you look at what Datafiniti queries and how it works, the engine begins to look profoundly ambitious and important.

Datafiniti enables its users to enter a search query (or make an API call) against the web. Or, that's the goal at least. As it stands, Datafiniti lets users make calls about location, products, news, real estate, and social identity. But that's a substantial number of datasets, using information that's publicly available on the web.

Although Datafiniti demands you enter SQL parameters, it tries to make the process of doing so fairly easy, with a guide that pops up beneath the search box to help you phrase things properly. That interface is just one of the indications that Datafiniti is making a move to help democratize big data search.

The company grew out of a previous startup named 80Legs. As Shion Deysarker, founder of Datafiniti told me, it was clear that the web-crawling services provided by 80Legs were really just being utilized to ask specific queries. Things like, what's the average listing price for a home in Houston? How many times has a brand name been mentioned on Twitter or Facebook over the last few months? And so on.

Deysarker frames Datafiniti in terms of data access, arguing that until now a few providers have controlled the data. The startup wants to help developers and companies overcome both access and expense issues associated with gathering, processing, curating and accessing datasets. It plans to offer both subscription-based and unit-based pricing.

Keep tabs on the Large Hadron Collider from your smartphone

LHSee screenshotNew apps don't often make it into my data news roundup, but it's hard to ignore this one: LHSee is an Android app from the University of Oxford that delivers data directly from the ATLAS experiment at CERN. The app lets you see data from collisions at the Large Hadron Collider.

The ATLAS experiment describes itself as an effort to learn about "the basic forces that have shaped our Universe since the beginning of time and that will determine its fate. Among the possible unknowns are the origin of mass, extra dimensions of space, unification of fundamental forces, and evidence for dark matter candidates in the Universe."

The LHSee app provides detailed information into how CERN and the Large Hadron Collider work. It also offers a "Hunt the Higgs Boson" game as well as opportunities to watch 3-D collisions streamed live from CERN. The app is available for free through the Android Market.

Got data news?

Feel free to email me.

Related:

Bob Lee on Java references and the state of Java

When I was contacting people about sitting for interviews during JavaOne, I just assumed that Bob Lee (@crazybob) wasn't going to be around. First, I thought he was still in St. Louis (wrong, he relocated to San Francisco when he became the CTO of Square), I also assumed that he'd steer clear of Oracle's OpenWorld because of his recent, high-profile role in the Oracle versus Google lawsuit over Android. Well I was wrong on that count, too. Not only was he at the conference, he was presenting. /p>

Lee is one of the reasons the Android platform just works. He was responsible for Android's core APIs and libraries. His contribution to Google is also greater than just working on one of the most popular mobile platforms in the world. Along with Dhanji Prasanna, Jesse Wilson, and Kevin Bourrillion, Lee was the creator of a dependency framework named Guice. Now Guice isn't nearly as popular as Spring, but it runs many of Google's critical applications and it has been incorporated into a few high profile projects, such as Maven. Bottom line: If you use Google's products and you happen to have an Android phone, Lee's handiwork is all over the place.

At JavaOne, Lee and I discussed Java references and he fielded a few free-form questions about the Java community. The following video contains the full interview.

September 23 2011

Developer Week in Review: webSOS

On the developer front, if the growing tide of rumors is correct, there will be some iOS stuff to report next week.

Meanwhile:

Last one out turn off the lights

HP WebOSHP has flung the axe, and it has taken out a large swath of the ill-fated webOS crew. HP is confirming that development will cease by the end of the year, reducing the number of viable mobile operating systems down to two again (Blackberry is heading the way of webOS, and Windows Mobile has an uphill battle at this point).

Is hegemony in the mobile space a good thing? Maybe, maybe not. It's good for mobile developers, as it reduces the number of potential platforms you need to consider. It could be bad for consumers, as it reduces the pressure on the remaining players to innovate. However, given that neither HP nor Microsoft nor RIM was pushing the envelope much with their products, that might not be a valid concern. And, frankly, Google and Apple do a pretty good job of stealing ideas from each other — witness the new Android-like notification framework in iOS5.

Android Open, being held October 9-11 in San Francisco, is a big-tent meeting ground for app and game developers, carriers, chip manufacturers, content creators, OEMs, researchers, entrepreneurs, VCs, and business leaders.

Save 20% on registration with the code AN11RAD

An (un)sign of the times

JavaOne of the joys of Java development is dealing with signed jars. For the uninitiated, Java Archives (jars) can be signed, "proving" that the contents inside are valid and untampered. Among other things, it is how the Java Web Start framework decides which Java programs can be automatically downloaded and started from a web page. Getting your jar file signed correctly is a delicate dance, and getting it wrong means that the applications will just plain not work.

Seemingly out of the blue, Oracle has started to remove the old Sun signatures from some core Java libraries that many developers depend on. The end result of this is that, going forward, it will become more difficult to deploy applications that use these frameworks. Oracle is saying it was done for security reasons, but as with many moves by Oracle lately, the end result has been to upset the developer community.

Creating the next generation of coders?

One of the paradoxical phenomena that seems to be occurring in society is that, even as technology is becoming more and more a part of people's lives, programming is being marginalized in the public schools. Instead, kids are taught how to use Excel or Powerpoint (God knows, my kid is a Powerpoint wiz!).

In the UK, they've decided to turn things around by making software design a part of the curriculum. You can make a strong argument that software engineering brings in skills from a lot of other disciplines like math and science, so it makes a good integrated teaching experience. On the other hand, my experience has been that public schools are uniquely bad at teaching coding because they try to teach it by rote, when it is at heart a creative process. It's like trying to teach painting by telling the students exactly where to place every brush stroke. Only time will tell if the UK can do it any better.

Got news?

Please send tips and leads here.

Related:

September 02 2011

A look at Java 7's new features

There are a number of features in Java 7 that will please developers. Things such as strings in switch statements, multi-catch exception handling, try-with-resource statements, the new File System API, extensions of the JVM, support for dynamically-typed languages, the fork and join framework for task parallelism, and a few others will certainly be embraced by the community.

Below I outline the features and provide examples where appropriate. A zip file containing code snippets used in this post can be downloaded here.

Language enhancements

Java 7 includes a few new language features via Project Coin. These features are quite handy for a developer.

Diamond Operator

You may have noted on many occasions your IDE complaining of types when working with Generics. For example, if we have to declare a map of trades using Generics, we write the code as follows:

Map<String, List<Trade>> trades = new TreeMap<String, List<Trade>> ();

The not-so-nice thing about this declaration is that we must declare the types on both the sides, although the right-hand side seems a bit redundant. Can the compiler infer the types by looking at the left-hand-side declaration? Not unless you're using Java 7. In 7, it's written like this:

Map<String, List<Trade>> trades = new TreeMap <> ();

How cool is that? You don't have to type the whole list of types for the instantiation. Instead you use the <> symbol, which is called diamond operator. Note that while not declaring the diamond operator is legal, as trades = new TreeMap (), it will make the compiler generate a couple of type-safety warnings.

Using strings in switch statements

Switch statements work either with primitive types or enumerated types. Java 7 introduced another type that we can use in Switch statements: the String type.

Say we have a requirement to process a Trade based on its status. Until now we used to do this by using if-else statements.

private void processTrade(Trade t) {

String status = t.getStatus();

if (status.equalsIgnoreCase(NEW)) {

newTrade(t);

} else if (status.equalsIgnoreCase(EXECUTE)) {

executeTrade(t);

} else if (status.equalsIgnoreCase(PENDING)) {

pendingTrade(t);

}

}

This method of working on strings is crude. In Java 7, we can improve the program by utilizing the enhanced Switch statement, which takes a String type as an argument.

 public void processTrade(Trade t) {

String status = t.getStatus();

switch (status) {

case NEW:

newTrade(t);

break;

case EXECUTE:

executeTrade(t);

break;

case PENDING:

pendingTrade(t);

break;

default:

break;

}

}



In the above program, the status field is always compared against the case label by using the String.equals() method.

Automatic resource management

Resources such as Connections, Files, Input/OutStreams, etc. should be closed manually by the developer by writing bog-standard code. Usually we use a try-finally block to close the respective resources. See the current practice of creating a resource, using it and finally closing it:

    
public void oldTry() {

try {

fos = new FileOutputStream("movies.txt");

dos = new DataOutputStream(fos);

dos.writeUTF("Java 7 Block Buster");

} catch (IOException e) {

e.printStackTrace();

} finally {

try {

fos.close();

dos.close();

} catch (IOException e) {

// log the exception

}

}

}



However, Java 7 has introduced another cool feature to manage the resources automatically. It is simple in operation, too. All we have to do is declare the resources in the try as follows:

try(resources_to_be_cleant){

// your code

}

The above method with the old try can finally can be re-written using this new feature as shown below:

      public void newTry() {

try (FileOutputStream fos = new FileOutputStream("movies.txt");

DataOutputStream dos = new DataOutputStream(fos)) {

dos.writeUTF("Java 7 Block Buster");

} catch (IOException e) {

// log the exception

}

}

The above code also represents another aspect of this feature: working with multiple resources. The FileOutputStream and DataOutputStream resources are enclosed in the try statement one after the other, each one separated by a semicolon (;) separator. We do not have to nullify or close the streams manually, as they are closed automatically once the control exists the try block.

Behind the scenes, the resources that should be auto closed must implement java.lang.AutoCloseable interface.

Any resource that implements AutoCloseble interface can be a candidate for automatic resource management. The AutoCloseable is the parent of java.io.Closeable interface and has just one method close() that would be called by the JVM when the control comes out of the try block.

Numeric literals with underscores

Numerical literals are definitely eye strainers. I am sure you would start counting the zeroes like me if you've been given a number with, say, ten zeros. It's quite error prone and cumbersome to identify a literal if it's a million or a billion unless you count the places from right to left. Not anymore. Java 7 introduced underscores in identifying the places. For example, you can declare 1000 as shown below:

int thousand =  1_000;

or 1000000 (one million) as follows

int million  =  1_000_000

Note that binary literals are also introduced in this release too — for example "0b1" — so developers don't have to convert them to hexadecimals any more.

Improved exception handling

There are a couple of improvements in the exception handling area. Java 7 introduced multi-catch functionality to catch multiple exception types using a single catch block.

Let's say you have a method that throws three exceptions. In the current state, you would deal them individually as shown in below:

   public void oldMultiCatch() {

try {

methodThatThrowsThreeExceptions();

} catch (ExceptionOne e) {

// log and deal with ExceptionOne

} catch (ExceptionTwo e) {

// log and deal with ExceptionTwo

} catch (ExceptionThree e) {

// log and deal with ExceptionThree

}

}



Catching an endless number of exceptions one after the other in a catch block looks cluttered. And I have seen code that catches a dozen exceptions, too. This is incredibly inefficient and error prone. Java 7 has brought in a new language change to address this ugly duckling. See the improved version of the method oldMultiCatch method below:

      public void newMultiCatch() {

try {

methodThatThrowsThreeExceptions();

} catch (ExceptionOne | ExceptionTwo | ExceptionThree e) {

// log and deal with all Exceptions

}

}

The multiple exceptions are caught in one catch block by using a '|' operator. This way, you do not have to write dozens of exception catches. However, if you have bunch of exceptions that belong to different types, then you could use "multi multi-catch" blocks too. The following snippet illustrates this:

public void newMultiMultiCatch() {

try {

methodThatThrowsThreeExceptions();

} catch (ExceptionOne e) {

// log and deal with ExceptionOne

} catch (ExceptionTwo | ExceptionThree e) {

// log and deal with ExceptionTwo and ExceptionThree

}

}



In the above case, the ExceptionTwo and ExceptionThree belong to a different hierarchy, so you would want to handle them differently but with a single catch block.

New file system API (NIO 2.0)

Those who worked with Java IO may still remember the headaches that framework caused. It was never easy to work seamlessly across operating systems or multi-file systems. There were methods such as delete or rename that behaved unexpected in most cases. Working with symbolic links was another issue. In an essence, the API needed an overhaul.

With the intention of solving the above problems with Java IO, Java 7 introduced an overhauled and in many cases new API.

The NIO 2.0 has come forward with many enhancements. It's also introduced new classes to ease the life of a developer when working with multiple file systems.

Working with Path

A new java.nio.file package consists of classes and interfaces such as Path, Paths, FileSystem, FileSystems and others.

A Path is simply a reference to a file path. It is the equivalent (and with more features) to java.io.File. The following snippet shows how to obtain a path reference to the "temp" folder:

public void pathInfo() {

Path path = Paths.get("c:\\Temp\\temp");

System.out.println("Number of Nodes:" + path.getNameCount());

System.out.println("File Name:" + path.getFileName());

System.out.println("File Root:" + path.getRoot());

System.out.println("File Parent:" + path.getParent());

}

The console output would be:

Number of Nodes:2

File Name:temp.txt

File Root:c:\

File Parent:c:\Temp

Deleting a file or directory is as simple as invoking a delete method on Files (note the plural) class. The Files class exposes two delete methods, one that throws NoSuchFileException and the other that does not.

The following delete method invocation throws NoSuchFileException, so you have to handle it:

Files.delete(path);

Where as Files.deleteIfExists(path) does not throw exception (as expected) if the file/directory does not exist.

You can use other utility methods such as Files.copy(..) and Files.move(..) to act on a file system efficiently. Similarly, use the createSymbolicLink(..) method to create symbolic links using your code.


File change notifications

One of my favorite improvements in the JDK 7 release is the addition of File Change Notifications. This has been a long-awaited feature that's finally carved into NIO 2.0. The WatchService API lets you receive notification events upon changes to the subject (directory or file).

The steps involved in implementing the API are:

  • Create a WatchService. This service consists of a queue to hold WatchKeys
  • Register the directory/file you wish to monitor with this WatchService
  • While registering, specify the types of events you wish to receive (create, modify or delete events)
  • You have to start an infinite loop to listen to events
  • When an event occurs, a WatchKey is placed into the queue
  • Consume the WatchKey and invoke queries on it

Let's follow this via an example. We create a DirPolice Java program whose responsibility is to police a particular directory. The steps are provided below:

1. Creating a WatchService object:

WatchService  watchService = FileSystems.getDefault().newWatchService();

2. Obtain a path reference to your watchable directory. I suggest you parameterize this directory so you don't hard code the file name.

path = Paths.get("C:\\Temp\\temp\\");

3. The next step is to register the directory with the WatchService for all types of events:

dirToWatch.register(watchService, ENTRY_CREATE, ENTRY_MODIFY,

ENTRY_DELETE);

These are java.nio.file.StandardWatchEventKinds event types

4. Initiate the infinite loop and start taking the events:

while(true)

{

WatchKey key = watchService.take(); // this would return you keys

}

5. Run through the events on the key:

for (WatchEvent<?> event : key.pollEvents()) {

Kind<?> kind = event.kind();

System.out.println("Event on " + event.context().toString() + " is " + kind);

}

For example, if you modify or delete the temp directory, you would see statement as shown below on the console respectively:

Event on temp is ENTRY_MODIFY

Event on temp is ENTRY_DELETE

The relevant methods of the DirPolice source code are posted below (download the full source code):

/**

* This initiates the police

*/

private void init() {

path = Paths.get("C:\\Temp\\temp\\");

try {

watchService = FileSystems.getDefault().newWatchService();

path.register(watchService, ENTRY_CREATE, ENTRY_DELETE,

ENTRY_MODIFY);

} catch (IOException e) {

System.out.println("IOException"+ e.getMessage());

}

}

/**

* The police will start making rounds

*/

private void doRounds() {

WatchKey key = null;

while(true) {

try {

key = watchService.take();

for (WatchEvent<?> event : key.pollEvents()) {

Kind<?> kind = event.kind();

System.out.println("Event on " + event.context().toString() + " is " + kind);

}

} catch (InterruptedException e) {

System.out.println("InterruptedException: "+e.getMessage());

}

boolean reset = key.reset();

if(!reset)

break;

}

}

Fork and Join

The effective use of parallel cores in a Java program has always been a challenge. There were few home-grown frameworks that would distribute the work across multiple cores and then join them to return the result set. Java 7 has incorporated this feature as a Fork and Join framework.

Basically the Fork-Join breaks the task at hand into mini-tasks until the mini-task is simple enough that it can be solved without further breakups. It's like a divide-and-conquer algorithm. One important concept to note in this framework is that ideally no worker thread is idle. They implement a work-stealing algorithm in that idle workers "steal" the work from those workers who are busy.

The core classes supporting the Fork-Join mechanism are ForkJoinPool and ForkJoinTask. The ForkJoinPool is basically a specialized implementation of ExecutorService implementing the work-stealing algorithm we talked about above.

We create an instance of ForkJoinPool by providing the target parallelism level — the number of processors as shown below:

ForkJoinPool pool = new ForkJoinPool(numberOfProcessors)

Where numberOfProcessors = Runtime.getRunTime().availableProcessors();

However, the default ForkJoinPool instantiation would set the parallelism level equal to the same number obtained as above.

The problem that needs to be solved is coded in a ForkJoinTask. However, there are two implementations of this class out of the box: the RecursiveAction and RecursiveTask. The only difference between these two classes is that the former one does not return a value while the latter returns an object of specified type.

Here's how to create a RecursiveAction or RecursiveTask class that represents your requirement problem (I use the RecursiveAction class):

public class MyBigProblemTask extends RecursiveAction {

@Override

protected void compute() {

. . . // your problem invocation goes here

}

}

You have to override the compute method where in you need to provide the computing functionality. Now, provide this ForkJoinTask to the Executor by calling invoke method on the ForkJoinPool:

pool.invoke(task);

Supporting dynamism

Java is a statically typed language — the type checking of the variables, methods and return values is performed at compile time. The JVM executes this strongly-typed bytecode at runtime without having to worry about finding the type information.

There's another breed of typed languages — the dynamically typed languages. Ruby, Python and Clojure are in this category. The type information is unresolved until runtime in these languages. This is not possible in Java as it would not have any necessary type information.

There is an increasing pressure on Java folks improvise running the dynamic languages efficiently. Although it is possible to run these languages on a JVM (using Reflection), it's not without constraints and restrictions.

In Java 7, a new feature called invokedynamic was introduced. This makes VM changes to incorporate non-Java language requirements. A new package, java.lang.invoke, consisting of classes such as MethodHandle, CallSite and others, has been created to extend the support of dynamic languages.

Wrapping up

As we've covered, Java 7 has a few bells and whistles that should put smiles on developers' faces, and the open-source collaboration and support for dynamic languages via JVM extensions should also be well received by those outside the Java community.



Related:


September 01 2011

Developer Week in Review: HP fires up the TouchPad production line one more time

Dear Waters Near Africa,

I know that you're very proud of the tropical depressions that you raise, and I'm sure that watching your "little babies" develop must bring you a lot of joy. It pains me to tell you, however, that one of your offspring, I think her name is Irene, went on a bender last week and totally trashed our coast. And if that isn't bad enough, I hear you have another little hellion called Katia eyeing our back yard with malice. If you can't control your children, I'm afraid we're going to have no choice but to call the police, or possibly NOAA, and ask them to do something about the situation. Thanks.

You can help my personal disaster recovery program (hey, propane for the generator doesn't grow on trees, you know ... well, actually, it did a few million years ago ...), by buying my new book, now available in early release. Read the book that helped Oprah lose weight, landed Gwyneth Paltrow her first acting gig, and got Barack Obama elected. While we can't promise the same amazing results for you, it does have a lot of good stuff in it about enterprise iOS development.

In non-flood-related news ...

At Crazy Bill Hewlett's House of Tablets, we're giving them away!

HP TouchPadWhen HP called it quits on its attempted iPad-killer, the TouchPad, most folks chalked it up to another attempt by an industry dinosaur to become one of the hip new kids. And it was no surprise that HP tried to clear its inventory by fire-saling the remaining inventory at a bargain-basement price.

What has everyone scratching their heads is that, as TouchPads disappeared off shelves at the low, low price of $99, someone over at HP decided it made sense to restart the production line and make more units to sell at the same discounted price. Given that the best estimates show HP losing around 200 clams per unit at that price, the company seems to be pursuing a somewhat questionable business model.

It may make sense if HP is trying to build interest in WebOS in front of a potential sale to buyers such as Samsung, though at least some buyers of the discounted units seem more interested in hacking them to run Android rather than stay with the native OS. In any event, if you're interested, run out and get one before the last run sells out ... Unless HP decides to do another last run ...

There's a joke about geese leaving the nest here, somewhere

Google has a history of acquiring big names in the industry to enhance its prestige as a leading software research organization. When Google hired James Gosling, who is considered one of the fathers of Java, it was seen as another feather in its cap, adding to a cadre that includes such notables as Mac pioneer Andy Hertzfeld (most recently responsible for designing the Circles feature in Google+) and Vim developer Bram Moolenaar.

It appears that for Gosling, Google wasn't so much a destination as a rest stop, however. After only a few months on the job, he's flown the coop, off to join a new startup designing autonomous ocean-going robots. If I had to guess, I'd say that Gosling decided he'd rather be a big fish at a small company solving a challenging and cool problem, as opposed to being part of a brain trust at a large one. Hey Google, I'm still available!

Strata Conference New York 2011, being held Sept. 22-23, covers the latest and best tools and technologies for data science — from gathering, cleaning, analyzing, and storing data to communicating data intelligence effectively.

Save 30% on registration with the code ORM30

Apple lost another phone?

While you're pondering the wisdom of HP, here's another puzzler to chew on. If you had just gotten over the embarrassment of having one of your top-secret product prototypes left in a bar, and ending up in the hands of Gizmodo, wouldn't you make doubly sure that you kept track of where the next ones went?

Well, evidently, there's a lot of after-hours drinking going on at Apple because, once again, a next-gen iPhone became separated from its owner at a watering hole.

The more cynical among the press have suggested that it's actually all just a publicity stunt, though given that the police were brought in, I tend to doubt it since filing a false report is not a trivial charge. I blame the new iPhone Drinking Game App in iOS5. You know, the one where you have to take a drink whenever you pull out your phone to settle a trivia dispute at a bar.

Got news?

Please send tips and leads here.

Related:

August 03 2011

Developer Week in Review: Lion drops pre-installed MySQL


A busy week at Casa Turner, as the infamous Home Renovations of Doom wrap up, I finish the final chapters of "Developing Enterprise iOS Applications" (buy a copy for all your friends, it's a real page turner!), pack for two weeks of vacation with the family in California (Palm Springs in August, 120 degrees, woohoo!), and celebrate both a birthday and an anniversary.



But never fear, WIR fans, I'll continue to supply the news, even as my MacBook melts in the sun and the buzzards start to circle overhead.

The law of unintended consequences

Lion ServerIf you decide to install Lion Server, you may notice something missing from the included software: MySQL. Previous releases of OS X server offered pre-installed MySQL command line and GUI tools, but they are AWOL from Lion. Instead, the geek-loved but less widely used Postgres database is installed.

It seems pretty obvious to the casual observer why Apple would make this move. With Oracle suing Google over Java, and Oracle's open source philosophy in doubt, I know I wouldn't want to stake my bottom line on an Oracle package bundled with my premiere operating system. Apple could have used one of the non-Oracle forks of MySQL, but it appears they decided to skirt the issue entirely by going with Postgres, which has a clear history of non-litigiousness.

Meanwhile, Oracle had better be asking themselves if they can afford to play the games they've been playing without alienating their market base.

South Korea fines Apple 3 million won, which works out to ...

Apple has bee been hit with a penalty from the South Korean government that's a result of the iPhone location-tracking story that broke earlier this year. Now, Apple may have more money than the U.S. Treasury sitting in petty cash right now, but it will be difficult for them to recover from such a significant hit to their bottom line: a whopping 3 million won, which works out to a staggering ... um ... $2,830. Never mind.

Strata Conference New York 2011, being held Sept. 22-23, covers the latest and best tools and technologies for data science -- from gathering, cleaning, analyzing, and storing data to communicating data intelligence effectively.

Save 20% on registration with the code STN11RAD

Java 7 and the risks of X.0 software

Java 7 was recently released to the world with great fanfare and todo. This week, we got a reminder why using an X.0 version of software is a risky endeavor. It turns out that the optimized compiler is really a pessimized compiler, and that programs compiled with it stand a chance of crashing. Even better, there's a chance they'll just go off and do the wrong thing.

Java 7 seems to be breaking new ground in non-deterministic programming, which will be very helpful for physics researchers working with the Heisenberg uncertainty principle. What could be more appropriate for simulating the random behavior of particles than a randomly behaving compiler?

Got news?

Please send tips and leads here.

Related:

July 28 2011

Developer Week in Review: Linux turns the big 3.0

I have been informed by the contractors, currently starting in on bathroom renovation No. 3 at our house, that my official designation is "Houston." This is because, pretty much every day, they call me at work and say "We have a problem." If you think patching bugs in legacy code written by someone who has left your company is bad, try getting work done on a 215-year-old house.



While the rest of the O'Reilly family is out cavorting in the wilds of Portland at OSCON, a few of us must tend the fires back East, and keep the rest of the world informed on what's going on. Such as ...



The new Linux is out, the new Linux is out!

LinuxIt used to be, when COBOL developers roamed the Earth, that a new release of the Linux kernel was a cause for much excitement, especially something as momentous as a new major version. Can anyone every remember when Linux 1.x became Linux 2.0? Here's a hint, it was 15 years ago.



But times have changed. Very few people install a Linux kernel directly anymore. Most get them through the distribution they have chosen. And for people who have embedded versions of Linux, they may not have the slightest idea what version of the kernel they're running. Ask a random sampling of HTC Android users what kernel is installed, and you'll probably get a blank stare (here's a cheat sheet, if you're interested.)

Adding to the ho-hum nature of the 3.0 release is that fact that there's really nothing special in it, by Linus' own admission. He just figured it was time to stop endlessly adding to the 2.0 version tree, and get a clean start on the 3's. With the 20th anniversary of the famous Linux Letter coming up in late August, now is probably as a good a time as ever to put the terrible twos to bed for good.

Here's a fun question to ponder, though: How many build scripts that assume "2.6.X" or "2.X.X" as a Linux version number are about to break?

Hoist with their own petard

It behooves people to remember, in this day and age, that the things they say and write may come back to haunt them. Thus, when trying to make the case that the Android operating system is an unholy misuse of Java, it would have been good for Oracle to remember that there was a letter floating around from 2007 in which Sun CEO Jonathan Schwartz offers Google a warm greeting, and pledged to work aggressively to cooperate with Google on Android.



There's a certain sweet symmetry in Oracle's battle against the search engine giant being potentially derailed by material from deep in the web's archives. It was legal eagles at Groklaw who uncovered the letter, but I'm sure there was much Googling involved in finding it.



Strata Conference New York 2011, being held Sept. 22-23, covers the latest and best tools and technologies for data science -- from gathering, cleaning, analyzing, and storing data to communicating data intelligence effectively.

Save 20% on registration with the code STN11RAD

You have to admire Lodsys' ambition

Not content with suing the smaller fry of the iOS and Android ecosystem, patent "leveragers" (I'd use a less kind word there, but my editor would just change it ...) Lodsys has taken their patent fight to some truly big fish. In new legal action, Rovio (the makers of "Angry Birds"), EA, Take Two Interactive ("Grand Theft Auto") and Atari have found themselves in the defendant box.



The continuing suits, which revolve around in-app purchases, could prove an interesting line in the sand. Apple has licensed rather than litigated in the past, but the signs so far are that Apple (which already paid Lodsys once for the use of the patents) has decided that enough is enough. By dragging big players such as EA into the fray, Lodsys may be making the same mistake that SCO did when they dragged IBM and other large corporations into their Linux litigation. Big companies have large legal teams, and at some point, Lodsys may find themselves worse off than if they had just taken their money and run.


Got news?

Please send tips and leads here.

Related:

July 24 2011

What's happening at OSCON Java ?

This year at OSCON we're highlighting Java. Edd Dumbill and I talk about his Seven reasons you should use Java again Radar post and the upcoming sessions at OSCON Java.

The post received quite a few comments and we share our thoughts on them as well as the the OSCON Java program in the associated podcast.

OSCON Java 2011, being held July 25-27 in Portland, Ore., is focused on open source technologies that make up the Java ecosystem. (This event is co-located with OSCON.)

Save 20% on registration with the code OS11RAD


July 19 2011

Ruby is for Java

If your architecture involves both Java and Rails on the server-side, there's a good chance you've had to do some creative engineering over the past few years to deploy your application.

In the associated audio interview Bob McWhirter, JBoss Fellow, Codehaus Despot, and creator of TorqueBox, discusses the boundary between Java and Ruby and his efforts to make Torquebox "a real first-class Ruby platform that works the way Rubyists expect".

McWhirter will expand on many of these ideas during his session at next week's OSCON Java conference in Portland, Ore.

An Interview with Bob McWhirter on Torquebox, Java, and Ruby


(For the textually inclined, a full transcript from the McWhirter interview is posted below).

Bob McWhirter: I am Bob, Bob McWhirter. I have a couple of titles, I guess, but currently I am the JBoss Fellow with Red Hat, which means I get to go do research and development and figure out what the next cool things we're going do are.

Previous to that, of course, I was the founder of The Codehaus, and I've been involved in open source for probably 10 years now, if not longer.

Tim O'Brien: What is your session going to be on?

BM: The session that I'm giving these days is typically talking about the power of Java, but with the beauty of Ruby, that you don't have to start over from scratch just because you change languages. You can take all the great stuff you know, whether it's third-party libraries you're using or if it's your own legacy components and be able to use them and take baby steps into the world of Ruby and to taking advantage of the beautiful expressiveness of Ruby.

TO: Java programmers learning Ruby. Is that a wave that's already passed or do you think that's a wave that's just starting to crest?

BM: I think we kind of go in a couple of cycles here, honestly. There was a big surge in Ruby a couple years ago where a lot of Java people just got pissed off and annoyed with Java enough to jump over to the world of Ruby. That was kind of a rebellion, if you will, kind of a heartbreak where they gave up on Java and moving over to Ruby.

I think now, though, we're seeing a more rational kind of move of people who want to just add Ruby to their toolbox. Not necessarily trying to rebel against Java and get away from Java, but just trying to get away from quite so much Java.

One of the things I'm seeing more of is where people are taking their legacy components, but let's say, rewriting a front end in Ruby. Their view layer or whatnot, or maybe building small little departmental type of applications with Ruby just to get their toes wet. And really evaluating it in earnest, as opposed to as a rebellion or as a fed-up-ness with Java or whatnot.

We support CDI in TorqueBox, so you can inject your Java bit over into your Rails application and use them. You can get started really quickly and really easily with your existing stuff and just "let's throw up a new web page that's written in a Rails app or a Sinatra app".

I think we're just at the beginning. I think as JRuby gets better and as things like TorqueBox continue to improve - and particularly if we ever get, let's say, a supported offering behind it where you can go choke Red Hat's neck if something breaks - then I think that will give more enterprises the comfort level they need to move over to Ruby or to start experimenting more with Ruby.

I don't think it's passed us by. I don't think we've missed this boat and we're going to lose it to Scala, however it's pronounced, or anything. I think the market will continue to grow for Java people who are moving over to Ruby.

OSCON Java 2011, being held July 25-27 in Portland, Ore., is focused on open source technologies that make up the Java ecosystem. (This event is co-located with OSCON.)

Save 20% on registration with the code OS11RAD

Torquebox: What problem does it solve?

TO: You were working on Ruby and Java stuff for a while, a couple years now, three or four years?

BM: Yeah, a little over two now, about two and a half.

TO: Why did you start paying attention to this?

BM: It's a little on the winding road. I joined JBoss four years ago, I guess, and I joined as a manager and I learned pretty quickly that I'm not a very good manager. So I took a sabbatical from the job for about three months. With a friend of mine, who I now work with, we started trying to do a startup and we, like any other startup, we did it with Ruby on Rails.

I really liked that environment and I had used Ruby on Rails before, of course, building the Codehaus. I really liked it, but my sabbatical was up, the startup failed, and I had to go back to this Java Corporation. I'm thinking, "Well, what can I do to take my love of Ruby on Rails and still get a paycheck from the Java Corporation?"

Thankfully, JRuby exists, and start gluing it onto JBoss AS. Being a fellow thankfully meant that I didn't have to produce revenue pretty quickly or anything. So I could take the time to look at how do we take JBoss AS5, at that point in time, and glue JRuby to it and make a good experience for Rubyists. And also give Java people an alternative, if you will, a way to start playing with Ruby without having to change their entire platform.

My first goal was really just to get Rails running on top of JBoss using JRuby. Then from there it's like, "Well, we got that done. Let's add to it. Let's do more. Let's make it enterprise-y."

TO: Coincidentally, JRuby was a product of Codehaus. It still is.

BM: Yeah, it's had a weird history. Charlie Nutter kind of drives it now with Thomas Enebo. But they weren't the founders. I'm not sure who actually started the project. At some point it was over at Kenai for a while, Sun community. Then part of it was at Codehaus. Then I don't know what Kenai is up to or Java.net.

It's unfortunately one of those projects that's scattered around. But the fact that it's having some touches with Codehaus, I think, does make it easier for me to work with those guys and get to know them and have a little mutual respect because TorqueBox ultimately benefits them and JRuby certainly benefits TorqueBox. So it's a very symbiotic relationship I have with those guys.

TO: What was the main technical problem that you were trying to solve?

BM: It's really kind of two-fold. The first problem doesn't involve JRuby Rack. It actually involves Warbler, or previous to that it was GoldSpike, I believe it was called. Which is where you can take your Rack application or your Rails application, bundle the JRuby Rack and stuff it inside a WAR file. Then you go deploy this WAR like you would any other WAR file. Your app server doesn't know anything other than WAR file.

The problem I have with that is that I'm having to stuff everything inside a WAR file, basically a packaging step. One of the beauties about Rails work is that you can edit your files there, live, on disk. You have your whole source tree laid out and your app is running from that source tree on disk. There is no compilation. There is no packaging. I edit a model. I edit a view. I edit a controller. Those changes are picked up live. If I have to stuff everything inside a WAR file I've broken that quick development cycle. I now have to edit code, package, deploy, and then test.

With regular Rails development I just edit and I go to my browser and hit refresh and I see my changes immediately. That was what I didn't like about Warbler as far as a way to deploy Rails applications on Java app servers. Certainly made it possible, but it didn't make it fun and easy and it lost a lot of the cool stuff you get from developing in Rails in the first place.

Now, that's not such a big deal if you're developing just vanilla Rails apps that run the same way under MRI, traditional Dbase Ruby or run under JRuby inside a WAR. You can develop under one platform, package it and deploy under another. But there you're only dealing with the web part of the problem.

That's the second half of what I was trying to attack, was that our apps are so much more than web and Rails is only just web, Rack is only just web. But what we do for daemons, what do we do for handling message queues, that kind of stuff.

That's where I find a lot of the fun development going on in TorqueBox. We get to take these functional solutions that the Java world has and map them down to the Ruby APIs or create Ruby APIs for them and make it a joy to work with like message driven Beans, if you will, from Ruby where you never have to think about message driven.

Once you do that then you can't do this kind of stuff under MRI, traditional Ruby, so you can't just develop an app under MRI and bundle up in a WAR and send it over to your app server. So that's where we decided to try to make TorqueBox a real first-class Ruby platform that works the way Rubyists expect. No more packaging in to WAR files or anything with Warbler.

Then also give them more than just the web components. That's where we start bringing the message listeners, start bringing scheduled jobs and daemons and things to the app server.

July 15 2011

Top stories: July 11-15, 2011

Here's a look at the top stories published across O'Reilly sites this week.


What is HTML5?
HTML5, when used both as the 21st century web suggests and as the original HTML specification allows, is best at interconnecting things.
Who leads the Java parade?
Are any of the companies in the Java community willing to exercise technical leadership? Mike Loukides says the real leader needs to stand up.
If you can quantify the self, can you also program it?
Fred Trotter is examining the Quantified Self through the lenses of motivation, behavioral economics, and software. He expands on each of these topics in this interview.
Why files need to die
The idea of files and folders no longer fits today's connected world. It's time for new ways of organizing our data based on what data means, what it relates to, and how we think about the world.
Sustainable publishing is a mindset, not a format
Dennis Stovall, director of the Publishing Program at Portland State University, discusses the state of sustainable publishing and who's doing it right.




OSCON Java 2011, being held July 25-27 in Portland, Ore., is focused on open source technologies that make up the Java ecosystem. Save 20% on registration with the code OS11RAD


Reposted bydatenwolf datenwolf

The Java parade: What about IBM and Apache?

IBM and ApacheBefore I finished Who Leads the Java parade, Stephen Chin made the comment "what about IBM?" Since publication, I've had several Twitter discussions on the same question, and a smaller number over Apache. It feels very strange to say that IBM isn't a contender for the leadership of the Java community, particularly given all that they've contributed (most notably, Eclipse and Apache Harmony). But I just don't see either IBM or Apache as potential leaders for the Java community.

IBM has always seemed rather insular to me. They solve their own problems; those are big, large problems. IBM is one of the few organizations that could come up with a "Smarter Planet" initiative and not be laughed out of the room (Google may be the only other). So they're definitely a very positive force to be taken seriously; they're doing amazing work putting big data to practical use. But at the same time, they don't tend to engage, at least in my experience. They work on their own, and with their partners. Somewhat like Google, they're all the Java community they need.

"They don't engage? What about Harmony?" That's a good point. But it's a point that cuts both ways. Harmony was an important project that could have had a huge role in opening up the Java world. But when Oracle acquired Sun, IBM fairly quickly backed off from Harmony. Don't misunderstand me; I don't have any real problem with IBM's decision here. But if IBM wanted a role in leading the Java community, this was the time to stand up. Dropping support for Harmony is essentially saying that they're following Oracle's lead. That is IBM's prerogative, but it's also opting out as a potential leader.

There are other ways in which IBM doesn't engage. I was on the program committee for OSCON Java, and reviewed all of the proposals that were submitted. (As Arlo Guthrie said, "I'm not proud ... or tired"). I don't recall any proposals submitted from IBM. That doesn't mean there weren't any, but there certainly weren't many. (There are a couple of IBMers speaking at OSCON "Classic.") They are neither a sponsor nor an exhibitor. Again, I'm not complaining, but engagement is engagement, and disengagement is just that.

OSCON Java 2011, being held July 25-27 in Portland, Ore., is focused on open source technologies that make up the Java ecosystem. (This event is co-located with OSCON.)

Save 20% on registration with the code OS11RAD



Is it possible that IBM has decided that their best
strategy for Java is to unite with Oracle in pushing
OpenJDK forward? Yes, certainly. Is it likely that they felt
maintaining an alternative to OpenJDK was just a distraction to real
work? Very possibly. And it was unfair of me to characterize IBM as
insular. But good as IBM's decisions may be,
they're not the decisions of a company that wants to exercise Java
leadership.



In the long run, does this mean that IBM is any different from VMware?
Both companies have large stakes in Java, lots of expertise, lots of tools
at their disposal, and lots of competing business interests. Is it
possible that they just want to skip the politics and
get down to work? Maybe, but I think it's something
different. If the question is getting in front of the parade and
leading, IBM has its own parade: using data to solve difficult
problems about living on this planet. When you're
almost four
times the size of Oracle
, 16 times the size of Google, and 50
times the size of VMware, you have to think big. Large as the Java
community is, IBM is aiming at a larger value of "big."



Now, for the Apache Software Foundation (ASF): when writing, I thought
seriously about the possibility that the ASF might contend for leadership of the Java community. But they're just not in the race. That's not their function. They provide resources and frameworks for open source collaboration, but on the whole, they don't provide community leadership, technical or otherwise. Hadoop, together with its subprojects and former subprojects, is probably the most important
project in the Apache galaxy. But would you call the ASF a leader of
the Hadoop community? Clearly not. That role is shared by Cloudera
and Yahoo!, and possibly Yahoo!'s new
spinoff, HortonWorks.
Apache provides resources and licenses, but they aren't leading the
community in any meaningful sense.



Apache walked away from a leadership role when it

left the JCP
. That was a completely understandable decision, and
a decision that I agree was necessary, but a decision with
consequences. It's possible that Apache was hoping to spark a revolt
against Oracle's leadership. I think Apache meant what they said, that
the JCP was no longer a process in which they could participate with
integrity, and they had no choice but to leave.
Any chance of Apache retaining a significant role in the Java community ended
when IBM walked
away from Apache Harmony. Harmony remains interesting, but
it's very difficult to imagine Harmony
thriving without IBM's support. And with
Harmony marginalized, it's not clear how Apache could exert much
influence over the course of Java.

So, why did I ignore IBM and Apache? They've both opted out. They had good reasons for doing so, but nevertheless, they're not in the running. IBM and Apache might be considered dark horses in the race for Java leadership. And given that neither VMWare nor Google seems to want leadership, and Oracle hasn't demonstrated the "social skills" to exercise leadership, I have to grant that a dark horse may be in as good a position as anyone else.



Related:


July 13 2011

Who leads the Java parade?

Since Oracle's acquisition of Sun, we've been wondering who will lead the Java community. What sort of leadership is needed, and who will fill the shoes that, for better or for worse, Sun has occupied since Java was first released?

First, does the Java community need a leader? Significant portions of it are doing just fine without any "leadership," most notably the people working on big data. Their attitude seems to be "have JVM, will do great stuff, don't bother me with the politics." And granted, the politics of the Java world over the past decade have been worse than tiresome. But everyone in the Java community relies on a JVM, languages, and libraries, and none of the smaller players have the capability of maintaining and developing these themselves. What happens to the community if the JVM stagnates?

Oracle's community problem

Oracle's problem has been simple: while they've made occasional overtures and peace offerings to the Java community, they've also been, well, abusive. One need look no further than the departure of the Apache Software Foundation and Doug Lea from the JCP when it became clear that Oracle viewed the community process merely as a means to rubber-stamp their decisions. (Doug still contributes to OpenJDK, though through a stand-alone process that is then integrated into releases.) It is certainly true that Oracle is a very large company that has never had to worry much about community relations. I doubt Oracle developers expect much say in the future of the Oracle database platform. It's possible that this is just a cross-cultural faux-pas; I don't think it's Oracle's intention to kick sand into their developers' faces. I suspect it never occurred to Oracle's highest levels of management that the community would care.

In a nutshell, that's Oracle's biggest challenge. Can they win the community over, and convince participants they are at least trying to engage? Much of the creativity in the Java world has come from the community members. The current explosion of JVM languages certainly didn't originate at Sun or at Oracle, nor did most of the web frameworks in the Java space, nor did the thriving Hadoop ecosystem. At some point, developers may decide it's just not worth the hassle to be in an ecosystem where they're not respected as partners. There are alternatives: C#/Mono, the renaissance of the JavaScript space. It would be easy for enterprise developers to move to these alternatives. It would be more difficult (but not impossible) for large projects such as Hadoop or Cassandra to move. Oracle can't be displaced because they own the JVM, but I don't think they can assume the Java community won't just go elsewhere.

The puzzle of Google and Java

Google's attitude toward the Java community has been puzzling to me, though no doubt not to Googlers. Google is one of the biggest beneficiaries of the Sun diaspora, having picked up Josh Bloch several years ago, James Gosling very recently, Tim Bray and many others along the way. They've also consistently been the most creative and innovative users of the Java platform: regardless of whether you like GWT (and I don't), compiling Java to JavaScript is a brilliant and gutsy idea. App Engine's platform-as-a-service support for Java was unparalleled until Amazon announced Elastic BeanStalk. And the crown jewel, Android, is clearly the most interesting thing in the Java world today. Java ME's best hope for the future is to survive as a second-class citizen on Windows Phone 7. (I also see a sad future for a proud but fading mobile handset vendor, but that's another story.) But Google has never shown any interest in taking a leadership role. Their attitude towards most of their Java projects can be summarized as "We invented it; we use it; we like it; if you want to try it, go ahead; we don't particularly care whether it succeeds on a larger stage."

Google supports an active user group program (GTUGs), but as you would expect, they cover the whole range of Google technologies, not Java as such. And, like most technology user groups, GTUGs are largely inward facing; they don't create a lot of news on their own. Google's presence in the Java community at large is surprisingly low key.

I've been puzzled by this attitude, though perhaps it isn't strange. Google is a very large company that's interested in many things, from medical records to self-driving cars. But they know exactly where their money is coming from, and that's their advertising business. Projects that are related to selling advertising get marketing effort; projects that protect their ability to sell advertising in the future get marketing effort (I've argued that that's the motivation behind Android, and it's certainly somewhere in the background behind Chrome); but projects that are merely internal tools that they release to the public get short shrift. App Engine? Google is interested in providing tools to help developers build applications, but I don't think they see App Engine as a moneymaker; they're willing to let Amazon be the leader in cloud services. Contentious Java community relations? For Google, that's a distraction. Google's own Java developers are all the community it needs. Google has the resources to maintain its own JVM, should it come to that. That's probably a reasonable corporate policy, but it does not do the Java community any good.

OSCON Java 2011, being held July 25-27 in Portland, Ore., is focused on open source technologies that make up the Java ecosystem. (This event is co-located with OSCON.)

Save 20% on registration with the code OS11RAD

VMware's role in the Java world

VMware probably acquired more talent from the Sun diaspora than any single company. And they've also made some interesting purchases over the years: SpringSource gave them a viable alternative platform to Java EE, with the Groovy language thrown into the bargain. They have made some very important moves with their open cloud platform, CloudFoundry: an open-source platform as a service (PAAS) framework that features a wealth of open source frameworks, including Spring, Rails, Sinatra, Node.js, and Grails and other JVM-based technologies. Again, Java is so important to the enterprise computing space that building a cloud platform around Spring is a no-brainer. But outside of the Spring community, VMware has played their cards close to their chest. Am I the only person who has had trouble figuring out where they're going or what they're doing?

VMware's aims are not unlike Google's. They have more to be gained from the success of their properties — Spring and Grails are much more than tools for internal use. But they're very focused on larger corporate goals, as they try to move from domination of the virtualization world to domination of cloud computing. Their latest purchases show that they see the cloud as providing corporate applications to end users. With the addition of Socialcast to their portfolio, it's clear they see that cloud computing is essentially social, and that thriving companies must have a social component. All this is well and good, but it's a strategy that can succeed with or without Java. While they have a definite interest in seeing Java's Open Source community prosper, as far as I know they haven't shown any interest in the community as a whole. They've bought companies formed around open source projects, but they haven't, at least up until Cloud Foundry, started any projects of their own. And while Cloud Foundry provides a great platform for running Java applications in the cloud, it isn't itself a Java project: it's written largely in Ruby on Rails and Erlang.

So while VMware has an important role in the Java community, they're not a Java company as such. Indeed, they're using what they see as the best tool for the job. That's certainly a good practice, and perhaps the hard lesson we've learned after a decade or so of language wars. VMware has talent and some wisdom — but as a company, I don't think there's a desire to be a community leader.

What do we want from a Java community leader?

JavaPerhaps we should be asking the bigger questions: What do we want from a community leader? Is that role necessary at all, or is it just a holdover from Sun's often inept attempts to deal with the movement they created? I've already mentioned maintenance of the JVM, and the job of pushing it (and the language) into the future. We've debated new language features long enough; at some point, someone had to own the job of implementing Java 7, with closures or without. Oracle has taken on that task, and succeeded. I think they've made some hard decisions, and good ones: deferring closures until Java 8, while keeping the invokedynamic bytecode instruction that makes it easier to implement dynamic languages in the JVM. Bringing Java 7 to closure (if not bringing closures to Java 7) is a significant achievement, and something that could have wandered on for years under Sun's leadership.

But is that all we want? Sun's tenure as leader of the Java community was stormy, with Sun probably not getting enough credit for keeping the fractious participants together. As I said many times, the JCP was the "least dysfunctional standards group out there." But that came at a cost. In my admittedly idiosyncratic reading, the train-wreck that was EJB 2 came from Sun's inability to say "no" to powerful vendors, who wanted certain kinds of features. If you remember JINI (and you probably don't), Sun's marketing told a bizarre story about Jini-enabled Internet refrigerators, rather than treating it as an enterprise technology that would compete with J2EE. As a result, JINI died a slow death. The history of Java is littered with initiatives (Java Media; Java Communications; even JavaFX, in which Oracle has taken a renewed interest) that Sun hyped briefly because it fit their strategy du jour, then dropped.

I'm not asking for Oracle, Google, or VMware to re-start any of these dead technologies. That's probably water over the dam, though should it happen, I'd be cheering. But being a technology leader doesn't just mean declaring yourself a leader and standing in front of the parade. You have to understand where the parade is going and lead. And that's a deeper role than just pushing the Java language and the JVM into the future. It requires understanding what developments are important, and valuing those developments for what they are even if it conflicts with your own story. It requires pushing back against other JCP organizations that "need" arcane features at the cost of sane design. And it requires doing so without appearing to abuse the good will of the millions of developers working with, and on, Java. Are any of the companies in the Java community willing to exercise this kind of technical leadership? Are there any organizations willing to think about what features the Java platform really needs, and bring those ideas to fruition? That's what we need for leadership in the Java community. It's time for the real leader to stand up.



Related:


July 11 2011

JavaFX 2.0: Making RIA with Java

JavaFXAs far as Rich Internet Applications (RIA) are concerned, the major player for the last decade has been Flash, and its successor Flex. Silverlight has had its supporters as well, and HTML5 is moving the ball forward from AJAX and CSS. And then there's Java.

After a brief stint of popularity, Java applets fell out of style, and even sites that used Java in the back-end rarely used it on the client side. JavaFX, now in its second generation, is an attempt to bring Java back onto the client side, and Jim Weaver is a big fan. Founder of JMentor, Weaver thinks that JavaFX brings a rich programming environment to the client, he'll be talking about that at OSCON later this month. He recently clued us in on why he thinks JavaFX is such a strong contender.

Can you give us a short history and description of JavaFX?

Jim WeaverJim Weaver: JavaFX came out in 2007. It was created by a guy named Chris Oliver, and it was introduced as a way to be able to quickly and intuitively put together rich client Java user interfaces. Developers in general, and the industry in general, rejected JavaFX primarily because it was a new scripting language. They didn't want to learn a language, so it just didn't get the traction that it needed.

After Oracle acquired Sun, they took a different direction with JavaFX. They abandoned JavaFX Script, the scripting language for it, and made JavaFX a set of libraries, APIs and run time. You code it in pure Java or any Java domain-specific language. That's the focus now. The new version just got out of early access and into a very early beta in June, and it's starting to get some traction with developers trying it and using it for smaller applications.


OSCON Java 2011, being held July 25-27 in Portland, Ore., is focused on open source technologies that make up the Java ecosystem. (This event is co-located with OSCON.)

Save 20% on registration with the code OS11RAD


The argument could be made that with Flash/Flex so ubiquitous on browsers now, and HTML5 gathering steam, another RIA platform is redundant.

Jim Weaver: I have nothing bad to say about Flex. I think Flex has been a great rich-client environment, and they've done a great job with deployment of the run times, except for iPhone and iPad.

The reason why I don't use Flex is because it's not Java. It doesn't have the millions of Java classes that are available out there and the richness of the native Java APIs. You find yourself having to use some bridging technologies. So that's why I'm pushing for Java. But there's nothing wrong with Flex. Flex is great.

I do see a lot of advances in HTML5. I think there's a lot of misconceptions and expectations that need to be calibrated around what HTML5 is: rate of adoption, rate of compliance on different browsers, and that kind of thing. Fundamentally, you're still talking about trying to make browsers an application execution platform. You're still working with JavaScript and you're still trying to shoehorn some technologies.

The mix that I'm shooting for would combine HTML5 and rich-client Java in a number of ways: it would be rich-client Java, web-started, that contains JavaFX APIs for its richness on the client, with a scene graph that contains UI controls, effects, animations and transformations. JavaFX has an embedded web browser component that you can use as part of the scene graph, and it's adopting the HTML5 standard.

The other way of doing it would be the exact opposite, where you have a browser and it's got an app that has JavaFX. I don't like that as well because then you depend on the browser for your JVM and your Java execution environment.



Related:


Older posts are this way If this message doesn't go away, click anywhere on the page to continue loading posts.
Could not load more posts
Maybe Soup is currently being updated? I'll try again automatically in a few seconds...
Just a second, loading more posts...
You've reached the end.

Don't be the product, buy the product!

Schweinderl