Can I do normal Java programming for embedded devices?

I am looking at some Java code for a JBed program in real time. I am not familiar with JBed yet.

The device has only 16 MB of RAM and the code is more like C ++. It rarely passes objects as return value and uses global variables, so the code is hard to understand.

Is this a necessary optimization due to the small amount or RAM available or with this excess RAM, can it be implemented in a β€œnormal” way?

I understand that at some point, objects are likely to cause too much overhead, so Java is no longer suitable. If we go further, even C ++ causes too much overhead, and only C is an option (for example, on Texas Instruments MSP430 with 8 kB).

However, my assumption would be that if I use Java, I use it correctly, and not, for example, return half of the return value (for example, two int in the return and the other half by setting a member. Instead, I would used some Pair class as return value.

I don't care how much OO programming is, it could also be an FP style, but at least use atomic elements as return types and not propagate them in all global variables.

So, can I do β€œnormal” Java programming for embedded devices? If the question is too broad, consider a JBed script and a 16 MB device. If it is important whether Java is used in OO or FP-style, specify which style may be appropriate.

+5
source share
1 answer

Is it possible to do "normal" Java programming for embedded devices?

yes, on some small devices (built-in or mobile) you can do almost normal Java programming. What you can / cannot do is determined by the list of JSRs (Java specification requests) that the specific Java Micro Edition platform supports.

Before Android appeared in 2008 and the new API appeared, it was quite normal that you could do Java programming on phones with very limited processor / memory. See " java.mob.org: Free Mobile Games. Download Java Games for Mobile Phones " for confirmation.

Can I ... Java programming for the embedded ... JBed script and 16 MB device?

The relevant Google search words for this platform are likely to be the β€œ Esmertec JBed Micro Edition profile ”.

According to my web search, the original Esmertec JBed was re-branded after the merger under the name Myriad Group . I was not able to quickly find relevant information about the developer, and the official public page http://www.myriadgroup.com/products/device-solutions/mobile-software/jbed-advanced is very business oriented.

But now the company should ask about JSRs and developer resources (SDKs, platform limitations, optimized libraries ...)

I look at some Java code ... rarely passes objects as return value and uses global variables ... hard to understand ... OO-style or FP-style?

You are probably looking at the old "bad" code written by some self-taught beginner. This is normal and probably not particularly relevant to the platform.

However, optimizing the speed of writing compact code (which generates compact miniature bytecode) is certainly recommended. Along with writing code for collecting garbage and collectors. OO versus FP style doesn't really matter, although too many small objects can mean too much work for the garbage collector.

The tool for finding balance is usually the profiler + best practices for the platform (for example, the Roy Ben Hayun book β€œ Java ME on Symbian OS: Inside Smartphone Model ” contains some tips for older Nokia mobile devices)

+3
source

Source: https://habr.com/ru/post/1208411/


All Articles