问题
There's a package play.api.libs.iteratee
in play2, which has a big object Iteratee
which has more than 1000 lines.
Why play2 need such a big object and how to understand it?
回答1:
I just wrote an article trying to explain the concepts of Iteratees provided by Play2 for those who try to discover them.
http://mandubian.com/2012/08/27/understanding-play2-iteratees-for-normal-humans/
Here is the conclusion of the article because it appears I must put essential parts to answer your question. But my article is a whole and your question is also quite large...
Anyway, why should I use Iteratee / Enumerator / Enumeratee ?
I want to tell you that Iteratee / Enumerator / Enumeratee is not a funny tool for people found of functional constructions. They are useful in many domains and once you will understand how they work, I can promise you that you will begin to use it more and more.
Modern web applications are not only dynamically generated pages anymore. Now you manipulate flows of data coming from different sources, in different formats, with different availability timing. You may have to serve huge amount of data to huge number of clients and to work in distributed environments.
Iteratee are made for those cases because there are safe, immutable and very good to deal with data flows in realtime. Let’s tell the buzzword you can see more & more “Realtime WebApp” and Iteratee is associated to that ;)
回答2:
You can understand it better by reading the following:
http://jsuereth.com/scala/2012/02/29/iteratees.html
http://github.com/playframework/Play20/wiki/Iteratees
http://mandubian.com/2012/08/27/understanding-play2-iteratees-for-normal-humans/
来源:https://stackoverflow.com/questions/9858095/how-to-understand-iteratee-in-play2