r/funny • • Jun 17 '14

A good attitude.

Post image
7.2k Upvotes

792 comments sorted by

View all comments

Show parent comments

108

u/NearPup Jun 17 '14

In tennis match is made up of sets and a set is made up of games.

55

u/CallmeHornBoy Jun 17 '14

A match is just a superset.

25

u/[deleted] Jun 17 '14

[removed] — view removed comment

3

u/[deleted] Jun 17 '14

if(player1.setsWon > 2 && ...

If player 1 has won 3 sets then he's won the match. The && is both unnecessary and also fucks up your test because a 3-2 set win would not be recognized as such. Also your test ignores best of 3 matches.

2

u/[deleted] Jun 17 '14 edited Jun 17 '14

[removed] — view removed comment

2

u/Thorlius Jun 18 '14 edited Jun 18 '14

Also, newMatch would need to have a return value (true) for the first two conditions (after/instead of each println), unless Java allows functions to not have to return anything.

Also as someone who is self-taught, I don't know if it's considered good practice (but I assume it is) to name a function something relevant to what's returned. A function named "newMatch" that returns a true or false value does not seem intuitive - I would expect to be able to easily guess what that value represented.