Thursday, December 27, 2012

What's for Java in 2013?

Hi all. I just wanted to share some information about what's for the Java technology in 2013, this is from my point of view and from the conferences I've attended this year, but as the Oracle safe harbor statement says: "... While these forward-looking statements represent our current judgment on what the future holds, they are subject to risks and uncertainties that could cause actual results to differ materially ..."

  • A new Java User Group will be born in Cali, Colombia. So if you are around stay tuned. This is my contribution to the community, hopefully we'll get many active members and lots of hackathons, meetings and information sharing.
  • Java SE 6 End-Of-Life (EOL) is estimated for February 2013. It means that you won't get any other update for your Java SE 6 (unless you buy the Java SE Support), but it doesn't mean that Java SE 6 will disappear, you can still download this version in the Java Archive, but you are encouraged to update to Java SE 7, which has been around since July 2011.
  • Oracle will be promoting the Oracle Java Embedded Suite: a full suite for embedded devices which consists of Java SE Embedded 7 runtime, Java DB, Glassfish Server and Jersey WS Framework. You can install this suite on the Raspberry Pi for your projects... nice!
  • JavaFx will continue its development. There's lot of documentation online to learn this technology and you can even install JavaFx apps on embedded systems like the RaspberryPi, check this post by Stephen Chin.
  • Java EE 7 will be released on the first quarter of 2013, around April. Great new features, check them out!
  • Java 8 will be here! The new release of the Java SE will be announced during the second semester of the year, so you better start using Java SE 7 before you get outdated... 
  • Java One 2013 Save the Date: now we have dates for the conferences around the globe, I guess Java One LAD (Brazil) will be held on December at São Paulo.

A lot to come! I hope you can join or create a Java User Group in your area, or blog about the Java technology, or attend to the conferences... anything would be great for the community.


Happy new year!

Wednesday, December 26, 2012

Iterator Pattern and Java

Hello all, in this post we'll be checking on the Iterator Pattern. A design pattern that I know many of you have already used, but maybe you didn't realize it was pattern or didn't know its great value. According to the book Head First Design

The Iterator  Pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlaying representation.

Whaaaaat? Well, it says that no matter what data structure (arrays, lists, hashtables,etc.) you are using, you can always traverse it in the same way if you implement this pattern. It gives you a uniform way of accessing the elements of your data structures (aggregates), but you don't have to know what kind of data structure you are traversing... nice!
Also, it sets the responsibility of iteration on the Iterator object not on your data structure, which simplifies the coding in your data structure.

Let's check the classic class diagram for the Iterator pattern:


The actual class diagram for the Iterator Pattern has a few changes, specially in the Iterator class (interface), where we now have different methods as we'll see in a minute, but first, lets review each of the previous classes (or interfaces):

  • Aggregate: This is the base class (or interface) of our data structures, you can think of it as the java.util.Collection interface, which defines a lot of methods for the collection classes.
  • ConcreteAggregate: This is the concrete data structure that we'll be iterating, for example, java.util.ArrayList, java.util.Vector, etc.
  • Iterator: Base class (or interface) for iterators. You can find one in Java at java.util.Iterator. You can notice that the Java version has different methods that we'll be discussing later in this post. Here you define de methods you need in order to traverse the data structures.
  • ConcreteIterator: As you want to traverse different data structures you need different iterators. So a concreteIterator is an Iterator for the data structure you want to traverse.  

Now, let's take a look at the Java implementation of the Iterator Pattern. The following diagram was generated using Architexa's Free Tool for Understanding Code and it shows the relations between some classes of the Java Collections Framework where we can see a structure similar to the classic class diagram:


The above diagram shows only one implementation of the pattern in Java, there are a lot more, but they always use the java.util.Iterator interface; this is the interface you should use in your implementations of the Iterator Pattern when coding in Java. Let's compare both diagrams:


Classic Diagram
ConcreteIterator

Notice that the methods of the Iterator object in the Java example are different from the methods in the classic class diagram:
  • There is no +First() method. If you need to go to the first element, you have to instance a new iterator.
  • The +IsDone() method has been renamed to +hasNext().
  • The +Next() and +CurrentItem() has been merged into +next().
  • The +remove() method has been added.

So, if you ever have to work with different data structures and need a uniform way to traverse them and/or access their items, think about the Iterator Pattern:

//... in a class
  /**
   * Traverse a list, hashtable, vector, etc. what ever that implements
   * the Iterator Pattern
   */
  public void traverse(Iterator iter)
  {
     while(iter.hasNext())
     {
 System.out.println(iter.next());
     }
  }

Of course, you will always have to create the ConcreteIterator class for your data structure, but if you are using classes from the Java Collections Framework, it's already done.

One last thing, remember the most important OO Principle of all: Always use the simplest solution that meets your needs, even if it doesn't include a pattern.


See ya!


References:

Freeman Eric and Freeman Elisabeth and Sierra Kathy and Bates Bert (2004). Head First Design Patterns. United States of America: O'Reilly Media, Inc.

Wednesday, December 12, 2012

JavaOne LAD (Brazil) 2012 Days 2 and 3

Hi, I want to share my experiences in the last couple days at JavaOne LAD (Brazil). Day one has been already reviewed here.

Day Two

There was a conference about Oracle Developer Cloud Services which I liked a lot. Great move from Oracle who is moving all its apps and  infrastructure services to the cloud. With such product, you have software lifecycle tools ready to be used. Tools such as: source control management (GIT), issue tracking, Hudson CI and Wiki collaboration. The services is in Preview mode, so you have to contact Oracle in order to test it.




Next I attended a session called "Do You Like Coffee with Your Dessert? Java and the Raspberry Pi" (clever...) which introduced us to the "Raspberry Pi" a credit-card sized computer, imagine that! And you can embed java in it!! There were two live example of embedding Java in a Raspberry Pi. The first one, was a kiosk with all JavaOne LAD session information. Really nice kiosk with touch support and JavaFx.
The second one was a robot created by Vinicius Senger which uses Raspberry Pi and Glassfish Server so you can control the robot using REST WS, awesome!!





The final session of the day was given by Arun Gupta. "Java EE 7 Platform: More Productivity and Integrated HTML". Really nice session packed with the latest news about the JavaEE platform which is schedule to be released on the first quarter of 2013.

At night, Oracle invited the JUG leaders to a nice dinner. Pizza and beers for all of us and networking all around. Was great to meet several Brazil JUG Leaders and learn from their experiences and their culture.


Day Three

Last day of JavaOne LAD. Thanks to Otavio Santana who showed me the correct route to reach the expo center by Metrô as detailed in my previous post. Unfortunately, some sessions were rescheduled and I didn´t noticed that, so I missed the session "JavaFX: Implementing Multitouch with TUIO for Interactive Devices" who was given by Steven Lizarazo, the only Colombian speaker at JavaOne LAD. Congrats!

Next, Stephen Chin talked about JavaFx and HTML5, showing one demo about a JavaFx application which contains map (google map) interaction. It was nice to see how you can integrate both technologies. I skipped the next two conferences because I was presenting a quick demo about Fork/Join Framework at the OTN lounge.

The last conference I attended, was about SQA: "Testing JavaServer Faces Applications with Arquillian and Selenium" given by José Rodolfo Freitas. He showed several ways to test our applications using those frameworks. It was a crowded session, but there was no translation available... so I'm glad the slides were in english... Anyway, thanks José for checking if I was understanding portuguese. 

At the end of the day, the Community Keynote and the first ever Duke's Choice Awards where I was part of the judging panel.

The hosts of the event were Yara Senger and Bruno Sousa (the Brazil JavaMan), great JUG leaders in Brazil. They joked and talked about how we can get involved and participate in the future java by joining/creating a JUG or Adopting a JSR. They also presented some startups that leverage the power of Java for their business ideas.

The entertainment was provided by several JUG leaders who played in a band. They performed some Beatles and Java songs and it was really, really funnny. The Duke's choice Awards winners were presented. We had like 24 nominees, but only 3 could be selected as winners. It was a tough decision since there were a lot of innovation in all projects. I liked that we had several Java technologies competing, from Desktop to Web apps. And the winners were: Tqtvd tots, Cpqd and Tivit. I do have to write another post about the projects I liked the most but were not selected as winners, so you can meet them, specially two Colombian Projects: Kuwaiba and ZathuraCode.






As a regional JavaOne, it is different from the JavaOne SFO, it's smaller. Both events  Oracle OpenWorld and JavaOne are run in the same place, so some times you may find executives wearing suites and ties or developers wearing T-shirts and jeans... I heard from some other attendees that this year was a better JavaOne LAD.

What I liked:
Strong community (Brazil).
Oracle sent several speakers from JavaOne SFO.
Dinner invitation from Oracle ;)
Party invitation from Google :)
Hospitality from the JUG leaders I met.

What I didn't like:
Lack of participation from other south american countries. I mean, is JavaOne LAD (Latinamerican) but most of the attendees and speakers were from Brazil.
The food could be better or cheaper (or included in the full conference pass :p)
Poor twitter or website updates when sessions were rescheduled.
There were no Oracle stores.

Anyway, I hope I can make it for JavaOne LAD 2013 so I can go with other Colombian friends and why not, maybe we can have a first ever Duke's Soccer Cup at Brazil... nice!


see ya!

Saturday, December 8, 2012

Arriving to JavaOne LAD by Metrô

Hello all. I'm writing this post because I found some difficulties when trying to reach the Transamerica Expo Center in São Paulo where the JavaOne LAD event was taking place and I wanted to share with you some advices when taking the Metrô:
  1. Visit the Transamerica Expo Center location page. There you will find information about different ways to reach the expo center. Specially, notice that the final station when using metro is "Santo Amaro".
  2. Use google maps in order to find the stations that are near to the place you are staying at.
  3. Use the Trip Planner in the Metrô website. Using this tool you will receive specific directions for boarding and landing in the different stations. For Embarque (boarding) use the station that is near to the place you are staying at and for Desembarque (landing) use "Santo Amaro", which is the closest station to the expo center (at least at the date of this post Dec-2012).
The advantages of using the Metrô are:
  1. Cheaper than taxi.
  2. Faster than taxi, specially if you are staying away of the expo center.
  3. It's a "must do" when visiting São Paulo.
When you reach the "Santo Amaro" station, use the exit Av. das Nações Unidas, Av. Pe. José Maria:


From there, it is a 10 minutes walking to reach the expo center. Follow this instructions and you will avoid disembarking in another station like "Largo Treze" which appears near, but is not, it is a 30 minutes walking from there and believe me, you don't want to walk around there...

I was staying near Av. Paulista and this is the route I should have used from the beginning:



Ver JavaOneLAD en un mapa más grande


Special thanks to @otaviojava who helped me find the correct route.


see ya!

Tuesday, December 4, 2012

JavaOne Brazil 2012 Day One

Hello all, today I had the opportunity to attend JavaOne LAD (Brazil) 2012.

I'm writing this post right from my mobile device, so I'll be brief.
The community keynote was hosted by several java luminaries and Java Champions from Brazil such as
Fabiane Nardon, Yara Senger, Vinicius Senger, Bruno Souza and a special guest from jFokus. The talk was about getting involved with the java community: Jugs, Java Champions, JCP, etc. Inspiring.

The next conference was about The Internet of Things... Really interesting. You can find more about this at: Things-API.org

Unfortunately I was confused and I left early, missing the java technical keynote... Can't believe it!! grgr

Anyway, tomorrow is another day full of conferences and I'll be posting about the ones I like the most.

See ya!