A Flex / Flash guy learning more about Java
Understanding more about Java is great. A good amount of knowledge can be shared between Flex/ActionScript 3.0 and Java. I’ve worked with Java in the past, compiled some applications, read the tutorials and some books, helped build a Java based LMS and also worked with Adobe on writing a simple Java socket server, but I wanted more of a thorough understanding of the language. The University of California at San Diego offers a great series of programming and software development courses. These classes are really affordable so I decided to take a Java II course. It’s been seven weeks and so far the experience has been awesome. The end goal is to become more familiar with the core Java language. My hope is that this will enable me to have greater confidence when working on Flex and BlazeDS projects. (A really cool stack I’ve been playing with recently is Flex/Cairngorm, the new Spring/BlazeDS integration and Hibernate/MySQL. Eventually I want to get this running on Glassfish. Something else I’ve been looking into.)
Some items we’ve covered in the Java class so far are: SDK installation and command line compilation, data types, control flow, variables/operators, numbers, arrays, objects and classes, static classes and methods, method overloading, object construction, constructor overloading, OOP basics, packages, commenting, generating JavaDoc, inheritance, abstract classes, polymorphism, sub/superclasses, reflection, inner classes, graphics programming, event handling, Swing and Collections including Maps, Lists, Sets and the Comparator interface. We’re compiling all of our homework using the command line. It’s pretty cool. The class also demands a pretty rigorous reading schedule. The three-pronged-learning-approach is working well for me: lectures, reading, coding (homework and labs.) The ins and outs of the language are really sinking in.
A few immediate benefits to learning more about Java are: Flex and BlazeDS / LCDS integration, strengthen fundamental OOP understanding and comprehension and also gain knowledge of OOP concepts not available in Flex/AS3. Learning Java also provides the opportunity to get exposure to Swing (Flex’s distant relative). Also, since the Flex compiler and other aspects of the Flex SDK are written in Java this opens up the door to greater understanding of the Flex SDK and even bug contributions. Java makes extensive use of design patterns and there is a plethora of existing Java code to look at, use and learn from. (Cairngorm was born from J2EE design patterns.)
There are several differences that I noticed in Java. Some items available in Java and not in AS3: static classes, abstract classes, private constructors, constructor overloading, method overloading and Collections. Working with Arrays is a LOT different, working with numbers is different, working with Strings is different and String comparison is different. There are no Hashmaps and no hashcodes in ActionScript. No equals() method. Another difference is that you have to implement your own design patterns more often in Java. Not a bad thing, and good to know how to do, but Flex takes care of a lot of things behind the scenes: events, data binding etc. I noticed that when coding Java the developer is expected to implement interfaces more often than in Flex/AS3. This is pretty cool; it involves more work but provides more power.
It’s been a cool experience and I wanted to share some of these thoughts and observations. I think more developers come into the Flex world from Java vs. the other way around. For some reason Java sort of reminds me of AS2… I may try to post some Java source code soon if time permits…
Original post http://seantheflexguy.com/blog/2009/02/20/a-flex-flash-guy-learning-more-about-java/
Original post http://seantheflexguy.com/blog/2009/02/20/a-flex-flash-guy-learning-more-about-java/
0 comments :
Post a Comment