Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to understand `Iteratee` in play2?

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?

like image 576
Freewind Avatar asked Mar 25 '12 05:03

Freewind


2 Answers

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 ;)

like image 57
mandubian Avatar answered Nov 11 '22 05:11

mandubian


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/

like image 41
Jordan Denison Avatar answered Nov 11 '22 06:11

Jordan Denison