To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 25292
25291  |  25293
Subject: 
Re: Why Java for Robots (was NXT and bluetooth enabled phones)
Newsgroups: 
lugnet.robotics
Date: 
Tue, 17 Jan 2006 18:11:01 GMT
Original-From: 
steve <sjbaker1@airmail./IHateSpam/net>
Viewed: 
1692 times
  
Laurent Desnogues wrote:

Well what about an indexation based on a sensor value?
How could your compiler know the range the sensor has?

The point about C++ is that you can overload the array indexing
mechanism and build a 'class' to implement arrays that does array
bounds checking (or implements the "array" as a linked list or
stores it on disk or whatever else you can imagine).

If you need array bounds checking because this application is
'failure sensitive' - then you can have it.  In fact, there are
plenty of libraries out there that do exactly that for you.

This makes array bounds checking something that you can choose
to do where the consequences of an error are very serious (eg
Robot on Mars) or you can leave it off in cases where bounds
checking cripples performance (eg Video Games) and the consequences
of inadvertent failure are negligable.

C++ is not a language for inexperienced programmers - it's for
intelligent, experienced professionals who know what they are
doing and why they are doing it.  C++ programmers have to
know where to put up self-imposed walls of protection and where
to sacrifice that protection for performance.

Java (and it's ilk) certainly protect you and force you into
'good practices' - but they don't give you a way out when you
need it.   Remember that Java was intended to keep the programmer
inside a secure sandbox.  When you visit a web site and Java is
enabled on your browser, the theory is that Java is unable to break
out of the sandbox and destroy your computer - so you can trust
completely unknown applications not to do nasty things.  You couldn't
trust C++ in that way - which is why Microsoft's "Active-X" is such
an incredibly stupid idea.

Both languages have their place.

There is no "Java is better than C++" or "C++ is better than Java".
It depends what you are doing and who is doing it.

I would submit though that if you can't trust your programmers
not to cause an array bounds overflow, you can't trust them to
write Mars rover software - even in Java.  Remember - if one
half of the software uses metric measurements and the other
half uses feet and inches - then no programming language on
the planet is going to save you.

My programming team has been working for six years on a
million-lines-of-code C++ program.  We have had our fair
share of bugs - but I can't recall a single array bound
overflow problem in all that time.



Message has 1 Reply:
  Re: Why Java for Robots (was NXT and bluetooth enabled phones)
 
(...) You seem to be confusing "Java" with "Javascript", they are not at all the same thing. It's unfortunate that Javascript is named to suggest that it is somehow similar. Javascript in a browser (it can only execute within a browser) is (...) (19 years ago, 17-Jan-06, to lugnet.robotics)

Message is in Reply To:
  RE: Why Java for Robots (was NXT and bluetooth enabled phones)
 
(...) Well what about an indexation based on a sensor value? How could your compiler know the range the sensor has? Sample: int volatile *color_sensor = (int *) 0x4000; int getColor(void) { static int color[4] = { 123, 456, 789, 111 }; return (...) (19 years ago, 17-Jan-06, to lugnet.robotics)

4 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR