Skip to content

word-search: add to track - #617

Merged
FridaTveit merged 1 commit into
masterfrom
word-search
Jun 6, 2017
Merged

FridaTveit merged 1 commit into
masterfrom
word-search

Conversation

@stkent

@stkent stkent commented May 30, 2017

Copy link
Copy Markdown
Contributor

x-common directory


Reviewer Resources:

Track Policies

expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10))));

final Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search(
expectedLocations.keySet(),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how I feel about this... inviting comments!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think keeping it like this is okay :) It might be a bit clearer to declare the set separately and name it wordsToSearchFor or something. But it's fine as it is :)

@stkent

stkent commented May 30, 2017

Copy link
Copy Markdown
Contributor Author

I helped write the canonical data for this exercise, and at the time I advocated for this "building up" of the search list as the tests progress; however, after implementing, I'm not convinced. In a real system, if e.g. search left to right behavior was to suffer from a regression, every single test would break at once. Other tracks (pre- canonical data) had passed in a single-item list for all but the final test, and then had a final check that all words could be found simultaneously. There's still some crossover there, but less (max 2 tests fail if any search direction suffers from a regression). 🤷‍♂️

@stkent
stkent force-pushed the word-search branch 4 times, most recently from c78dbf6 to b2bebe2 Compare May 30, 2017 12:03
Comment thread config.json
"topics": []
},
{
"slug": "word-search",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a 7

@FridaTveit FridaTveit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! :) Just a couple of questions :)

Pair pair = (Pair) o;

if (x != pair.x) return false;
return y == pair.y;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't this be return x == pair.x && y == pair.y?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can, nice spot! (IntelliJ generated this implementation for me 😇.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's strange that it would generate it like that... So do you want to simplify it? :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, yes, thanks!


dependencies {
testCompile "junit:junit:4.12"
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline? :)

expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10))));

final Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search(
expectedLocations.keySet(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think keeping it like this is okay :) It might be a bit clearer to declare the set separately and name it wordsToSearchFor or something. But it's fine as it is :)

@stkent

stkent commented Jun 3, 2017

Copy link
Copy Markdown
Contributor Author

@FridaTveit updated!

@FridaTveit FridaTveit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! :) Just one thing which can be simplified :)

Pair pair = (Pair) o;

if (x != pair.x) return false;
return y == pair.y;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's strange that it would generate it like that... So do you want to simplify it? :)

@stkent

stkent commented Jun 5, 2017

Copy link
Copy Markdown
Contributor Author

Updated, building now!

@FridaTveit FridaTveit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @stkent! :)

@FridaTveit
FridaTveit merged commit 6208d8f into master Jun 6, 2017
@stkent
stkent deleted the word-search branch June 7, 2017 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants