Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about OOP 3 SortNames

 
Rory Lynch
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Rory Lynch
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rory Lynch
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic