Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

learning java



On Thu, 29 Apr 2004, Mark J. Dulcey wrote:
> In the first example, I assume that what you're getting at is that you 
> should change the value of the Integer objects in the hashmap rather 
> than creating new ones. It's not an issue in C, because your hash table 
> would contain ints (primitive types) rather than objects.

Yup.  Like I said, though, it's a poking stick.  *Why* does somebody make 
the mistake -- do they blow right past it and not even stop to think about 
it?  Do they pause and say something like "I'm not sure if C and Java do 
this the same way....?"  When somebody is sitting in front of me claiming 
years of Java experience and with all the confidence in the world writes 
down something like:
	Integer i = map.get(foo);
	i++;
then we have a problem.  I will likely say "That won't work in Java" as a 
hint, maybe shake off the C++ cobwebs.  After they figure out why that is 
bad, we then go on to the bigger question of whether they can figure out 
how to make a mutable Integer.
 
> > It's also symptomatic of a failing of the current state of computer 
> education; nobody teaches anything about low-level efficiency issues any 
> more. I don't think a typical CS101 or CS102 class (which is taught in 
> Java at most schools now) would ever mention the issue in your example. 

Well, there's two -- there's te whole objects vs primitives thing, which I 
think is just core Java skills.  ( I do regularly get people who tell me 
that with Java1.5, 'boxing' will fix some of that problem. )  But yeah, 
the optimization is the harder part of the question.  It's nice if they 
recognize that they might not have to create a few million objects if they 
don't have to, even if they don't know how to avoid it.  Just because 
we're talking about questions that involve writing code doesn't mean that 
the answer is as easy as running the code through a compiler.

> The second example is nearly correct C++ (except that the Java syntax 
> for finding the length of the array has been used); it would also work 
> in C if boolean and false have been defined somewhere, as they often 
> are. In Java, of course, you have to use new to create arrays, and you 
> don't have to bother initializing them to false because Java already 
> does it for you.

Exactly.  And, again, not a question on which to base the final decision.  
But I gotta say, somebody doesn't declare an array properly and i'm gonna 
ask "When's the last time you wrote Java code?"  Just how basic of a 
syntax question am I allowed to ask these people?  Make the questions too 
basic and I'm told that they're so trivial that people shouldn't be judged 
on them.  Make them too complex and it's not fair because they're not 
given adequate time to think abut the answer.  Make them too esoteric and 
I get the google defense.

 Duane








BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org