Carey Brown wrote:So if you know the Player who scored what difference does it make which Game or which Team?
Paul Clapham wrote:Carey has pointed out some of the problems with your implementation of that method, but I have to say that I don't understand what the method is supposed to be doing in the first place. Even after reading your description several times I'm still lost.
I don't understand what it means for a team to be playing between two other teams, for one thing: you said
I want this method to be called to show that thePlayer has scored a goal for wat_Team, that is playing between the first_Team and the second_Team
But probably I've misinterpreted what you meant to say there. So let's take an example. Suppose first_Team is "Manchester United" and second_Team is "Toronto Maple Leafs" and wat_Team is "Portland Trailblazers". Can you explain what we should be looking for to see if that's a valid combination, or whatever? Remember I don't know what a Game is in your data model, sometimes you describe it as if it's supposed to be taking place right now but other times it seems like it could represent a game which has already taken place.
Carey Brown wrote:I think some use cases would help get you in the right direction. Example (you'd need to tell us if these are in fact correct):
A Team consists of a number of Players There is one-or-more Games G where Team A plays Team B Player P could play for different Teams for different Games When Player P scores his/her score count needs to be incremented
more?
Junilu Lacar wrote:1. Don't get cute with names. I'm not sure what you're trying to convey with a name like wat_Team but it gets old after reading it a couple of times.
2. The design of this method smells to high heaven. Java is an object-oriented language. With as many different objects that you have involved here, this is not at all an object-oriented way to accomplish anything.
Carey Brown wrote:On line 11 you create a new Player 'p', but then throw it away without doing anything with it.
Carey Brown wrote:Swap looks more like
At the end, v1 contains 5 and v2 contain 9.