Java Forum / First Aid / December 2005
For those Deprived Of Homework
Roedy Green - 18 Nov 2005 19:28 GMT Not everyone is fortunate enough to have the money to pay professors to think up homework problems for them. For the rest of you who are new, and think you need the exercise, here is a problem for you to tackle:
There are even simpler ones at: http://mindprod.com/projects/beginner.html
Predator Prey
This exercise teaches basic Collections and generics. Pick an ecosystem. Create a set of Species objects that contain some facts about each species such as name and average adult weight in k.g. Now accept facts about predator and prey relationship encoded with a method:
public static void eats( String predator, String prey );
There should be a method:
public static Species[] whoEats( String prey ) and there should be a method:
public static Species[] whoIsEatenBy( String predator )
and finally:
// All Species heaviest first public static Species[] speciesByWeight()
Implement the predator->prey and prey->predator lookups with one-to-many mappings using a HashMap keyed by species name whose value is an ArrayList of Species that you maintain in sorted order by species name. When you insert, use Collections. binarySearch to find the new insertion point.
Implement speciesByWeight using a Collections.sort rather than a TreeSet. Make sure you include all species, without duplicates.
For bonus points, implement:
public staticSpecies[] whoIsIndirectlyEatenBy( String predator ) Watch out for endless recursion.
Note that I have not told you all the pieces you will need to create to solve the puzzle. I am not totally spoon feeding you in this exercise.
see http://mindprod.com/jgloss/comparable.html http://mindprod.com/jgloss/hashmap.html http://mindprod.com/jgloss/binarysearch.html http://mindprod.com/jgloss/sort.html http://mindprod.com/jgloss/arraylist.html
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Monique Y. Mudama - 18 Nov 2005 20:07 GMT > Not everyone is fortunate enough to have the money to pay professors > to think up homework problems for them. For the rest of you who are [quoted text clipped - 3 lines] > There are even simpler ones at: > http://mindprod.com/projects/beginner.html Good idea, Roedy. A lot of times I want to learn a language, but have trouble getting started without a problem to solve.
> Predator Prey > [quoted text clipped - 42 lines] > http://mindprod.com/jgloss/sort.html > http://mindprod.com/jgloss/arraylist.html
 Signature monique
Ask smart questions, get good answers: http://www.catb.org/~esr/faqs/smart-questions.html
Thomas G. Marshall - 20 Nov 2005 16:20 GMT Monique Y. Mudama said something like:
>> Not everyone is fortunate enough to have the money to pay professors >> to think up homework problems for them. For the rest of you who are [quoted text clipped - 6 lines] > Good idea, Roedy. A lot of times I want to learn a language, but have > trouble getting started without a problem to solve. Sure. Remember though, that if java is their first exposure to OOD, then OOD is the major hurdle, not the language. This requires a great deal of forethought.
Furthermore, it's likely to spark some debate. But that is fine as well.
 Signature Enough is enough. It is /not/ a requirement that someone must google relentlessly for an answer before posting in usenet. Newsgroups are for discussions. Discussions do /not/ necessitate prior research. If you are bothered by someone asking a question without taking time to look something up, simply do not respond.
Monique Y. Mudama - 21 Nov 2005 14:20 GMT > Monique Y. Mudama said something like: >>> Not everyone is fortunate enough to have the money to pay [quoted text clipped - 14 lines] > Furthermore, it's likely to spark some debate. But that is fine as > well. That's the only reason I'm leery of the "contest" aspect. Since you're not supposed to share your work on the group (sensible for the contest aspect), it seems like a lot of the possible benefit will be lost (if Roedy is the professor, then maybe the group could act as a collective TA). But talking through the design aspect seems extremely beneficial.
In my CS dept we had an "open hands" policy -- you could talk about a problem with any other student, provided that after you were done, neither of you took away anything written or typed. You could even work on whiteboards together, etc., as long as afterwards, the whiteboard was wiped down. I thought it was a good way to allow people to brainstorm together while still requiring them to understand the problem in order to solve it. I don't know how well that idea would hold up in a newsgroup, though. Of course here, as there, it would be a matter of honor.
 Signature monique
Ask smart questions, get good answers: http://www.catb.org/~esr/faqs/smart-questions.html
Roedy Green - 21 Nov 2005 16:16 GMT On Mon, 21 Nov 2005 07:20:39 -0700, "Monique Y. Mudama" <spam@bounceswoosh.org> wrote, quoted or indirectly quoted someone who said :
>That's the only reason I'm leery of the "contest" aspect. Since >you're not supposed to share your work on the group (sensible for the >contest aspect), it seems like a lot of the possible benefit will be >lost (if Roedy is the professor, then maybe the group could act as a >collective TA). But talking through the design aspect seems extremely >beneficial. Hmm. This has to be closer to the vest than an regular homework assignment since the goal in not only to complete the basic assignment but to do it better than anyone else. I have not heard any interest from the contestants, so I fear this is a bust.
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Monique Y. Mudama - 21 Nov 2005 18:46 GMT > On Mon, 21 Nov 2005 07:20:39 -0700, "Monique Y. Mudama" ><spam@bounceswoosh.org> wrote, quoted or indirectly quoted someone [quoted text clipped - 11 lines] > assignment but to do it better than anyone else. I have not heard > any interest from the contestants, so I fear this is a bust. *nod* I understand why, for a contest, people wouldn't go sharing their work before the due date.
It's a fairly ambitious assignment. I'd think the offer of free books would get people's attention, though.
I like the idea very much. If no one answers, please don't give up on trying original ways to get people to learn. (I thought about doing it "just for fun", but right now I just don't have the time ... actually, this may be a problem for a lot of people. I know Canada's Thanksgiving has come and gone, but in the US we're just gearing up, and for most here it is a big deal.)
 Signature monique
Ask smart questions, get good answers: http://www.catb.org/~esr/faqs/smart-questions.html
Roedy Green - 18 Nov 2005 22:47 GMT On Fri, 18 Nov 2005 19:28:32 GMT, Roedy Green <my_email_is_posted_on_my_website@munged.invalid> wrote, quoted or indirectly quoted someone who said :
>Predator Prey > >This exercise teaches basic Collections and generics. To make this interesting I am offering a prize to the "best" submission. I'll be the judge, unless others want to volunteer to help too. I will take into account brevity, clarity, elegance, reusability of components, ease of maintenance and extension, handicapped by degree of previous experience. Let us know just how much experience you have.
Note the problem is quite open ended. Feel free to improvise and dazzle.
The prize is not spectacular, but I hope will confer on you some honour and respect.
You have a choice of two brand new books of which I happen to own duplicates:
Internetworking with TCP/IP Volume I, Principles, Protocols, and Architecture. This explains how the TCP/IP and the Internet work, the bits and bytes. hardcover see http://mindprod.com/jgloss/tcpip.html#LEARNINGMORE
or
Crossing the Rubicon, the Decline of the American Empire at the end of the age of oil by Michael C. Ruppert. see http://mindprod.com/politics/bushbooks911.html#RUBICON
I propose a nickname for the prize, analogous to the Oscar, the "moose".
Please DON'T post your submissions. Email them to me, and then feel free to post them after judgment day, 2005-12-10 0:00 Human Rights day. Also feel free to ask questions or to just let others know you are chewing on the problem to generate some interest in competing.
Please bundle your code in a ZIP. If you think of something better before judgment day, send a replacement marked as such.
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Moloch - 19 Nov 2005 00:33 GMT ...
Oh god, is this some kind of humor? I'm afraid it's not... Noboby gives a sh.t about this. Feel free to do whatever you want on your site but not here and stop spamming.
Redbeard - 19 Nov 2005 02:44 GMT Roedy a spammer? You gotta be kidding.
He one of the most regular contributors to this forum. Over the years, I've read hundreds of his posts where he's helped Java rookies. He's helped me personally several times, and I'm not a rookie. Take his post for what it is, or leave it alone. But save the unwarranted criticism for someone who cares. Just don't expect to find too many here.
> ... > > Oh god, is this some kind of humor? I'm afraid it's not... Noboby gives a > sh.t about this. Feel free to do whatever you want on your site but not here > and stop spamming. Roedy Green - 19 Nov 2005 11:38 GMT >Oh god, is this some kind of humor? I'm afraid it's not... Noboby gives a >sh.t about this. Feel free to do whatever you want on your site but not here >and stop spamming. I get emails every day from people asking me to give them ideas for projects to help them learn Java. I came up with this one that I figured would be good to help understand Collections. HashMap, ArrayList, sort and binarySearch.
Then I thought of the idea of making it into a contest to provide a little extra positive feedback for doing the learning.
I posted this once in a topic aimed at newbies. So I can't see the logic by which you categorise it as spam.
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Thomas G. Marshall - 20 Nov 2005 16:34 GMT Moloch said something like:
> ... > > Oh god, is this some kind of humor? I'm afraid it's not... Noboby gives a > sh.t about this. Feel free to do whatever you want on your site but not > here > and stop spamming. *IF* this is the kind of thing that bothers you then simply ignore it.
I see the possible reasons for your reaction as versions of the following, any one, combination, or none of which may be the real reason.
*ALL* are fraudulent to one degree or another.
1. How dare Roedy pretend to be important enough to establish his own teaching mechanism here, as if we all condone it.
1a. How dare Roedy pretend that this is somehow *his* forum.
1b. I'm sick of seeing Roedy's posts everywhere.
2. How dare Roedy even pretend to be good enough for this.
2 modified: Roedy is wrong as often as he is right.
3. This is a waste of everyone's time.
3a. Because no one goes to a newsgroup for homework. And it's just the wrong place for it, so he deserves bashing.
3b. Because his examples might require much of the group to argue about whether or not his ideas make sense.
3c. Because it is hard for me to ignore it.
4. Roedy's particular example/suggestion is not very good.
5. Roedy's a schmuck, and I hate schmucks.
In any case, such reactions might require you to rethink your own motives in this, and remember that your views might not be the same as others.
 Signature Enough is enough. It is /not/ a requirement that someone must google relentlessly for an answer before posting in usenet. Newsgroups are for discussions. Discussions do /not/ necessitate prior research. If you are bothered by someone asking a question without taking time to look something up, simply do not respond.
Roedy Green - 21 Nov 2005 08:37 GMT On Sun, 20 Nov 2005 16:34:00 GMT, "Thomas G. Marshall" <tgm2tothe10thpower@replacetextwithnumber.hotmail.com> wrote, quoted or indirectly quoted someone who said :
>1. How dare Roedy pretend to be important enough to establish his own >teaching mechanism here, as if we all condone it. [quoted text clipped - 25 lines] > >5. Roedy's a schmuck, and I hate schmucks. This is what Dr. Eric Berne called "fighting in quotes".
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Thomas G. Marshall - 21 Nov 2005 13:47 GMT Roedy Green said something like:
> On Sun, 20 Nov 2005 16:34:00 GMT, "Thomas G. Marshall" > <tgm2tothe10thpower@replacetextwithnumber.hotmail.com> wrote, quoted [quoted text clipped - 31 lines] > > This is what Dr. Eric Berne called "fighting in quotes". {shrug} So long as you understand that I was defending you.
 Signature http://www.allexperts.com is a nifty way to get an answer to just about /anything/.
Casey Hawthorne - 21 Nov 2005 15:21 GMT So you won't be drawn and quoted! -- Regards, Casey
Monique Y. Mudama - 21 Nov 2005 18:47 GMT > So you won't be drawn and quoted! > -- > Regards, > Casey That sounds clever, but I can't tell who you're talking to, or about what.
 Signature monique
Ask smart questions, get good answers: http://www.catb.org/~esr/faqs/smart-questions.html
Roedy Green - 21 Nov 2005 19:56 GMT On Mon, 21 Nov 2005 11:47:22 -0700, "Monique Y. Mudama" <spam@bounceswoosh.org> wrote, quoted or indirectly quoted someone who said :
>That sounds clever, but I can't tell who you're talking to, or about >what. "fighting in quotes" == "hanged, drawn and quoted"
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Thomas G. Marshall - 21 Nov 2005 21:39 GMT Monique Y. Mudama said something like:
>> So you won't be drawn and quoted! >> -- [quoted text clipped - 3 lines] > That sounds clever, but I can't tell who you're talking to, or about > what. He was talking to me. Google for the rest---it'll confuse everybody about the intent if I parot it back now.
Is your server retention near 0? I've bumped into a few similarly aflicted in the past.
It is what makes quoting /critical/.
 Signature Onedoctortoanother:"Ifthisismyrectalthermometer,wherethehell'smypen???"
Monique Y. Mudama - 21 Nov 2005 21:52 GMT > Monique Y. Mudama said something like: >>> So you won't be drawn and quoted! -- Regards, Casey [quoted text clipped - 7 lines] > Is your server retention near 0? I've bumped into a few similarly > aflicted in the past. Nah, I used the parent lookup feature on my client, but I still couldn't tell exactly what was meant. I like Casey's expression, though!
> It is what makes quoting /critical/. Definitely agree with you there.
 Signature monique
Ask smart questions, get good answers: http://www.catb.org/~esr/faqs/smart-questions.html
DrMatrix - 02 Dec 2005 04:08 GMT In article <i8rgf.744$r96.17@trndny05>, "Thomas G. Marshall" <tgm2tothe10thpower@replacetextwithnumber.hotmail.com> wrote:
> Monique Y. Mudama said something like: > >> So you won't be drawn and quoted! [quoted text clipped - 12 lines] > > It is what makes quoting /critical/. I thought fighting in quotes was what makes quoting /critical/.
Thomas G. Marshall - 02 Dec 2005 05:17 GMT DrMatrix said something like:
> In article <i8rgf.744$r96.17@trndny05>, > "Thomas G. Marshall" [quoted text clipped - 20 lines] > > I thought fighting in quotes was what makes quoting /critical/. No, that only makes quoting sneaky. Seriously though, there are a number of people with crap newsservers with horrible retention.
 Signature "It's easier to be terrified by an enemy you admire." -Thufir Hawat, Mentat and Master of Assassins to House Atreides
Roedy Green - 21 Nov 2005 20:57 GMT On Mon, 21 Nov 2005 13:47:27 GMT, "Thomas G. Marshall" <tgm2tothe10thpower@replacetextwithnumber.hotmail.com> wrote, quoted or indirectly quoted someone who said :
>{shrug} So long as you understand that I was defending you. Precisely. That's what fighting in quotes is. You, on the surface, appear to be defending.
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Thomas G. Marshall - 22 Nov 2005 15:01 GMT Roedy Green said something like:
> On Mon, 21 Nov 2005 13:47:27 GMT, "Thomas G. Marshall" > <tgm2tothe10thpower@replacetextwithnumber.hotmail.com> wrote, quoted [quoted text clipped - 4 lines] > Precisely. That's what fighting in quotes is. You, on the surface, > appear to be defending. Still don't understand what you're saying. Are you saying that deep down I /wasn't/ defending?
Roedy Green - 22 Nov 2005 16:25 GMT On Tue, 22 Nov 2005 15:01:29 GMT, "Thomas G. Marshall" <tgm2tothe10thpower@replacetextwithnumber.hotmail.com> wrote, quoted or indirectly quoted someone who said :
>Still don't understand what you're saying. Are you saying that deep down I >/wasn't/ defending? Fighting in quotes is a technique to use when you are in a position where you can't fight, or you fear retaliation, or when it would be considered impolite to fight, where you can still get your barbs in.
You put your fictitious barbs in some proxy mouth, perhaps even the mouth of a fictitious person.
You pose as merely reporting. You are covered, yet you can say anything you want.
It is similar to a hypnosis technique where you make comments about a third party that are actually directed to the subject. This reduces resistance to them being heard, and gives them no way to rebut their applicability.
What you did was a classic example of fighting in quotes. Whether you did it accidentally, consciously or unconsciously, only you know.
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Thomas G. Marshall - 22 Nov 2005 17:32 GMT Roedy Green said something like:
...[rip]...
> What you did was a classic example of fighting in quotes. Whether you > did it accidentally, consciously or unconsciously, only you know. What a load of crap, sorry. I meant, and did, expose every *hidden* possible and fraudulent reason for bashing you. Silly things that he just wasn't saying while he was hiding behind his supposed concern for the group. I erased his complaint and replaced it with the real issue, all while establishing them all as "fradulent", which was my *clear* preface.
If you want to argue with me saying how I was arguing against you in a hidden way while looking like I was helping you then do so at your own peril. I thought I was stopping him dead in his tracks while helping you at the same time.
Alex Molochnikov - 20 Nov 2005 19:16 GMT > ... > > Oh god, is this some kind of humor? I'm afraid it's not... I hope it's not.
> Noboby gives a sh.t about this. Speak for yourself. Or perhaps, you already do, Mr. Nobody?
> Feel free to do whatever you want on your site but not here > and stop spamming. Would you like to review the posts prior to their submissions, and give your stamp of approval, Mr. Internet Cop? Sending them to you by e-mail is also spamming, so how about FedEx?
Alec G. Bickerton - 29 Nov 2005 13:08 GMT > Not everyone is fortunate enough to have the money to pay professors > to think up homework problems for them. For the rest of you who are [quoted text clipped - 50 lines] > http://mindprod.com/jgloss/sort.html > http://mindprod.com/jgloss/arraylist.html [snip] Roedy,
Cracking idea. I shall be passing this on, to someone who is trying to learn java at the moment. As has been mentioned already, It is non trivial to learn something when there is no problem to solve.
Alec.
Thomas G. Marshall - 29 Nov 2005 15:33 GMT Alec G. Bickerton said something like:
...[rip]...
> Cracking idea. I shall be passing this on, to someone who is trying > to learn java at the moment. As has been mentioned already, It is non > trivial to learn something when there is no problem to solve. I would split from this ever so slightly in that I would stress that a newbie attempt to create an actual /product/. And involve *all* aspects of it, including deployment issues.
This is very likely to uncover an enormous amount of critical information that makes one valuable.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|