X Tutup
Skip to content

#184 Fluent Interface pattern#225

Merged
npathai merged 5 commits intoiluwatar:masterfrom
hannomalie:fluentinterface
Sep 10, 2015
Merged

#184 Fluent Interface pattern#225
npathai merged 5 commits intoiluwatar:masterfrom
hannomalie:fluentinterface

Conversation

@hannomalie
Copy link
Copy Markdown
Contributor

No description provided.

@npathai
Copy link
Copy Markdown
Contributor

npathai commented Aug 21, 2015

@hannespernpeintner Did you get the lazy meaning? You can try implementing if you want. You know it never hurts to have something extra.

@hannomalie
Copy link
Copy Markdown
Contributor Author

Yes i got it. I'll implement a lazy version as well :)

@hannomalie
Copy link
Copy Markdown
Contributor Author

Okay, took me more time than expected because the lazy implementation is more complex than the eager one - but I added a lazy implementation and extracted an interface.

Would be nice to hear your thoughts :)

@npathai
Copy link
Copy Markdown
Contributor

npathai commented Aug 26, 2015

@hannespernpeintner I have been a bit busy lately. Will be sending initial comments soon.

@hannomalie
Copy link
Copy Markdown
Contributor Author

Hey, what about your feedback? :)

@npathai
Copy link
Copy Markdown
Contributor

npathai commented Sep 1, 2015

@hannespernpeintner Give me a day or two :)

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.

Other way: "Filters the contents of Iterable using the given predicate, leaving only the ones which satisfy the predicate."

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.

Done.

@npathai
Copy link
Copy Markdown
Contributor

npathai commented Sep 2, 2015

@hannespernpeintner I am done with initial review. Awaiting your response.

@hannomalie
Copy link
Copy Markdown
Contributor Author

Thank you very much for your excellent feedback. I corrected everything you stated (I think) - that's the reason I passed on replying to some of your comments. Some points probably need further discussion, so I replied to them directly.

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.

We don't need to populate the list on each computeNext(). You can cache it on first call and then utilize it. If you have issues implementing then I can give you a sample.

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.

Yes you're right. I changed it.

@npathai
Copy link
Copy Markdown
Contributor

npathai commented Sep 3, 2015

Summary of review:

  • Logic: I have some doubts about implementation of last(count) in both versions. Will be giving feedback on that after trying something myself.
  • Suggestion: It is difficult to review the changes undertaken so I suggest you to leave comments on the points incorporated as well. Something like Done! will be quite helpful.
  • Suggestion: We can document that SimpleFluentIterable is too costly to be utilized in real applications.
  • Doubt: Do we need forEach() method in our FluentIterables as they already extend Iterable and there is default implementation in interface.

@hannomalie
Copy link
Copy Markdown
Contributor Author

  • Thank you for your effort. What are your doubts about: performance, if they're necessary, if they are wrong?
  • I added a comment for all comments of yours.
  • Should this be added to the class documentation, or what's the best place to add it?
  • My first implementation allowed to embed it as a non-terminating operation in a fluent usage, but later, I changed it. Now I removed it, we don't need it as it is now.

Thank you so far, I'm looking forward to your next comments :)

@npathai
Copy link
Copy Markdown
Contributor

npathai commented Sep 4, 2015

  • Yes about performance.
  • Great.
  • Yes class documentation would be perfect!
  • Great.

I am moving towards final review. Will provide comments soon.

@hannomalie
Copy link
Copy Markdown
Contributor Author

I ammended documentation changes. Nothing left to do currently, thank you for your help, I'm waiting for further responses :)

@npathai
Copy link
Copy Markdown
Contributor

npathai commented Sep 7, 2015

LGTM you can move towards other tasks to complete this PR.

Tasks:

  • Implementation
  • Documentation
  • Code formatting according to Google Java guide
  • Verify coverage
  • Create class diagram
  • Provide website content - visit wiki for steps
  • * We can have better tests for this design pattern. But that can be other PR.
  • Get pom.xml version info verified by @iluwatar

@hannomalie
Copy link
Copy Markdown
Contributor Author

The latest commit should complete the PR. However, I can't find a guideline to your code coverage rules. Currently, the coverage is 91.5%.

@npathai
Copy link
Copy Markdown
Contributor

npathai commented Sep 7, 2015

@hannespernpeintner Its good enough 👍 I will bring this point up on chat room and soon we will add the guideline on coverage ratio.

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 public?

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.

Was a mistake, made it private.

@npathai
Copy link
Copy Markdown
Contributor

npathai commented Sep 7, 2015

@hannespernpeintner You have not created an index.md file as suggested in How to contribute section. Your branch is far too outdated, you need to merge the changes from iluwatar/master into your fork/master branch. We have removed the patterns from README and created website pages. So you need to incorporate those changes.

@hannomalie
Copy link
Copy Markdown
Contributor Author

Ah, this totally bypassed me. I rebased and added the description. Anything else (the ci seems to fail)? :)

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.

Add Credits section.

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.

What do you want me to write under the credits section? FluentInterface from Guava is linked in the real world examples and the interface's class documentation states the inspiration from Guava.

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.

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.

Added.

@npathai
Copy link
Copy Markdown
Contributor

npathai commented Sep 8, 2015

@hannespernpeintner Include Iterable in UML diagram. Also add association links between the classes in diagram such as App uses FluentIterable.

@hannomalie
Copy link
Copy Markdown
Contributor Author

Included. I considered some relationships as unimportant, so I left them out. Everything pushed, what else? :)

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.

This can also be a part of FAQ?
"What is the difference between FluentInterface and Builder pattern?"

Also we can elaborate the answer there by saying that Builder often uses a FluentInterface to make it easy to construct objects when they have many optional parameters and so on.

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.

Moved it to the FAQ and extended it a bit.

@npathai
Copy link
Copy Markdown
Contributor

npathai commented Sep 9, 2015

@hannespernpeintner I have commented on a few last changes. Once done we can merge it 🎉

@hannomalie
Copy link
Copy Markdown
Contributor Author

I corrected them, kindly ask you to have the last look on it :)

npathai added a commit that referenced this pull request Sep 10, 2015
@npathai npathai merged commit 0148cd7 into iluwatar:master Sep 10, 2015
pratigya0 pushed a commit to pratigya0/java-design-patterns that referenced this pull request Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup