|
|
-
Two months ago I bought a Mac Book Pro. For some reason I just wanted to try working with MacOS. And i'm happy i did, because I'm completely in love with it since I started it first. While I didn't really plan on using it for work, I haven't really used anything else since. Windows just feels clumpsy now. And having the latest version of Office intalled I don't have any problem integrating with the rest of the company. As long as you don't plan to play games, and don't need specific windows software, you're good to go. So why do I like it that much better? First of all it is much easier to use a lot of different application windows at the same time. While the Windows taskbar gets very messy as soon as you open more than a few applications, I don't have any problem with it at MacOS. There are multiple reasons for this. First of all the dock (the thing at the bottom of the screen). This is both your start menu and the taskbar at the same time. There is no difference in switching to a running app, or starting an application. To keep the dock clean you only put the most used apps in it off course. For any other application I use a little tool called QuickSilver. This tool enables you to start applications by pressing ctrl-cmd-space and typing the first letters of the application's name. Easy. Besides the multiple window thing, it feels that MacOS is much faster. I'm run Vista on a really fast machine too, but it feels much slower. For some reason Vista has a lot of harddisk activity slowing down my machine dramatically. I turned of indexing and some other services, which helps, but it's still not perfect. It has plenty of RAM btw. I didn't have a single performance problem on my Mac however, while i'm keeping a lot of heavy applications open at the same time (Netbeans, Intelij, Eclipse, Word, Powerpoint etc.). And than the last thing. Since i'm bringing my Mac to work, every single person entering my room notices that it looks that much better... ;-)
|
-
At 26 & 27 Sebtember the QNH Radrace was held. While i'm not working for QNH, Jamie Craane invited me to be his team mate. Since we work well together I tought it would be a nice challenge and decided to join. And a challange it was. There were 15 teams competing, each using their own favourite language, frameworks and tools. The obvious choice for us was the Grails framework using Intellij. More about that choice later. The case was written by the organisation of the original Radrace, and was about a new driver licence system. Besides a lot of use-cases, the case included a large amount of data that had to be converted and reused in the application to build.
After the briefing of the case we got started by quickly importing the data into MySql. From there I started working on data conversion and some reports, and Jamie started working on the login funcitonallity. For the rest of the day everything went quite ok, no problems at any point.
While working on the case we found Grails to be extremely useful. Adding new domain classes or screens is done in a click, and each line of code you write adds functionallity. There is no boilerplate code at all which improves productivity dramatically, and GORM (Hibernate with dynamic behaviour) works great. Another plus is that it is very easy to mix ORM, which is great for CRUD like functionallity, with plain SQL. For reporting functionallity SQL just works better because you have more direct control of the queries.
While we were adding functionallity very rapidly, I didn't feel we were hacking around. The architecture of Grails would work for large projects also. If it was a real project, we wouldn't have done anything different. This is a really huge plus for Grails, you will keep your application organized by just keeping the Grails standard way of working, without having to think about it actively. This is important for real projects, were you often find that quality standards drop as soon as deadlines are coming close.
The next day we could managed to keep up the pace of the first day which resulted in winning the competition! There were two other teams scoring high. The second team being a .NET team, the third Ruby on Rails. You won't win a Radrace by just using a good framework, but I do believe it's a prerequisite for scoring high. And why would it be any different for real projects?
|
-
The JavaFX Preview is release today, just in time to make the time frame of July as announced at JavaOne this year. Congratulations to the development team :-) I just had a look at the release, and while it's not completely finished yet, it shows things are really coming together now. I'm also happily surprised to see the Netbeans plugin has improved a lot, including basic drag & drop of components. Project Nile is also part of the Preview release and includes export plugins for Photoshop and Illustrator. The one thing I'm a little disappointed about is that Swing components are still not natively usable as Nodes. You have to use a ComponentView instead. This will not be a problem any more as soon as we get a extensive set of JavaFX components. James Weaver made a nice start with this on his blog. I'm hoping there will be a rich set of components soon, this will be crucial for JavaFX to be picked up by the masses. I'll be playing around with this release the next few days, and write a more detailed post soon. You can download the release yourself from http://javafx.com. A good starting point to learn more about JavaFX is the official reference page: http://java.sun.com/javafx/reference/
|
-
I'm truly hating most IBM software. I don't like the servers (specially Portal Server), I don't like the development tooling (RAD actually makes Eclipse suck) and I don't like all the tools such as ClearQuest/ClearCase. Today I did see something from IBM that even I think is impressive however...
Peter Hendriks gave an excellent talk on our company's weekly knowlegde sharing evening about the Jazz platform and the Team Concert tooling. I did follow news around Jazz, and I attended a talk from Erich Gamma at JavaPolis about Jazz, but I was still really sceptical about it so far. This was the first time I've seen a real demo of it however, and it totally changed my sceptical opinion. Jazz actually is something you want as a developer :-)
Jazz is a complete tooling platform for software development. It contains everything a team needs such as work item tracking and planning, source control, a build system etc. But didn't we have all that allready? Yes we did, only it didn't integrate as well. In Jazz, all tooling fits together really well.
At my current project we're using CVS, Trac and Hudson for example. All good tools, but they completely lack notion of each other. And that's exactly the reason you would want a fully integrated environment, something we didn't really have in the Java world yet. The downside of this all is that IBM is not exactly giving Jazz away for free... It is for free up to 3 developers actually, but prices are going up very fast for more users. On the other hand, compared to the old Rational tools, it's really not that expensive. It's also interesting to wait and see how other vendors will react to this. Will Sun or Oracle try something similar? And what about the smaller, more specialized companies that are now dominating the commercial tooling market such as Atlassian and JetBrains?
|
-
Introduction
The last few weeks, Jamie Craane and I have been working on a small but usefull tool called Folder Visualizer. The idea of this tool is that it can scan your harddrive and make a visual representation of where the largest directories are located on the harddisk. This is most useful when cleaning up space. The project is available at Google Code: http://code.google.com/p/folder-visualizer/ Under featured downloads you'll find a .air and a .jnlp file to start both versions directly.
Besides the usefulness of the tool itself, the main important thing of this project was to compare JavaFX and Adobe AIR. We both like both platforms, but we wanted to have a case study that shows the cons and pros of each. Jamie created the Adobe AIR variant while I did the JavaFX one. Step one was to create the algoritm of the directory scanner. We initially did this in Groovy. This post is not really about Groovy, but once again we found Groovy to be much easier than plain Java for the task at hand. Jamie had to re-implement the algoritm in ActionScript later, because AIR can't call Java libraries. More about that later. JavaFX Implementing the app with JavaFX was really easy. There is a quite steep learningcurve however if you're just used to Java. JavaFX is nothing like Java. This is a good thing because JavaFX can be seen as a DSL for UIs while Java is a general purpose language. It also means a big challange when you just get started with the language. The disadvantage of JavaFX is that there are not that much components available yet, and that components doesn't look really cool by default. This means you have to do everything yourself, and even a simple application like the Folder Visualizer requires custom drawing. The other side of the story is that this gives you limitless possiblities to style your application just as you want, because you're not limited to out-of-the-box components. The most important reason to choose JavaFX over AIR might be the fact that JavaFX runs on the Java platform. Note that I'm talking about the Java platform and not necessarily about the Java language. This means we can leverage all libraries and existing code that we have on the Java platform. But didn't Flex/AIR integrate with Java also? You might have seen examples of Flex applications using a Java backend. This is just remoting over HTTP however, and not really direct platform integration. This is not a problem for online applications (Flex), but it is for offline desktop applications. You don't want to do remoting locally just to be able to call Java libraries...
AIR The strongest point of AIR/Flex is probably the large amount of high quality components available. This means you're application looks good, even if you didn't do any custom skinning. The same is true of basic animations/transitions, it's just something you declare on a component. Because of this, it's (at least at this point) easier to create an application in AIR than creating the same application with JavaFX. There is a point however where you do need custom drawing. For example, to create new components. This is a lot harder than JavaFX. As soon as there are more components available for JavaFX, the advantage might go to the side of JavaFX because it than has both the possibility to draw stuff yourself, and use out-of-the-box components. We still have to wait and see how this develops however. The same is true for tooling at this moment. Flex/AIR IDE support is ok (while not great to my opinion) but the JavaFX tooling isn't really much yet. Both IDE support and a designer tool can be expected shortly after the JavaFX release. The biggest con of AIR is the lack of Java platform support as said before. This is specially true because the ActionScript language really misses out on important features such as threading, and the language itself also can't keep up with a language such as Groovy. A bigger issue is the fact that you can't use Java libraries of course, and people have to re-invent the wheel for ActionScript. Take a look at ActionScript dependency injection frameworks for example.
Conclusion
JavaFX is just not finished yet, so if you have to choose a technology right now, go for Flex/AIR. Looking ahead in time however, there are some really big advantages of JavaFX over AIR. It will completetly depend on the availability of tooling and components for JavaFX to decide which technology is the better choise in the future.
|
-
In the past few months I used Groovy several times for tasks besides normal daily development, such as conversion scripts and small tools. Every time again I find it more easy to write the code, and the resulting code is easier to read (shorter and more descriptive). Of course, this is what most people say about Groovy. The question is, why not write everything in Groovy? Why still develop new projects in Java? It's not that I don't like Java, but Groovy just seems to be better :-) Of course there are reasons why you would want Java, such as better static code analysis (e.g. Findbugs) and better tooling support, but are those reasons enough to prefer Java over Groovy? And for what kind of code would Java be a better fit? Most people I discuss this subject with think that backend code should be Java, because it generally stays around longer, and GUI related code can be written in Groovy. While I think it sounds reasonable, I wonder if there are really good reasons to use Java for all backend code. The most important thing in this discussion is hard to proof however. How maintainable is Groovy code in large code bases compared to Java? The only way to compare this is by doing a big Groovy project, take it into maintainance, and see what happens. What do you think about this?
|
-
Today I tried to configure log4j in my portal project. No logs appeared however, and the log4j.properties file seemed to be completely ignored. I found that there was a log4j.jar in my shared app, and this was the source of the problem. When the application was loaded, the application's classloader loaded the log4j.properties. The WebSphere classloader loaded the log4j.jar however, which is unable to see the log4j.properties file that was loaded by the first classloader. The obvious solution is to either hava both the log4j.properties and log4j.jar in shared/app (which I don't advice) or have both in your application.
|
-
Evolving agile The final day of JavaPolis already. The combination of a few too many beers at Thursday and lack of interesting sessions in the first slot made me skip the first session. The first session I visited today was about agile, presented by Scott Ambler. First of all Scott Ambler is an excellent speaker, so I enjoyed listening. The presentation was mainly about how we have to see agile, how agile has proven to work (also in bigger teams) and how we’ll have to work with challenges you will face in the real world. Very interesting talk, mainly because it was not a ‘if we are agile there are no problems any more’ talk, but a talk about realistic settings and environments. OSGI, the future of Java Peter Kriens gave an excellent presentation about OSGI. OSGI is one of the cool things at the moment, but I think most people still don’t really know what it’s about. Actually OSGI is already around for many years, but is getting very popular recently. OSGI is all about managing components. Java has too little options for this, making classloading issues a real problem. With OSGI you use meta data to say which packages may be used externally, and on which other components (including specific versions) you rely. OSGI can be used in any environment, from a ‘hello world’ application to mobile development to application servers. Speaking of application servers, a lot of the major application server vendors are now using OSGI inside their products. This includes IBM, BEA, and Redhat/JBoss. It makes me wondering if you should base every Java application at OSGI. This seems a bit over the top in concept, but on the other hand it also has great advantages. I will be playing around more with this idea soon. Test driven development beyond the acronyms This session was about Test Driven Development by Lasse Koskela. I was not sure if I should attend this session because I was afraid it would be all too basic. And it was actually, but I still enjoyed the session. If you follow the TDD world a bit nothing really new was told here but I did like the way the speaker explained TDD. The main fun thing however was a 15 minute demo. Lasse didn’t have anything prepared for this demo, and didn’t even decide what to create in the demo yet. He asked the public for some idea’s and ended up writing a volleyball score counting application. He even asked the guy having this idea to pair program with him at stage, and this even worked out quite well. They basically started discussing which test they should start with, and started working TDD in this way. It’s absolutely fun to see a TDD expert working live, and maybe this is also the best way to explain how you should to TDD. JavaPolis wrap up I really enjoyed the week. The quality of most sessions was very good and there were plenty of interesting subjects. The three things at the top of my interesting technologies list are something like this: · Flex · OSGI · Content Repositories The main three trends I saw in Java development are: · Ease of use · Lightweight · REST A lot of input for the coming months at least, and I’m looking forward to next year’s JavaPolis!
|
-
General session Adobe must have been happy with today's general session. We started the morning with another session from Bruce Eckel and James Ward about Flex. I saw most of it already in their university session earlier this week, but all of it keeps impressing me. What I didn’t see yet before is what Flex can do with offline clients and data synchronization. Using this you can basically just disconnect your client from the internet, keep on working like you would normally do, and when you reconnect all data will be synchronized. Pretty neat J For the people who were not yet amazed about Flex after this session there was more to come. Stephan Janssen, the guy behind JavaPolis, presented version 2 of Parleys.com. At Parleys.com you can view all the talks from JavaPolis and some other conferences. Version 2 of the website is now completely build in Flex and really looks stunning. This is just another great example of what you can do with Flex. The new version of Parleys.com is going to be online as soon as Flex 3.0 is out of beta somewhere in January/February. After all the Flex talk it was Sun’s turn to talk about some mobile related stuff. First of all they gave a small demo of the game framework they created in Netbeans 6. Having this tooling it’s very easy to do all the basic things you’ll have to do when creating a game. Too bad I’m not into a lot of mobile development. The last part of the session was a talk about Sun about what is going to happen to the mobile world with things like JavaFX on the horizon. JPA 2.0 The first session after the general session I attended was about JPA 2.0. A very good overview of all the things that are going to be in the new JPA spec. Basically they are mainly adding everything that was missing in version 1. Nothing very exciting, but just making the JPA more and more complete. JSF 2.0 Another session about new specifications, JSF 2.0 this time. The main thing they are doing is looking at all technology out there that improves JSF and the way JSF is used. They are not inventing anything new, but standardizing things such as Facelets and AJAX usage. I have mixed feelings about the new specifications. On one hand, it’s for sure that JSF will be much more useable in the new incarnation, but on the other hand, nothing really new is going to happen. Hibernate Search Hibernate Search is basically a bridge between the Lucene search engine and Hibernate. By writing annotations you can index entities’ fields, making them searchable by Lucene. By doing this your application can implement much better search capabilities. Think about mixing entities fields’ in a search and getting results when your search query contains spelling errors. This can be extremely useful things for many applications, and it’s easy to implement with Hibernate Search. Webbeans I did quite a lot with Seam in the past year, so I’m also following the Webbeans specification closely. The main thing they seem to be doing is abstracting the concepts behind Seam and Guice to make them useable in different kind of environments. Implementations can than make use of this more abstract model to implement a framework such as Seam. Specially in the field of dependency injection a lot is done to make the mechanism more flexible. I’m looking forward to see how the spec. will be implemented by for example Seam, and how Webbeans will be used in a Java SE environment. JSR 311 – JAX-RS JAX-RS is the API for creating REST services, that will be part of JEE 6. The API makes it very easy to create REST services, focusing mainly on how resources can be made available with a URI. The presentation was good, but I was really missing a demo. Besides this presentation I really noticed that everybody is talking about REST. It seems to be that your only cool if you’re doing REST, and Webservices are so old fashion now. Beowulf In the evening they played Beowulf in one of the big rooms. Metropolis is pretty much the best cinema’s I’ve been to, so this was a lot of fun. Specially the sound is really great.
|
-
General session The General Session was mainly a talk from James Gosling about all kind of different Java related stuff. It’s just very interesting to hear someone like him giving his vision about Java. One of the things that I found most interesting was a short talk about applets. While applets are great in concept, they never really got popular, mainly because the implementation of the applet framework doesn’t work that well. JavaFX is pretty much positioned as a serious alternative to Flex and Silverlight but the only way to run JavaFX as a web application is to run it as an applet, which looked like a serious problem to me so far. The interesting thing that James mentioned is that they are working hard to completely re-implement the applet framework, making it work better and adding some features like pulling an applet from your browser to your desktop. The rest of the talk was about all kind of different aspects of Java development, from running Java on different devices to real time processing and Netbeans. Not a lot of new things, but it’s still really good to hear James tell about his opinion about things. Part of the session was also a short demo from the Sun demo team, showing of some cool JavaFX applications and showing robots and Sun Spots. The Sun Spot demo was quite fun, they were now controlling two robots by holding a Sun Spot in each hand and sock, and just moving their body. Google Guice The main reason that I visited the Guice session, was that the concepts behind Guice are a strong influence to WebBeans, which I follow closely. Maybe I didn’t read the session’s abstract well, but for some reason I expected a basic introduction session. The session was actually more about differences between Guice 1.0 and the new version, and best practices for using Guice however. Besides that, the session was really fast paced. While I couldn’t really follow everything, it still gave me a basic feeling about the framework. I do absolutely see why the framework is useful, specially for testability, but I also wonder if this is not too much of dependency injection. The idea here is that you actually never use ‘new’ any more, which might also not make your code to be more readable either to my opinion. I’m not sure what I should think about it. Kick starting the Content Repository. AJAX meets JCR The second talk I visited today was about Content Repositories, an how you can leverage them by using AJAX. The speaker was David Neuscheler, the spec lead of the JCR specification. He really gave an excellent presentation. The presentation was fast paced, but still very easy to listen too. I was actually really impressed by the presentation skills of the speaker. Besides the excellent presentation skills, the session’s subject was also very interesting. I didn’t actually have a good look at JCR before. A Content Repostitory can most easily be described as a blend between a database and a file system, with some added services. This means a content repository can replace a database as backing for an application. The speaker did even state that he would never use a database again as a backing system for any application if it’s up to him. While I don’t know enough about JCR yet to see how implement any kind of application with it yet, it sure looks very usable. The session ended with a fifteen minute live coding demo. The speaker actually started a stopwatch at the beginning of the demo, at implemented a blogged backed by a content repository in less than fifteen minutes. I can’t exactly decide yet if JCRs are really useable for me in practice yet, but it certainly looks interesting. It is something that I’ll will add to my list of interesting technologies for sure however. JEE 6 The next talk was about JEE 6. While JEE 6 is scheduled for Q2 2009, they are already working very hard to get the spec ready. Of course new versions of all major components are included in the specification, including EJB 3.1, JSF 2.0 and Servlets 3.0. Besides that, some new APIs will be added such as WebBeans (which I’m really happy about) and JAX-RS (RESTfull services). Also some improvements will be made at the packaging possibilities. The main improvement is that EJBs can be deployed in a WAR, as part of a web application, without having to deploy the EJB components in an EAR. Also they added the concepts of profiles. A profile is a stripped version of JEE, only containing the parts that you need for a particular type of application. They defined a web-profile for example. Altogether, a lot is going to happen in JEE 6. It really feels they are looking very closely at how people use things, and at solutions from the open source world. A main trend seems to be that everything gets more and more lightweight and easy to use. Absolutely a good thing to my opinion. The only bad news is that we’ll have to wait until Q2 2009 for all this. On the other hand, I’m still mainly doing J2EE 1.4 at the moment… EJB 3.1 After the JEE 6 session I went to a session about EJB 3.1, which will be part of JEE 6. They are still working hard to make the programming model even easier, and added some things that might be very useful in some situations such as Singleton beans, bean managed concurrency control, asynchronous Session Beans and an improved Timer Service. While most of the changes are not world shocking, the new spec promises to bring a lot of neat improvements. The future of computing panel Today’s last session was a panel discussion about the future of computing. James Gosling, Neal Gafter, Joshua Bloch and Martin Odersky formed the panel. An interesting group of people to say at the least. They discussed about subjects such as what kind of computing and where we will do computing in the future and what kind of new problems we will run into. An interesting and entertaining discussion, but as you should expect from this kind of session not directly useful for daily work.
|
-
Session 1 – Thinking in Flex I started the second day with a session about Adobe Flex, presented by Bruce Eckel and James Ward. I really enjoyed the session, not only because the topic is interesting but also because Bruce and James are very entertaining speakers. The fun thing is that they do actually really present together, instead of both presenting a part of the session. What works really well is that they ask each other questions during the talks and demos, making everything so much more clear. While I can’t really believe that they really have this questions, it really looks like it. This makes the session more easy to listen to, and also keeps it dynamic. The session was pretty much divided into two parts, the first part discussing mainly why traditional web interfaces are not user friendly and giving examples about more responsive applications build in Flex. Too bad that once again some demos gave some problems because of the bad internet connection, luckily the speakers handled this well. While the first part of the presentation was absolutely interesting, the second part was even better. This part was all about code. They started with a very simple, 2 line demo, that could show photos from Flickr. The cool thing about Flex is that even a 2 line demo looks amazing. The rest of the talk they pretty much expanded the demo slowly, explaining the different ways to use a XML service in an application and showing how to get separation of concerns in a Flex application’s code. This was very interesting because it gave some idea’s how to use Flex in a real environment, being bigger than one screen and 5 lines of code. The talk finished with some examples of AIR, which enables you to create desktop Flex applications. This is another interesting development in the RIA world. The gap between internet applications and desktop applications is closing, and ‘write once, run everywhere’ get’s to a whole different level. I visited some other talks about Flex before, and it keeps surprising me how well it all works. As some may know, I’m a big fan of Seam. Having Flex around however, it makes me wondering why you would want to use any framework that’s still rendering it’s output as HTML , instead of running in a VM. Of course a framework such as Seam makes it easier to implement the whole stack of an application from database access to UI, while Flex still has a gap between front-end and back-end. To an end-user however, most Flex applications will be more usable. For the past weeks I’m thinking about how the concepts of Seam and Flex could be used together, but didn’t really have the time to sit down for this yet. I hope to blog more about this soon. During the lunch it was a lot more crowded than the first day, since all booths where now set up. I’m really wondering how everybody will fit into the building tomorrow when there are almost twice as much visitors as today. Session 2 – JavaFX in Action The second session I attended was about JavaFX. Since I really like the concept of JavaFX, and see this as one of the major interesting new technologies at the moment, I was really looking forward to this session. The session was a major disappointment to me however. Maybe not everybody share this opinion, because I actually did hear some more positive comments, but to me the session was pretty much a big waste of time. In the three hour session, we just barely touched the basics of JavaFX, while I expect some more in-depth topics in a session called ‘JavaVX in Action’. Anyone who spent half an hour browsing websites and reading documentation would properly not hear anything new here. The problem was that the pace was just way too low, spending too much time talking about unrelated topics, and the code examples where too basic. The session left me just where I started, still having many questions about how to use JavaFX in practice. Funny detail however was that the session’s slides where written in a JavaFX application, which seemed to work quite well. I’m still really wondering what will become of JavaFX. The technology itself seems to be quite amazing, and much work is being done to get the compiler ready. The question remains if JavaFX can be competing with technology such as Flex. Flex is production ready and is supported with good tooling. For JavaFX it is not even clear yet how we will run it in a browser, and tooling support still has a long road ahead. Flex is a commercial product of course, so this might create some space for JavaFX. I guess we’ll find out in the coming year. Session 3 - Jazz Today’s last talk was Erich Gamma’s talk about Jazz. Jazz is IBM’s new toolset that is supposed to conquer the world by delivering a tightly integrated set of tooling for working in a software development team. Jazz contains pretty much everything a team need to collaborate; from SCM, issue tracking and continuous integration to a project portal giving an overview of a project’s status. I’m generally not a fan of IBM tooling at all, and was a bit skeptical about Jazz too. While some things still remain unclear, the presentation left me thinking that Jazz is actually something that could really make a team run better. The idea’s behind Jazz are actually distilled from the way the Eclipse team works. As many may know, Eclipse has a reputation of always releasing on time, and always releasing quality. This is quite amazing because the Eclipse team has more than 60 developers spread around the globe. To make a team like that work together successfully is really a big achievement. However, I’m still wondering how well Jazz will scale down to small (< 10) teams, and how well the software will work in practice. I’m also wondering about the licensing model that is still very vague at the moment. Presentations and internet… Something else I noticed during the past two days, is that almost every presentation completely rely on an internet connection. Many demos are done online, and it actually is a real problem when the connection doesn’t work well (which is the case in almost every session so far). Are we really that used to always having an internet connection now that we can’t work without it at all anymore? A small thought about JRuby Yesterday I had a short discussion with one of my colleagues also visiting here about JRuby. While I do like script languages, I don’t really get the why Sun pushes JRuby as much as they do. Why don’t they push Groovy for example? Groovy is a dynamic language running in the VM, being able to do everything such as Java classes invoking Groovy classes, that JRuby does for a much longer time already. The only thing I can think of is that Sun tries to pull JRuby developers to the Java platform. Besides this question I do think JRuby is cool by the way, and guys like Charles Nutter do a great job there. Speaking of colleagues by the way, make sure you also check out Bert Ertman’s blog about JavaPolis, he has visited some other sessions the past two days also.
|
-
Today was the first day of JavaPolis in Antwerp. The first two days are separated in two 3-hour sessions, and two half-hour sessions. The 3-hour sessions are typically interesting because there is enough time available to go into the details of the subject and to show some interesting demos. JavaPolis is completely sold out, and more than 3000 people will be visiting. A lot of people just visit the last three days, but it was already quite crowded. The conference take place in a big cinema, so at least the chairs are excellent J Session 1 – Open Source ESBs I started the day with a session about Open Source ESBs. The session covered an introduction to Mule, ServiceMix and OpenESB. The main part of the session were demos of the three frameworks, and there was only a very small amount of theory. This demo-wise way of presenting the frameworks worked very well for me. Because this was a three hour session there was plenty of time to go into the details of the demos, and the session gave a good impression of the frameworks. Mule is the most lightweight solution and is very easy to grasp. ServiceMix is based on JBI and is more standardized, but this has some drawbacks. The biggest drawback to me is that only XML messages are supported, and binary files can only be transported as an attachment of a XML message. This will be solved in JBI 2.0 however. Besides this problem, ServiceMix does offer a few nice features such as hot deployment. In the demo this didn’t work well however, and I’m wondering if ServiceMix is actually mature enough to be used in a production environment. Mule keeps things more simple and is not ‘restricted’ to standards. It’s really easy to get a simple application up and running. A question that is still open to me is how well Mule fits in a real enterprise environment, where a service bus would be most useful. There was a little less attention in the presentation to OpenESB. The demo mainly showed Netbean’s graphical editor support for OpenESB, and didn’t really show anything about the insides of the framework. Because OpenESB is based on JBI it should have some similarities with ServiceMix however. The presentation definitively made me want to see more about the frameworks, Mule in special. Session 2 – Spring 2.5 update The next session I attended was an three hour session about the new features of Spring 2.5. I did do quite a lot with Spring before, but didn’t look at it well for the past few months, so I was really wondering about the latest updates. Spring 2.5 is a major release for Spring. The release number hopped from 2.1 to 2.5 to show this. The reason why it is not a 3.0 release yet, is that this version is still backwards compatible with Java 1.4. The next release, which will be 3.0, will require Java 1.5 however. Support for Java 1.3 is already dropped in this version, since Sun declared it’s end of life a year ago already. The presentation covered pretty much all the new features of Spring with enough detail. There is a good list of new features that are specially useful for framework developers. This is not too surprising since there are more and more frameworks based at Spring. For the normal application developer there is plenty of interesting new stuff available too. The most appealing change is extensive support for annotations. Wiring can now be done with annotations instead of XML programming. It is not the goal that annotation will completely replace XML however. Annotations are always class based ‘configuration’, while you can declare instance based configuration in XML (e.g. have multiple instances of the same class with different configurations). In most cases a mix of XML and annotations would be the best solution, annotations to do basic wiring and component creation and XML for instance level configuration and wiring of classes that you don’t control. Other big changes are done in the Spring Web MVC module. While the new features are absolutely very interesting, I do wonder when Spring Web MVC would be a better choice than, for example, Seam. Web MVC is simply too low level, and lacks features such as conversations. This doesn’t mean the Spring framework is obsolete. Spring is much more than just a web framework, but when used as just a web framework it’s too simplistic. The next release of Spring Webflow (which is separated from the Spring main release) will integrate better with Spring’s new Web MVC features however. Session 3 – Bamboo The third session was just a 30-minutes session and covered Atlasian’s Continious Integration product: Bamboo. While Bamboo still looks like an interesting product to me, the presentation was a bit weak. The presentation missed to show how Bamboo can integrate with other tooling, and didn’t really show why Bamboo would be better/different than any other CI product. Bamboo does look nice however, and I still find it an interesting product. Session 4 – Hudson Today’s last session also covered continuous integration, this time Hudson. The speaker did a much better job at showing the power of Hudson in a short presentation than the previous speaker. I didn’t see much of Hudson before, but it definitively attracted my attention. Specially its integration with Maven and other products seems to be done quite well, and also its web interface looks very usable. I will absolutely give Hudson a try soon. Conclusion For me it was a very interesting day with a lot of useful information. Tomorrow I also have a day planned filled with interesting sessions, so I look forward to it already. But for now, I’m just going to enjoy a Belgium beer.
|
-
Yesterday Info Support hosted a university session about JBoss Seam. University sessions are an initiative of the NL-JUG (dutch Java User Group) to share knowledge. I was the speaker for the evening and gave a presentation about the main concepts behind Seam. After the presentation we had hands-on labs prepared, so that everybody could get his hands dirty with Seam. Our experience is that hands-on labs help a lot with understanding and remembering the topics covered in a presentation. As far as I heard all reactions were very positive. So if you are a NL-JUG member and didn't join yesterday's session, make sure you join our re-run session at the 27th of this month (27-11-2007). You can register at the following website: http://www.nljug.org/pages/events/content/university_20071127/ The following pictures were taken during the labs. 

|
-
JPA uses lazy loading by default. This is a good thing, but you'll run into problems when trying to use lazy loading remotely. Let me first explain the scenario. Say you have an EJB3 service layer that uses JPA to retrieve objects from the database. Those EJBs are used remotely by a simple Java application that uses the entities returned by the service layer. The entity's relations however, are not loaded yet because of lazy loading. When the client accesses one of those properties, an exeption will be thrown. This is completetly correct behaviour, because the client is outside any transaction and does not have any notion of a persistence context. While this behaviour is correct, it's still anoying. This way you can't use your entities outside a container, and you'll still have to use DTOs or something similar. Another solution might be to make your client transaction aware, which makes things a lot more complicated also. I created another workaround, which is simple and much easier to use than DTOs. I don't believe this is the way to go in every situation, but it might be useful in some situations. The solution is to ask the remote EJBs to retrieve the entity's property when needed. Of course you don't want to do this by hand, so we'll use AOP for this. This way your code will look like lazy loading just works, without any extra code for fixing the remote lazy loading problem. First we'll need an extra method at the Session Bean that manages the Entity. This method has a parameter for passing in a detached entity, and a String parameter for passing in the name of the property that should be retrieved. The method than finds the attached entity from the persistence context and calls the requested parameter by reflection, and returns the resulted data back to the client. At the client we only need an Aspect that calls this method when necessary. The code examples below give an impression how to implement this.
Session bean with dynamic fetch method. 
The aspect used to enable the lazy loading mechanism automatically Why would you not always use this? This way of working might generate a lot of extra roundtrips to the remote Session Beans, which is not too fast of course. This can lead to performance problems. In this case it might be possible to use the 'fake lazy loading' in most cases and use more specialized queries at places where the fake lazy loading leads to problems.
|
-
At the project I'm currently working we do a lot of mocking. What we found is that our test methods sometimes contained a lot of duplicate code for setting up mocks. If you need some mockobjects in only two or three methods, you might not want to make the mock objects class members if the other tests methods do not use them. What you'll than get is dubplication of the initalization of the mocks in the methods you need them. Take the following class as an example. public class ExampleTest extends TestCase { public void testWithMockA() { MockControl mc1 = MockControl.createMock(ClassToMock1.class); ClassToMock1 mocked1 = (MockControl)mc1.getMock(); MockControl mc2 = MockControl.createMock(ClassToMock2.class); ClassToMock2 mocked2 = (MockControl)mc2.getMock(); /*Set up expectations etc. Might be a lot of code */ mc1.replay(); mc2.replay(); assertEquals(10, classToTest.execute(mc1, mc2)); mc1.verify(); mc2.verify(); } public void testWithMockA() { MockControl mc1 = MockControl.createMock(ClassToMock1.class); ClassToMock1 mocked1 = (MockControl)mc1.getMock(); MockControl mc2 = MockControl.createMock(ClassToMock2.class); ClassToMock2 mocked2 = (MockControl)mc2.getMock(); /* Very similar mock setup, only one return value differs */ mc1.replay(); mc2.replay(); assertEquals(10, classToTest.execute(mc1, mc2)); mc1.verify(); mc2.verify(); } } You might say that it’s a testclass and it doesn’t matter that much there is some duplication. True at some point, but it still bugs me. The problem is you can’t just create a method that sets up the mocks, because you need access to the objects from your test methods. Here is a very simple solution to this, which makes use of an inner class. The innerclass contains public members for every object you need access to (you could use getters of course), and a init() method. After doing this, the example from above will look like the following. public class ExampleTest extends TestCase { public void testWithMockA() { WithMockSetup setup = new WithMockSetup(); setup.init(); setup.mc1.replay(); setup.mc2.replay(); assertEquals(10, classToTest.execute(setup.mc1, setup.mc2)); setup.mc1.verify(); setup.mc2.verify(); } public void testWithMockB() { WithMockSetup setup = new WithMockSetup(); setup.init(); /*Do that single line of extra setup */ setup.mc1.replay(); setup.mc2.replay(); assertEquals(10, classToTest.execute(setup.mc1, setup.mc2)); setup.mc1.verify(); setup.mc2.verify(); } private class WithMockSetup { public MockControl mc1; public ClassToMock1 mocked1; public MockControl mc2; public ClassToMock2 mocked2; public void init() { /*Set up expectations etc. Might be a lot of code */ } } } This will remove most of the duplication without making everything global, and without making your tests unnecessary complicated.
|
|
|
|