Rafal Maslana, from Warsaw in Poland, started his adventures with Java in 1997. Then, a year ago, he took part in a NetBeans Platform Certified Training in Warsaw and, to become a NetBeans Platform Certified engineer, he created a scuba dive planning application on the NetBeans Platform (open sourced here on Kenai).
Below he talks about himself and his application, shares some screenshots, and discusses the usefulness of the NetBeans Platform in this context.
Hi Rafal, please tell us about yourself, especially about programming and scuba diving!
In 1997, I was a C++ programmer and liked the Java idea of "write once, run anywhere". I like lots of the possible usages of Java programs, from standalone applications to enterprise solutions and, not to forget, mobile devices. Now, I work as a freelance Java EE consultant and architect in Warsaw, Poland.
About diving, I attended my first diving course in 1994. I usually dive in Poland, where there are a lot of beautiful lakes and plenty of wrecks in the Baltic Sea. I have also dived in Croatia, Bulgaria, and Egypt. I am an underwater photographer and so the pictures used in my application are photographs that I took while diving.
Now let's talk about the scuba diving application you created on the NetBeans Platform. What does it do?
After the NetBeans Platform course given to the Warsaw JUG, I started looking for a topic for the related engineering project to become a NetBeans Platform Certified Engineer. I've always been curious about depth/time graphs, specifically about the indicators of the curve markings where decompression stops become obligatory. There are different types of decompression tables and I like being able to know what the difference between the different decompression tables is. Not only different dive tables interest me, but also the impact on decompression of diving in mountains, as well as how to plan repetitive dives, and what the impact is of changing your breathing gas from air to enriched air (nitrox).
That seemed an excellent subject for the engineer project, allowing me to gain more knowledge about the NetBeans Platform while creating useful tools for divers and diving instructors.
So, the main module of the application provides a dive planner. It allows you to plan your first or second dive simply by dragging a diver icon around the depth and time graph:
application then calculates your no decompression time or
decompression stops, as well as some other useful parameters, based on
the selected diving table. Nowadays, most divers use diving computers which
are more accurate than diving tables; however, in my opinion, old
fashioned tables are better suited to show the low-level details and differences between different compression tables.
Then I added some loosely coupled functionality, such as a simple logbook (provided by a different module) to conveniently register dive info and add some descriptions for each of them:
Another module presents simple dive statistics. This module depends on the logbook module and calculates a summary of dives, showing the results in graphs thanks to the JFreeChart library:
Several modules in your application are service consumers that register their implementations in the module's META-INF folder. Which of the modules follow this pattern and what is the benefit of doing so?
The NetBeans Platform encourages you to use a modular structure. While designing the dive planner, I wanted to be able to use different diving tables, so this aspect was an obvious candidate for a service consumer.
As a result, diving tables packed in separate modules can be added as plugins to the application via META-INF registrations:
Such a design makes it easy to add additional diving tables: providers of additional tables need not worry about the application design at all. They simply need to implement the service interface and register the implementation in their META-INF folder.
Which parts of the application are you proudest/happiest about?
I especially like the application's usage of the NetBeans Visual Library. It is nice and easy to drag the diver icon and observe how dive parameters change. Thanks to the Visual Library it was pretty straightforward to achieve this effect.
The other thing I enjoyed was the benefit of using services and modules. I created and tested the application using buhlman-hahn decompresion tables. Later I was able to add a new diving table based on the PADI recreational diveplanner. It was really simple, I just had to create new module and implement the service interface.
Has the NetBeans Platform, which underpins this application, helped or hindered you?
One of the goals of this project was to gain experience in using the NetBeans Platform. Creating the application using the NetBeans Platform was a lot of fun. There are so many useful functionalities ready to be used out of the box.
However, as usual when you are exploring new technologies, you have to spend some time figuring out the right way to do things. Of course, it was much easier after NetBeans Platform Certified Training.
Using the NetBeans Platform allowed me to quickly see the results of my work. Encouraged by the quick success, I could develop other functionality and instantly show it to my testers. Proceeding in such an incremental way kept the project's momentum on an even keel.
What are the most important features of the NetBeans Platform to you?
- It is easy to start working on a new application and in nearly no time at all you have a working prototype, with windows, etc.
- The modular structure means easy configuration, easy development.
- I18n and L10n support and easy usage.
What are some things that surprised you about the NetBeans Platform?
Again, I must admit it: I'm surprised it did not require a huge amount of time to get from application requirements and architecture sketches to a working prototype. In fact, it was very quick indeed!
The other handy thing is the windows system: you just use a TopComponent class and then you receive a lot of advanced window management: opening, minimizing, closing, dragging, etc.
What kinds of applications can benefit from the NetBeans Platform?
- Whenever you need some windows as user UI, you can benefit from using the NetBeans Platform.
- If You need more sophisticated graphical interaction like dragging, dropping, resizing, connecting, then use the Visual Library with the NetBeans Platform: it can make building your app really easy.
- Modular applications that require enabling/disabling modules at runtime and/or distribute updates or additional modules can achieve that on the NetBeans Platform without much effort.
What's the plan with your application? What features should still be added?
For a while already it seems that I've achieved all the planned functionality already.
However, if anyone has any ideas, you can just mail me, or better leave a message on the related projects forum.
I am toying with an idea of importing data directly from diving computers to the logbook. I also plan to do some tuning in the statistics module, where I will probably add some new graphs. Another idea is to extend the dive planner module by adding support for trimix as a breathing gas.
Why is the project on Kenai and what do you think about it?
Kenai has all that I needed to host my project (source code repository, distribution downloads, Wiki for project description, forums), plus support from within the NetBeans IDE.
Would you like the community to contribute code and if so what?
Community contributions are very welcome. Modules with new functionality are welcome, as well as new diving tables or comments. Ideas for improvements are also most welcome, of course!