Tuesday, July 16, 2013

Java for Hydrologists 101

There are a few postings on Java in this blog. Since I want to teach it to my students, I am quietly starting to populate this page with presentations which, eventually, will constitute the core of an informal class (;-)) the Java for Hydrologsts 101.
The focus of the JfH-101 is not simply to gain Java knowledge from the scratch (or so), but to address those topics and issues that have to do with my experience of hydrologist. So, I will try to cover Java as well as OMS3, and at the right time Geotools, and jgrasstools, not forgetting the tools of the tool (Ant, Maven, Git)^*, but in the meanwhile I will try to address the topics related to object oriented programming.  My first goal will be to rewrite the Optimal Channel Networks (OCNs) programs I already did in C several year ago in Java.  In doing so, I will touch many topics really useful for any hydrologist programmer. The schedule is ambitious, and as many other tasks I started, I am not pretty sure that (or when) I will finish it. But, possibly with contribution of others, I will arrive to something useful. Programming is actually very much not talking about  that but doing it, so many of the slides will actually recall to actions.


0 - Getting Started (mostly things to read -or start to read- before the start)
1 - Your first program (here the video on-line [download - 30 Mb] well the video is really out of focus but you can here me to comment the slides. I said a wrong thing when talking ... you have to discover the error!)
2 - Solving a linear equation (here the video on-line ...  [download - 30 Mb] a little better than the first one)
3 - Reading input data from the console (and solving linear equations) (Here again the video on-line [download - 41.1 Mb]. It includes also: a - Javadoc; b - naming conventions for Java programmers)
4 - Working with Git from Eclipse (EGit)

The source code is available for download to from GitHub.

UML - stands fro Universal Modelling Language. It is a set of graphic tools that can be used to sketch OO programs. The classical reference is Martin Fowler's, UML 2.0 distilled, 2003

^* - From the links you can quite understand the I rely very much on Lars Vogel site for the basic stuff. It is not obviously the only good resource available (stackoverflow is another one, for instance, and many others will be addressed).


  1. I am wondering, why are you teaching Java in Particular ? In your opinion, what are the essentials for a Hydrologist ...

    1. Dear Anonymous,

      I put the Essential for a Hydrologist in a new post, here: http://abouthydrology.blogspot.it/2013/07/essential-for-hydrologists.html

      Not sure that I answered to your question. However Java give me possibilities that Python does not, is Object Oriented, has a magnificent set of Open source Tools for developing, and it is not so slow as many claim. You can also look at: http://abouthydrology.blogspot.it/search/label/Java

  2. This comment has been removed by the author.

  3. I like the way you started the java exercise ( it's learning by solving the problems). Looking forwards for the next one ......