views:

302

answers:

6

Hi guys does anyone know why the programming language C++ is used more widely in biometric security applications compared to the programming language Java? The answers that I have collected so far are 1) Virtual Compilers 2) OpenCV Library provided by C++. Can anyone help with this question??

+2  A: 

I don't know specifically about biometric applications, but in general when security is important Java can be a stumbling block. Depending on how the security requirements are written, they can cover things that one must do manually in C++, but which are done automatically by Java. This poses a problem because one would need to demonstrate that Java properly (and in a timely manner!) satisfies the requirement. It is a lot easier to show that these requirements are met in C++ code, because the code the meets the requirement is part of the program in question.

If the security person/requirements/customer make it clear that relying on Java for some security features is acceptable, then this is no big deal. We could go round-and-round about whether or not it is reasonable to rely on/trust Java to satisfy security requirements, it really just depends on the specific security needs.

SoapBox
But are there like distinct features for relying on C++ instead of Java?
SnipeTechie
I can't think of anything that C++ does "automatically" which you would have to hand-code in Java. I think if something like that existed, it would be included in the next Java release. (Like templates/generics/whatever-java-calls-them.)
SoapBox
I think @SoapTechie is talking about security certification / audit requirements rather that security per se.
Stephen C
+4  A: 

Maybe it's the hardware support: I wrote an app that uses fingerprint sensor. The library support for the device is C++, so I wrote the app in C++. Now they have a .NET version, so my next app will be C#.

egrunin
+1  A: 

I am willing to put money on the reason being simply that the access api's for the hardware are written in c++. Most of the modern/higher-level languages are not going to easily communicate with hardware originaly exposed through a C/C++ api.

On a somewhat related note, Vala has all the languages features expected of a modern\high-level language(and then some), but compiles to C binary and source, and can easily make use of any library written in C (not sure about c++). Check it out, I havnt used it much, but its pretty cool.

jdc0589
+1  A: 

Implementing a library in C++ provide a lot over java. Once written, C++ library can run on almost any platform (including embedded ones), and can be made available as a native import to a variety of other languages through tools like SWIG. Java can only run on something with enough speed and memory to run a JVM, and the only other Java programs can include the code as a native import. For biometric applications especially I think running on embedded systems would be a large concern, since you could build this into a small sensor.

The more glib answer would be no one wants to wait for your garbage collection cycle to launch the friggen missiles.

Todd Gardner
Original idea of Java was to run on embedded systems, so Java apps run there with KVM, it is only the question have this device support for Java or not. Although java code is executed under controlled environment, in the end even that code happens to run as a low level machine code equal to code written in C (just controlled before execution). JVM for small devices does not take up on resources like its PC version..
ante.sabo
A: 

You could replace Java with any other language there. Probably it has more to do with the APIs and hardware.

Also, Java is more suited for Web Applications. Its not the best choice for desktop applications.

medopal
Java's not really suited to web apps. Having the client bring the JVM into memory to run a web app is SLOW because the JVM is pretty heavyweight - that's why so few people do it anymore. Java's OK for desktop apps, especially if you are multi-platform.
Michael Kohne
i was talking about Servlets! how is that not suited to web apps!?
medopal
in bank where I develop java desktop applications we have over 100 computers of different setup (CPU, memory, mbo, OS..) on which people are working with no problems. True, our java swing app takes cca 100mb of RAM, so computers with 256MB of RAM are close to full load, but everything works fine even on them...
ante.sabo
@medopal: Well, I can only speak as a user of several java-based web apps over the years (including a couple right now on a weekly basis) and I have concluded that Java is entirely unsuited to web apps. No matter what I've been doing, a java based web app takes at least 30-60 seconds to open (let alone do anything), which appears to be time needed to get the jvm running. That kind of lag is completely unreasonable when you've got flash and javascript (both of which perform MUCH better in the real world) available.
Michael Kohne
A: 

For some biometric applications, execution speed is crucial.

For instance, let's say you're doing facial recognition for a checkpoint, and Java takes twice the time to run the algorithm that a compiled language like C++ does. That means if you go with Java, either:

  • The checkpoint lines will be twice as long,
  • You'll have to pay to staff twice as many checkpoints, or
  • Your system will do half as good a job at recognizing faces

None of those are usually acceptable options, which makes using Java a non-starter.

Bob Murphy
I think you are wrong here with your attitude. Just in time compiled code (like Java) can run faster than one-shot compiled code (C++), since it is adjusting to CPU and situation which cannot be predicted when compiling C++ code. I beleive well written Java app could do face recognition faster than C++ equivalent since it does more on optimizations.
ante.sabo
The statement, while true in general theroy, doesn't apply to such embedded systems where the CPU is known and fixed. In those cases, C++ can use Profile Guided Optimization: compile, profile, compile again. That means the optimizations are exactly right for your CPU/program combination, and done before the programmed is burned to ROM.
MSalters
My hypothetical example is based on experience in benchmarking compute-intensive tasks such as 2-D and 3-D graphics algorithms, of which facial and fingerprint recognition are special cases. The result has consistently been that, for the same algorithm, carefully written C/C++ executes faster than Java on the same CPU. Perhaps recent Java runtimes change that, and I'd be very interested in empirical results demonstrating that. But in the face of evidence, anyone's attitude or belief is not relevant.
Bob Murphy