jump to navigation

Review: Java Cookbook, 3rd ed., by Ian F. Darwin (O’Reilly) September 7, 2014

Posted by claudio in Uncategorized.
Tags: , , , , ,
add a comment

Java Cookbook

I am not really a fan of Cookbook style books. However, by looking at the table of contents of the Java Cookbook, it’s clear that the chapters on this book run parallel to chapters in more classical technical books, e.g. the excellent Core Java books by Horstman and Cornell. While the more classical books try hard to provide a logical structure within the chapter with the needed context (a story) to master the content, cookbooks give you independent ready-to-use recipes (yeah for metaphors!). So it’s really about getting a proven solution fast than (deep) understanding. But you should get that from the title, so no surprises there.

My specific use case is simple. I want to do some Java coding soon, and needed a quick refresh on the language. While not so long ago I used Java 7 features for a private project, most of my Java coding in the past was based on Java 6. Java 8 seems to have nice improvements, so a fresh-from-the-press Java Cookbook (3rd edition, July 2014) seemed a fast way to get up to date. With 900+ pages, “fast” is of course relative. By this standard, the books delivered.

The content is *very* varied. Some chapters needed careful reading (or even re-reading), while others could be skimmed or even skipped. Recipes include (citing the product page):

  • Methods for compiling, running, and debugging
  • Manipulating, comparing, and rearranging text
  • Regular expressions for string- and pattern-matching
  • Handling numbers, dates, and times
  • Structuring data with collections, arrays, and other types
  • Object-oriented and functional programming techniques
  • Directory and filesystem operations
  • Working with graphics, audio, and video
  • GUI development, including JavaFX and handlers
  • Network programming on both client and server
  • Database access, using JPA, Hibernate, and JDBC
  • Processing JSON and XML for data storage
  • Multithreading and concurrency

As you can see, it’s a mixture of very basic and advanced stuff and that kind of thechnical width has its risks. Some recipes are too obvious and not more useful than the javadoc showing the classic usage of a standard method of a standard class (e.g. substr from String). As such, I don’t think it can replace a good book from a “Learning/Starting” series if you’re new to Java. A similar phenomenon happened on the other side of the spectrum. For more complicated subjects (like the new functional aspects in Java (lambdas), GUI development or threading) a cooking recipe just doesn’t provide enough context to really grasp the concepts. I hope the following screenshot from the book illustrates my point (and also shows what I don’t like about java):


Try to put this in a recipe!


Despite this warning, I can say that most of the recipes are useful. By example, even the first chapter (“Getting Started: Compiling, Running, and Debugging”) was surprisingly useful because it included things like ant, maven and gradle. There is lots of content to skim (it’s OK, it’s a cookbook!), lots of interesting stuff to read, lots to use with a mental note “need to dig deeper here” and even some annoyances from time to time (I wish the author would stop pushing his own classes for trivial stuff, like removing tabs (!)).

As a conclusion we can say that if you like cookbooks, this could be a good one. If you don’t, it depends on your expectations. Mine were met, no more, no less. 3 out of 5.


Title: Java Cookbook, 3rd Edition
By: Ian F. Darwin
Publisher: O’Reilly Media
Print: July 2014
Ebook: June 2014
Print ISBN: 978-1-4493-3704-9
| ISBN 10: 1-4493-3704-X
Ebook ISBN: 978-1-4493-3703-2
| ISBN 10:1-4493-3703-1

Review: Programming Perl (4th ed) by Tom Christiansen, brian d foy, Larry Wall, Jon Orwant (O’Reilly Media) August 10, 2012

Posted by claudio in Uncategorized.
Tags: , , , , ,
add a comment


If you already program in Perl you know that “Programming Perl” is the de facto reference of the language. I haven’t met Perl Mongers citing randomly from it, but we are not that far from it :). If you’re new to Perl, well now you know what you will be reading soon.

 This brings us to the targeted public of this book and that’s a tricky question. In my opinion, if you’re new to Perl –or new to programming– you are better served by “Learning Perl” (or a similar book). On the other hand, if you are an experienced programmer you’ll learn Perl from “Programming Perl” with a deep understanding of the language as a bonus. But 1184 pages may be a little too much to get your feet wet.

Don’t return the book to Amazon yet if you take the tutorial-road: your copy will serve you well for years to come as reference for the less obvious aspects of the language (and let’s be honest, there are several). So, this book is not a tutorial book. It’s neither, unlike what I just wrote, a pure reference book. The book is very well written, with just enough humour (also: as not “too much”) to make the 1184 pages digestible to get a deeper insight of the language, something that can not be said of many reference books that are written in a “phone book” style.

The previous versions dates from the year 2000 and covers ancient perls preceding the Perl revival and modernisation we’re enjoying today. Well, if this book is so important for the language –the codification of the language as it were– and well written to be enjoyable, the authors should be lucky to not face trial for the Perl riots while waiting for the update of the book. More seriously, the update was indeed urgently needed and kudos to the authors: writing this kind of book (content and reputation) is hard. It helps that Larry, the creator of Perl, is part of the team. A great read.

“Programming Perl, 4th Edition” by Tom Christiansen, brian d foy, Larry Wall, Jon Orwant
O’Reilly Media, February 2012, 1184 pages
Print ISBN: 978-0-596-00492-7, ISBN 10: 0-596-00492-3
Ebook ISBN: 978-1-4493-9890-3, ISBN 10: 1-4493-9890-1
Programming Perl @amazon.co.uk

Some ideas on method auto-completion in Padre June 9, 2009

Posted by claudio in Uncategorized.
Tags: , , , , , ,

perlAuto-completion is a nice feature for an IDE. While Padre supports some auto-completion functions, method auto-completion is an important missing feature. This post is a short round-up of features present in other IDEs.

What auto-completion features does Padre support today?

Beside automatic bracket completion, Padre has a nice auto-completion implementation for variables (first character -including sigil- then ctrl + p):


Eclipse + Epic

Epic (an add-on to Eclipse) has a nice working auto-completion feature activated by the method invocator (->).


As a reference, the java auto-completion in Eclipse:


Komodo Edit

Komodo Edit also has auto-completion for methods, but does not show those inherited from parent classes making the feature rather useless for OO development.



Netbeans has no Perl support, nevertheless the java auto-completion feature is a good example:


The method auto-completion feature is activated by the “.” (“->” in Perl). Not only you get a list of accessible methods (with expected parameter type and return value), but also the javadoc documentation for the selected method.

How should Padre support method auto-completion? Some ideas

  1. Method autocomplete should be activated by “->” and “::”. This way class hierarchies can be autocompleted as well. With “::” support for functions can be added.
  2. Private methods should be hidden. By convention, private methods start with “_”.
  3. Linking method autocomplete to perldoc is a winner combination when programming to not yet familiar APIs and certainly friendly to new Perl developers. While Perl is not strictly typed, a well formatted perldoc entry for a method should make clear what kind of parameters are expected and what the return value could be. However, documentation is rather freely formatted, so it would be difficult to implement in a generic way (without adding formatting restriction to classes).

High-Order Perl now legally available online December 10, 2008

Posted by claudio in Uncategorized.
Tags: , , ,
add a comment

perlIn case you haven’t read it elsewhere, High-Order Perl written by Mark Jason Dominus is now legally available on-line without cost. Get it here.

Of course, if you find the book useful and/or interesting you should buy it. You will not only acknowledge Mark’s work, but you will keep the Perl book micro-cosmos alive. Books that help you learn and widen your knowledge are a must for a language to flourish (not only for languages, by the way).

Having the real thing before buying gives you the power as a programmer to decide if it’s worth your money (no one can buy 1000 books). This beats reading reviews, table of contents or even a quick look in the bookstore.

Thanks for the trust, Mark.

Use external functions/modules in korn shell (ksh) August 7, 2007

Posted by claudio in Uncategorized.
Tags: , , , , , ,
1 comment so far

The korn shell is a great shell to write shell scripts. Some functionalities are really nice. By example, you can write your functions or modules in a separate file and use it within your program. The secret lies in the FPATH environment variable. (more…)


Get every new post delivered to your Inbox.

Join 145 other followers