Sunday, 22 April 2012

Roadmap of the Java platform driven by C# and .NET?

I have just finished watching the interested InfoQ talk called "To Java SE 8, and Beyond!" where Simon Ritter discusses the future of Java, taking a look at proposed features and roadmap for Java 8 thought 12.

It is absolutely clear that many of the new proposed features has been taken from C# and in this post I would like to show some comparisons.

First of all, it is important to say that the information presented in the talk are only a draft and here I would like to report the statement presented in the Oracle slides associated with the talk.

The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not berelied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

LINQ is by far my favourite feature of the C# language and Java is likely to add extension methods and lambdas to the language included the possibility to create a parallel execution.

This is something that has been introduced in C# 3.0 in 2007 and you can notice the similarities.

In C# is also possible to write the same statement using the query syntax:

The various methods are actually implemented as extension methods of the IEnumerable<T> interface.

An another idea is to simplify the references between java modules, something that we always had for the .NET assemblies.

It is interesting that for the version 9 of Java SE (in 2015 according to the roadmap) there is a plan to support multi-languages in the JVM. This is actually something that is a core design principle of .NET that allow to run VB.NET, C# and many other languages on top of the platform. In addition, this will require the definition of a unified type system in Java that in .NET is called Common Type System (CTS).

In Java 7 has been introduced the invokedynamic bytecode instruction to improve the support for not-Java languages. I don't know how to use it but it seems that there is no an easy way to use this feature at the language level. There is no comparison with the simple and effective dynamic keyword introduced by C# 4.

If this is not enough, in the JDK 10+ (2017) the unified type system will be introduced and primitives types will be removed. This basically means that Java is going to introduce value types (structs) in the picture. In .NET all of this was taken into account from the very beginning. I am quite impressed how well .NET has been designed. You shouldn't forget that this happened more then 10 years ago !!!

Also multi-dimensional arrays will be introduced in Java in the JDK 10+. Again in C# we have the multidimensional arrays for such a long time.

There are some features that has been vaguely announced that are very interesting:

  • Improve Java/Native integration and sensors support
  • Cloud support (multi-tenancy and resource management)
  • Sale down to embedded, up to massive servers
  • Hypervisor aware JVM
  • Large arrays
  • True generics
  • Performance improvements to close the gap to low-level languages
This is the announced roadmap for the next versions of the Java Platform.

The final big new is that all the code development will be open source in a project called OpenJDK.

I am very happy to see that the Java language is evolving. Anyway, I continue to be a big fan of C# and the .NET platform where the designer of the language, Anders Hejlsberg, is putting a lot of innovation in it with the main mission to improve the productivity of developers.

Sunday, 15 April 2012

2012 TopCoder Open - Qualifications

Yesterday, I participated to the Online Qualification Round 1C that is the first phase of the Worldwide 2012 TopCoder Open Turnament in the algorithm category.

If you look at the algorithm competition schedule you will see that 600 out of 2000 (the maximum number of participants per qualifications round) advances to the semifinals. My final position is 306 so I believe I advanced to semifinals but I didn't received yet an official communication from TopCoder.

The match has been intense but it has started in a very bad way. First, I opened the easy problem and I spent 15 minutes to find a solution. I couldn't come up with a solution. I was shocked because this is usually simple and I always had a first quick solution to it. I decided to move to the medium problem and the same happened. In that case, the text of the problem was too long and I hate this kind of problems so I decided to move on the hard problem. At that point, my hope was almost null because I never been able to solve a TopCoder hard problem. I focused all my remaining time to solve the hard problem and I submitted a solution and I got 448.50 points. I was happy because I knew that I discovered some subtle edge cases and I addressed them but I wasn't 100% sure that my code was fully functional (never I am).

Then the challenge phase. Only three people (included me) in the room (usually 20 people) did the hard problem. Three tentative to break my code has been done with a negative result (each person lost 25 points for this). I challenged the code of a guy that submitted a solution to the hard problem but without covering an edge case and I got 50 points. So my score became 494.80.

Then the system test. The system test is terrible because if only a single test case against a solution does not pass you automatically get a score of 0. Fortunately my code passed the system test.

I would like to share the problem and my code with you but unfortunately for copyright issues I can't. You have to register on TopCoder to have access to all the problems.

However, I can share with you my public profile information.

My total topcoder score in the algorithm category (a kind of average of all the competition you did)  is now 1167. As you can see, my last match has been significantly better than the previous. Solving the hard problem is a great achievement for me.

The most interesting chart is my global position relative to the others TopCoders (3520 out of 9334).  It is good to see that I am better positioned than the average TopCoder. My percentile is 62.2884%. As you can see I am very closed to the blue area (a score greater than 1200) and this is my next goal, an hard goal.

Competing on TopCoder is amazing and I like the adrenaline released during the competition. I strongly recommend the experience to any programmers. It doesn't matter what will be your score, what it matters is challenging yourself, improving yourself and having fun.

Book - The Developer's Code

I have just finish reading the book The Developer's Code.

This is a light book with some considerations and advices about working as a software engineer and beyond.

Here I want to summarise what I liked the most from the book:
  • Discussion about the fact that architects shouldn't stop coding remembering that the code is the glue that binds each role. So regardless of where you are in the development hierarchy, it is valuable to keep coding.
  • The importance of diversification over specialisation
  • It is better not be perfectionists because it can become exhausting. Perfect code does not exist. This means that you can event apply to speak at a conference. You don't need to be a rock-star programming hero.
  • The importance of investing in a good work environment
  • Have a single TO DO List. I found WorkFlowy and Instapaper very useful
  • The importance of the working relationships that form over time.
  • The simplicity paradox
  • The fact that once you've become an expert in a particular domain, it is nearly impossible to understand what it feels like to not understand that domain. So, when you're teaching something new you can lie and also say incorrect things to make things easier to understand.
  • The responsibilities of the project managers
  • Don't lose your appreciation, interest and understanding for what's going on under the hood

It has been a pleasant and relaxed reading.

Friday, 13 April 2012

Engagement with Michela

The 26 February 2012 I got engaged with Michela. After a lovely lunch at the restaurant, I made my declaration in the Christ's Pieces park in Cambridge. She was shocked but extremely touched and obviously she said "YES".

For a while after it, she wasn't able to walk but we have been able to do some shopping at Primark for then relaxing in front of a beautiful cappuccino at Costa.

Here some pictures that saved that magic moment forever:

Michela is 5 years younger then me but she's wise, she's romantic, she's crazy, she's beautiful, she's my life and I love her immensely. She understand me as anyone else, she's a perfect fit for me.

We are planning to get married after she finishes university in Italy (2 to 3 years) and then start our living together in UK.

"No measure of time with you will be long enough. But let's start with forever"

Thursday, 12 April 2012

Andrea Angella works in Citrix

It is one year and four months since I work in Citrix as a Software Development Engineer and it is time to show some pictures. Working here is amazing!

This is my favourite picture with the Citrix logo on the wall:

Here you can look at me doing some work.. don't look at the belly :)

"Simplicity is power" is our mantra !!!

Tuesday, 3 April 2012

Programming a Robotic Car

In the last few weeks I have been quite busy following the course "Programming a Robotic Car" on Udacitity. The course is quite demanding because it force you to implement all the algorithms presented. I think this is by far the most effective way to really learn and their on-line platform based on Python works pretty well.

These are some of the problems that can be solved with the techniques explained:

  • Localizing a robot in a map
    • Monte Carlo Localization
    • Particle Filters Localization
  • Tracking objects
    • Kalman Filters
  • Motion planning
    • A Star
    • Dynamic Programming
  • Robot Motion
    • Smoothing
    • PID Control
  • Simultaneous localization and mapping
    • SLAM
    • Online SLAM
You can access all the code in my public repository under the following path:
  • Udacity >> CS 373 - Programming a robotic car
Here few snippets of the most relevant code. 

Kalman Filter:

Particle Filter:

A Start:


PID Control:

Twiddle (used for tuning the PID control parameters):

Online SLAM: