Typed Tutorial

As part of learning Scalding, I wrote a new version of the tutorials that uses the Typed API, and I thought I would share it here in case it could be helpful to people learning Scalding for the first time, so they have some more examples walking through how the Typed API works.

If you have feedback on style, idioms, or my descriptions are incorrect or unclear, I would love to hear it so I can fix it, and more importantly, learn how scalding works.

I also made this all one file, with the different tutorials selected using a command-line flag because I found it easier to see everything in one file. But I would be happy to break it out into separate files as the original tutorial did.
Well, you can use the TDsl or Dsl imports as needed, but generally only as
needed.

Yes, in this case, .typed needs TDsl. Do this:

```scala
val result: Pipe = {
  import TDsl._ // to get the .typed enrichment
  ...read.typed('x -> 'y) { TypedPipe[String] =>

   }
}
```

Or put it in a file without so much so that it does not confuse people into
thinking TDsl is needed everywhere.

The risk of cargo cult is high.


On Thu, Jun 12, 2014 at 2:20 PM, Brandon Holt <notifications@github.com>
wrote:

> In tutorial/TypedTutorial.scala:
>
> > +These tutorials are all run from this single file; which one is run can
> > +be chosen with a command-line flag "--tutorial". For instance, to run the
> > +first tutorial example:
> > +
> > +> ./scripts/scald.rb --local tutorial/TypedTutorial.scala \
> > +      --tutorial 0 \
> > +      --input tutorial/data/hello.txt \
> > +      --output tutorial/data/output0.txt \
> > +      --words tutorial/data/word_scores.tsv
> > +
> > +(Note: only tutorial 5 uses "word_scores.tsv")
> > +**/
> > +class TypedTutorial(args : Args) extends Job(args) {
> > +  // Import the DSL implicits inside a scope so they don't leak out and
> > +  // cause mysterious behaviour elsewhere.
> > +  import TDsl._
>
> Hmm, the "typed block" command doesn't work without TDsl. What's the deal
> with that import? Is it supposed to be deprecated, and all the implicits
> just come in with import com.twitter.scalding._?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/twitter/scalding/pull/897/files#r13727172>.
>



-- 
Oscar Boykin :: @posco :: http://twitter.com/posco