aspose file tools*
The moose likes Cattle Drive and the fly likes Question about OOP 3 SortNames Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Question about OOP 3 SortNames" Watch "Question about OOP 3 SortNames" New topic
Author

Question about OOP 3 SortNames

Rory Lynch
Ranch Hand

Joined: Aug 03, 2007
Posts: 95
I am currently being nitpicked on OOP1, but I have had a look at the trail ahead and am currently planning how to tackle OOP3.

I have a working version but I have a couple of questions.

OOP 3 states the purpose as;
Purpose: To learn how to work with an ArrayList, how to implement an interface, and how to use I/O.

My solution definitely uses ArrayList and definitely uses IO but I do not use the keyword "implements" anywhere. Is it simply a reference to the fact that by creating an instance of ArrayList I am implementing the Interfaces List and Collection, or am I skipping a part of the lesson?

I make use of the Interface by creating a method that has a parameter of List and I call the method with an ArrayList as the argument, but I could just as easily used ArrayList as the parameter, I used List to make the method more general. Is that a correct use of polymorphism?

It also states in the requirements;
Do not create a second list with the names in a different order. Do not modify the ArrayList or its contents except by using the Collections class.
I am unsure if I have bent this rule slightly
I have used the Collections class to replace elements in my ArrayList, which sounds ok but I use some String manipulation at the same time

Is that forbidden by the above requirement?


I wish that for just one time, you could stand inside my shoes.<br />You'd know what a drag it is to see you.
Rory Lynch
Ranch Hand

Joined: Aug 03, 2007
Posts: 95
I have just had a further look and from some comments made by Marilyn on a recent thread, and the below clause from the requirements.

Do not modify the ArrayList or its contents except by using the Collections class.

I think I am on the wrong side of the law here, hope the Sherrif in this town isn't mean.

I must say I am stumped, but I guess that is the whole point of learning.
Noone said it would be easy.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
My solution definitely uses ArrayList and definitely uses IO but I do not use the keyword "implements" anywhere.

You are missing part of the lesson.

I make use of the Interface by creating a method that has a parameter of List and I call the method with an ArrayList as the argument, but I could just as easily used ArrayList as the parameter, I used List to make the method more general. Is that a correct use of polymorphism?

Excellent. This is definitely polymorphism and a correct way to use it.

I have used the Collections class to replace elements in my ArrayList, which sounds ok but I use some String manipulation at the same time.

Is that forbidden by the above requirement?


It's hard to say from this description. You do need to do some String manipulation for this assignment, but ...

When I did a search on SortNames in ths forum, I came up with 50 threads. Perhaps one of those will give you more clues.

P.S. I am a sheriff. Do you think I am mean


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Rory Lynch
Ranch Hand

Joined: Aug 03, 2007
Posts: 95
Hi Marilyn

No, I dont think you're mean, no meaner than ya ought t' be anyways.

I will do a search for relevant threads, thanks for the tip.
Rory Lynch
Ranch Hand

Joined: Aug 03, 2007
Posts: 95
Got it.

My two concerns...

but I do not use the keyword "implements" anywhere.

and

I have used the Collections class to replace elements in my ArrayList, which sounds ok but I use some String manipulation at the same time

...were really just one problem.

Now I have had a closer look at the Collections classes overloaded sort methods it makes sense.
To be honest when I first looked at the Collections classes sort methods I saw a word that I did not understand, so I ignored it.

That was the key to this assignment.

Great assignment. My program works and my new solution is so much cooler than my previous one. It really has an Object Orientated feel to it.

Thanks for the nudge Marilyn.
[ October 21, 2007: Message edited by: Rory Lynch ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about OOP 3 SortNames