Sun Java Solaris Communities My SDN Account Join SDN
 

Sun Mobile Device Technology - Chat Transcripts

 
 

Solving the Device Fragmentation Problem

 

Transcript of web chat held on January 26, 2005
Guests: Greg Crawley, David Kaspar, and Adam Sotona, Software Engineers for the Sun Mobility IDE.
Moderator: Bao Phan


bao
Welcome to the Sun Developer Network Moderated Chat series. Today's topic is "Solving the Device Fragmentation Problem." My name is Bao Phan and I'm the moderator for this chat. Our speakers today are Greg Crawley, David Kaspar, and Adam Sotona, Software Engineers for the NetBeans Mobility Pack IDE.

Just a couple of housekeeping notes before we begin:

You are connected to our chat application, and your session must be maintained in order to stay connected. Please do not point your current browser to another URL, otherwise you will be dropped from the chat. You may open up another browser if you need to access another URL while staying connected to the chat.

When you submit a question to the speakers, your question will not immediately appear in the chat room. It is sent to the speakers and will appear when the speakers post their response to your question.

With that, I'd like to invite you to begin sending your questions to our speakers. To start things off, Greg, can you give us a quick summary of the feature in the NetBeans Mobility Pack that addresses the device fragmentation problem?

gregcrawley
I'll start off with a quick explanation as to what the device fragmentation problem is. We use the term to describe variations found between mobile platforms that prevent a single application from automatically running optimally on all phones. These differences can be physical (like screen size, screen color depth, available memory, etc.) or software-related (available APIs, CLDC/MIDP version, etc.). Fragmentation usually requires modifications to get your single application running on different mobile platforms; managing these modifications is where our solution comes in...

It has two main parts: project settings management and fragmented source code management.

Both portions of the solution are based on the concept of Project Configurations. You can create as many configurations as you'd like for each of your projects -- typically, you will have one for each distribution Jar that you plan on creating for your application. Once the configurations exist, you can update individual panels of the project properties dialog such that the settings will only apply to individual configurations.

Also, you'll be able to mark blocks of source code as being specific to a list of configurations. Individual code blocks will only apply only to those configurations that you have associated with them. An embedded preprocessor is used by NetBeans to place code blocks to a commented-in or commented-out state based on whether or not the block is appropriate to your active configuration.

So that's the solution in a nutshell.

blizzard
Does this solution eliminate the need to have a separate source file for each device I want to target?

gregcrawley
Yes, it does. Because we use a commenting pre-processor, all versions of your code can be stored in a single source file.

blizzard
What is the key benefit of using this feature?

adamsotona
You can easily deliver an application that fits several phones available on the market and maintain just one source base.

jojo
Gee, this sounds a lot like a new-fangled way of getting the IDE to implement the old-fashioned #IFDEF in the C preprocessor. Having the IDE effectively comment out some code blocks for some cases and other code blocks for other cases sure seems like a roundabout way of doing something that should be fundamentally simple. Wouldn't it be simpler if Java just supported CPP-like macros?

gregcrawley
That is, in effect, what we're doing. The code block definitions use a CPP-like syntax -- but all within Java comments. We stayed away from #IFDEF-type syntax as then we wouldn't have 100% pure Java code until the preprocessor ran.

ntuple
Is there a list of configurations supported?

adamsotona
If we are talking about project configurations - there are no limitations. It is not based on any list. You can easily create what you need.

joe
I'm impressed by what I've seen. Will we be able to use this facility in free-form projects (built standalone outside NetBeans)?

davidkaspar
Currently we do not have a free-form project. We support building projects outside of the IDE. All these device fragmentation features are fully available in the command line, too. It is because the whole building process is done using Ant.

JBeat
What is a clever approach to ensuring that an action game runs at the same speed on different devices? Are there any features in the Mobility Pack that would assist in testing runtime speed of a game, especially with regard to simulating slower and faster devices?

adamsotona
Mobility Pack does not provide any special emulator extensions. Simulation of speed or, for example, network latency is up to the emulator used. Mobility Pack includes the J2ME Wireless Toolkit emulator that (I think) allows you to simulate slower network speed. And definitely there are some other device emulators that are pluggable into Mobility Pack and allow some of these special features.

fractal@fractalgrafics.com.mx
How does it manage memory management issues, especially on devices that have different memory specs?

davidkaspar
We do not handle that issue specifically but we are allowing developers to handle code and resources differently for each configuration.

patrick
How does this solution help us in the long run?

adamsotona
Our Device Fragmentation solution helps mostly in code maintenance. You can improve your application for every new device on the market and still base it on the same code base. Or you can have prepared library projects fragmented according to your needs (device providers, available APIs, series of devices...)

fractal@fractalgrafics.com.mx
It would be very nice if you could post a "Sample-Tutorial_Device_Fragmentation" using 3 or 4 common configurations.

gregcrawley
There is a device fragmentation tutorial available at http://www.netbeans.org/kb/articles/tutorial-j2mefragmentation-40.html. You can also open your NetBeans help, and in the contents menu select J2ME MIDP Development | Getting Started | J2ME MIDP Tutorials, there is a link to the Device Fragmentation Tutorial With Marv The Miner. That link will take you to the tutorial on netbeans.org.

patrick
Are there project templates in the IDE?

adamsotona
Sure there are. There is a template for a new application, library, templates for various imports, and a lot of sample project templates.

ntuple
So this feature is available in the latest NetBeans Mobility IDE available now?

gregcrawley
Yep. NetBeans Mobility Pack 4.0 has this support integrated, and it's already available for download.

patrick
How can we create our own project configurations in the IDE?

davidkaspar
Just open the Project Setting for your project. At the top of the settings dialog there is a combo box with the list of all project configurations created for the project. On the right side of the box is a Manage Configurations button which leads you to the Configuration Manager dialog. There you can manage your configurations.

jojo
Regarding the CPP idea, I'm also wondering if using the annotation feature of Java 5.0 could work. Is there any way to use apt and some suitable code annotations to effectively accomplish CPP-like #ifdef and #ifndef blocks? I asked that question at last year's JavaOne session on apt and was told that apt was explicitly designed to disallow such usage. I wonder if any true hackers have figured out a way around that?

adamsotona
I don't think you can use any features from Java 1.5 because of the CLDC/MIDP library limitations and compiler limitations. If you want to compile CLDC/MIDP applications you cannot use a higher version of sources than 1.3. Even assertions from 1.4 cannot be used in CLDC/MIDP applications.

WM
Would you release some more samples where the features could be seen in wider reach?

gregcrawley
That's a good idea WM, and something that we are planning for the 4.1 release should time allow for it. If you have any specific tutorial requests, you can file an RFE at http://www.netbeans.org/community/issues.html. File it under the 3rd party category.

patrick
What plugins does the Mobility Pack currently have?

davidkaspar
NetBeans 4.0 Mobility Pack consists of the build/project system, device fragmentation support, debugging support, UEI emulator support, j2meunit library, proguard obfuscator, and many examples. More information can be found at http://www.netbeans.org/kb/articles/mobility.html.

bgranvea
When will you support the Doja SDK?

gregcrawley
I am not familiar with the Doja SDK specifically, but most SDKs can integrate with NetBeans if they comply with UEI emulator standards. You can try to add it as a platform using Tools | Java Platform Manager. Click Add Platform and navigate to your installation directory. If the IDE detects the SDK, it will install automatically.

JBeat
What are the typical differences between devices that you have to consider when using MIDP 2.0?

adamsotona
Mostly it is about proprietal vendors' APIs and availability of optional APIs (JSRs). A lot of differences are also in available hardware and it is usually hard to solve the differences in one code resulting in one application distribution for any device.

Clive
Is any work being done with the KVM vendors to minimise the fragmentation issue in the first place, e.g. like tighten up the MMAPI so it works consistently across all devices?

adamsotona
Sure, it is a continuous process but we are just small fish There is still a big push from device vendors to be the first in something and to be unique.

patrick
What are the most interesting features of the Mobility Pack?

gregcrawley
The device fragmentation solution of course :)

fractal@fractalgrafics.com.mx
Once the configurations are set, and the code written, is there a way to build all jars with just one command or do we have to go one by one?

davidkaspar
Yes, this is possible. In the IDE just select the Build All Project Configurations popup menu item on a project node. In the command line run following command: ant jar-all. A full list of supported Ant targets is listed in the build.xml file in the root of your project directory. All jars/jads are built into the dist directory (each jar/jad in a separate directory).

joe
Comment: The feasibility of a commenting preprocessor has been established in J2ME tools such as antenna, jenable and j2me-polish.

gregcrawley
Thanks joe...that's why we chose to integrate this solution.

ntuple
Will the transcript of this chat be available online?

bao
Yes, the transcript will be available on our web site. As a registered participant, you will receive notification once it is online. Also, be sure to subscribe to the mobility newsletter to get all the latest news about new content. You can subscribe at: http://developers.sun.com/prodtech/javatools/mobility/community/newsletters/index.jsp

joe
Why is there no mention of the Mobility Pack in the 4.1 EA2 announcement? Also, where is the home of the mobility project, in case I want to report a bug or look for new releases?

gregcrawley
Don't worry joe, we'll have a 4.1 release of mobility along with EA2. There's no separate homepage for mobility on netbeans.org ... yet... but it's something we're trying to set up. In the meantime, you can get a lot of information on the Mobility Pack download page.

bao
joe, there is also good information on the Sun web site for the mobility IDE: http://developers.sun.com/prodtech/javatools/mobility/index.jsp

bgranvea
Could you add hierarchic configurations? For example Nokia S60 => Nokia S60 MIDP 2.0 => Nokia 6600.

adamsotona
Not yet, now you can just create a special configuration for each. But stay tuned for the next release. The code blocks will not be preconditioned just by the configuration names but also by "abilities." Such ability may be, for example, a Nokia API so the code block will be used even in, for example, a SonyEricsson configuration where such an API is present and the ability will be assigned.

fractal@fractalgrafics.com.mx
Have you considered having a list of available emulators in the NetBeans Mobility section page? It would be very nice to have most vendors list their emulator links there, once an emulator is released by a vendor it would be much nicer to have NetBeans recognize it and automatically define the configuration fragmentation definition from it...

gregcrawley
NetBeans will work with any emulator that complies with UEI (Unified Emulator Interface) standards. Fortunately, most modern emulators do, so you shouldn't have to worry about it too much anymore. Again, the Marv the Miner tutorial walks through how you can also get non-UEI emulators working in the IDE.

JBeat
What would you think of having some sort of knowledge base in the Mobility Pack, like a collection of templates that solve specific problems for the most popular phones? On the other hand: Does good support for fragmented devices not encourage the market to _further_ fragment?

adamsotona
That is a really interesting idea for a new feature. I will notice that. Thanks.

gregcrawley
fractal -- to continue my answer with regards to NetBeans automatically creating configurations for emulators... that is also an idea we've been tossing around but there are still no concrete plans to implement it yet. Filing (and voting for) an RFE on issuezilla is a good way to track an issue's progress.

bgranvea
To go on with the CPP idea, a nice feature would be to be able to do pre-calculation to optimize the size of the code.

adamsotona
Currently I am not familiar with such pre-calculations in CPP but in building a J2ME application, the obfuscator definitely plays the biggest role. So you can see the size of your app just after the obfuscation but there are no pre-calculations available.

patrick
What are you planning to add in the 4.1 release?

davidkaspar
For the 4.1 release we are planning the following features: Visual Designer which allows you to create applications using a drag-and-drop style of work, improved device fragmentation solution using abilities, deployment support, project configuration templates, improved project management, and many more. Right now we are producing Q-builds (stabilized development builds with the latest features) of Mobility Pack. The reports and download links are available at http://qa.netbeans.org/q-builds/mobility-pack/index.html.

joe
I noticed that j2meunit lib is included, but there is no other integration as far as I can tell. What additional unit test support is planned?

adamsotona
Yes, we did just a minimal integration of J2MEUnit now. Would you like some kind of test generation?

fractal@fractalgrafics.com.mx
Is there now an official IRC chat for NetBeans for the mobility section of it?

davidkaspar
Currently there is neither an IRC chat nor mobility-only mailing list. If you have any questions you could send it to the nbusers@netbeans.org mailing list and we will try to answer it as soon as possible.

fractal@fractalgrafics.com.mx
Currently with NetBeans what is the best way to debug a J2ME client and J2EE server apps?

adamsotona
J2ME client debugging works fine but I am sorry there is no J2EE suport in NetBeans 4.0. Stay tuned for the 4.1 release. There you will be able to debug both.

JBeat
Is J2ME device fragmentation becoming a bigger problem or is it getting better with MIDP 2.0? I have read that Samsung wants to use Flash for their phones. Do you consider this a threat to J2ME? Do you think the Mobility Pack will help to strengthen the position of J2ME?

bao
The fragmentation problem is not necessarily tied to either MIDP 1 or 2, rather, the differences/capabilities across devices. The NetBeans Mobility IDE addresses this problem with the device fragmentation solution.

joe
Concerning J2MEUnit, yes I'd like the same kind of support as exists for JUnit in J2SE apps. This includes test generation in a separate "test" source directory, "test" targets in the build. The basics.

adamsotona
J2ME architecture is slightly different so a separate source root doesn't make much sense. You still need to create one application jar containing both (application and tests) so we will probably look for another solution than the one implemented in J2SE. For J2ME, a build test means to create a different project configuration that will also include tests. You can see the basic support in the Filtering category in Project Properties where you can exclude all tests for any project configuration using one click.

fractal@fractalgrafics.com.mx
ETA for Netbeans 4.1?

johnmuchow
Sometime this Spring we plan to release 4.1.

WM
Although this is collateral to this subject, when do you plan to release some more info, tutorials and documents about MIDP Visual Designer?

davidkaspar
The latest version of Visual Designer is included in the q-builds which are usually released every 2 weeks. Also, we are preparing a 4.1 Beta release in the near future.

fractal@fractalgrafics.com.mx
Have you considered hosting a list of links to available UEI emulators, that would be great if kept current, would save a lot of time for us and would give an important statement on current UEI acceptance.

gregcrawley
We actually have an article that just went up explaining how to install UEI emulators into NetBeans. This article has a link to a partial list of emulators that work within NetBeans. http://developers.sun.com/mobility/nbpack/reference/techart/nbmp40-emulators.html.

Unfortunately, we don't have the resources to maintain a current list of emulators that comply with UEI.

JBeat
(This is not very specific to the Mobility Pack) What is useful to use/do when trying to deal with the different screen sizes of mobile devices?

adamsotona
If you mention some bitmap graphics, for example, of some game, you can fine-tune and create several distributions of some common sizes and just choose the best matching size for every real phone.

bgranvea
Doja doesn't belong to the MIDP family, it has been developed above CLDC by NTT Docomo, so it is more like a cousin of MIDP. They are both very similar though, so its support shouldn't be too difficult to add for you. Doja becomes more and more popular in Europe (and already is of course in Japan), I think it is worth taking a look.

fractal@fractalgrafics.com.mx
I would love to see a sample jar for the Location API (JSR 179).

davidkaspar
We will think about adding this example into the pack.

WM
The Visual Designer will cover Screen subclasses and Canvas?

davidkaspar
Yes. All Screen subclasses like TextBox, Form, List, Alert. Also you would be able to add your own screens (classes which extend Displayable or Item class).

fractal@fractalgrafics.com.mx
It would be nice to have a place where there are unified links to info on NetBeans Mobility info and Sun's mobility info, at times seems confusing to search both sites for info on a theme...

bao
Thanks for the feedback, this is definitely something that we are trying to bridge. We recognize that there is some confusion, and are working toward making the information as easy to access as possible.

joe
I don't understand the statement that J2ME Architecture is different with regard to separate source roots. I've set this up in a free-form project so that I can build a Midlet JAD/JAR or a combined MIDlet+TestRunner JAD/JAR. Works nicely. It'd be great if mobility could automate this in its own projects. By the way, the advantage of separate source roots is that it makes a clean separation of test src from non-test src in the project tree.

adamsotona
It is a hard implementaion issue. Multiple source roots supporting project configurations including actions working "for-all-configurations" is really hard to implement without using the usability. We will probably supply it another way.

bao
Okay, we are coming to the end of our hour. Greg, David, and Adam, do you have any last thoughts for our guests?

gregcrawley
Just want to say we hope you have a better understanding of the NetBeans Mobility 4.0 device fragmentation solution, and about mobility in general. We have a lot of cool new features coming out in version 4.1, so keep a lookout for those emails alerting you to its release! Oh, and please use issuezilla (http://www.netbeans.org/community/issues.html) to report any problems or any other suggestions that you have. Bye for now!

patrick
Thank you mr. greg, mr. adam, and mr . david for answering my questions. I wish you good luck on the Mobility Pack.

adamsotona
You are welcome.

JBeat
Thank you all for sharing information with us.

bao
Thank you for attending!

fractal@fractalgrafics.com.mx
Thanks a lot for your time and help and see you next chat...!!!

bao
Thanks, we look forward to your continued participation.

WM
Bye folks, and thank very much!

bao
Thanks for your participation, WM. Look for the transcript soon.

bao
Great, thank you. This wraps up our chat for today. I'd like to thank you all for your active participation, and our speakers for doing a great job in answering your questions. I hope you found this information helpful, and this live chat valuable.

An archive of today's chat will be posted on our web site. All registrants will be notified via email once it is available. On behalf of the team here at Sun, thank you and goodbye!

Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Comments:
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.
Update Your Java Runtime Environment

NetBeans