It might be useful to discuss briefly those "other approaches".
I am confident that you can use the approach to create fast and safe programs, due to the inherent characteristics of Java, while writing, building and debugging them much more quickly than other approaches I've found, due to remote development using the "professional grade" NetBeans Integrated Development Environment (IDE). I've found that NetBeans-based remote development greatly increases productivity when using Java for the Raspberry Pi. Why remote development based on NetBeans? That said, I have purchased sensors from vendors that supplied "drivers" for the sensors only in Python (or C/C++ for the Arduino), so I had to write the Java equivalent the extra effort is not necessarily productive, but can result in greater insight into a sensor's operation. There are things that one can do in C that one cannot do in Java, but again, so far everything I wanted to do has been addressed by Java fans in the Pi community. So far, I've been able to do everything in Java that I can do in Python. The bottom line: Java is faster than Python. I consider C++ an object-oriented "wrapper" around C that does nothing to eliminate the hazards of C. I feel the safety also improves programmer productivity. Java prevents such hazards, so Java is safer. Objectively, the fact that you can do anything means that you are only an obscure bug (e.g., bad pointer arithmetic or an errant memcpy) away from overwriting memory and potentially crashing the program or even the entire system. I am also not fond of C since I (subjectively) dislike some of its characteristics that I find arcane, archaic, or both for example, explicit pointers. You can do pretty much anything, and you can do it about as fast as possible in fact, this source suggests C can run up to 7X as fast as Java. This source shows that Java is always faster than Python 3, and in fact can run hundreds of times faster, depending on the task.Ĭ in my opinion, is a "high level machine language", i.e., something that is very close to the system hardware, or at least the operating system. There is one characteristic of Python for which my dislike is objective - performance. I am an experienced programmer and am not fond of Python due to an admittedly subjective dislike of a number of its characteristics, for example, dynamic typing.
Python is in effect "promoted" for use on the Pi, at least in part for its ease-of-learning for new programmers. The most recent releases of Raspbian include development and runtime support for all these languages. There are many programming languages available for the Raspberry Pi, but I'll limit the discussion to "professional grade" programming languages that target standalone programs, support multi-tasking, allow hardware and network access, etc. The rest of this introduction describes the motivation for using Java and for remote development using NetBeans. Magic! You can even debug the running program, setting breakpoints and examining variable values. Once everything is set up properly, you can write a Java program in NetBeans and then a single click compiles and builds the program on the workstation, downloads the program to the Pi, runs the program on the Pi, and delivers output to the NetBeans console. NetBeans runs on a workstation (a desktop or laptop computer, not the Raspberry Pi) connected via Wifi to the Raspberry Pi. The approach is not only efficient, it is free!įundamentally, the approach is remote development using NetBeans. I've used the approach to develop Java capabilities ranging from low level device support to multi-threaded and network-based programs.
Public class SwingJFrameDemo extends Instructable describes a very efficient approach for developing Java programs for the Raspberry Pi.