tisdag 9 november 2010

Öredev 2010 Dag 1 (tisdag) anteckningar

Koans, Katas, Oh my by Cory Foy


Practice outside production is essential
Write dreyfus number 1-5 on head of others in conversation
Shu Ha Ri

Koans is a mindset, the actual excercises are katas.
Katas: You know solution, practice solving them

Code Kata origin: Dave Thomas

Katacasts

KataFizzBuzz
http://codingdojo.org/cgi-bin/wiki.pl?KataFizzBuzz

TDD as you meant it (gojko.net)
Only refactor out production code

Code retreat - C0d3r3tr3at

Game Of Life

How do we try out stuff otherwise? We introduce in in our production code! Is that good?

Cory Haynes – Has done a lot of Javascript testing lately.
Scala Thinking by Ted Neward
Functional
  • Order Does Not Matter à No notion of sequence like
·        i=1;
·        i =i+2;
  • There is no shared state à always same return from function – no side effects.
  • But: Sometimes order matter (fly before explodes)
  • Scala says: There’s goodness in both functional and OO world.

What the outcome of combo of F and OO is not yet known, nobody knows!
Scala is impure FL, allows
-         functions as first-class values
-         strongly typed, type-inferenced
-         immutable values
-         expressions-not-statements
-         typles, lists                                        
-         recursion
-         pattern-matching
-         currying, partial-application of functions

lambda calculus
f(x,y) = x + y
f(x,y,op) = x (op) y

add (x, y) = x + y
inc = add 1                          (returns first class value function that takes one value)

Function that takes more than 2 parameters are too long – compare to Bob J

Currying à Pipelining
Val convertToInt = { x:String => x.toInt }
Val doubleIt = { x:Int => x * 2 }
Val sqrtIt = { x:Double => Mat.sqrt(x) }
Val pipeline = convertToInt andThen doubleIt andThen int2double andThen sqrtIt


RUN:
Scalac person.scala
Java –classpath ;. App
Javap Person                       (Shows java-code)

object App {



Using eclipse? ScalaIDE, http://www.scala-ide.org/
Unit testing? Yepp, but maybe Java TDD? Make unit testing first compile scala? Would be cool to integrate!
Using from Java?

Problems


lift framework

Tomorrow: Go to Java Bytecode!!!

Anything is better than java.
Why use scala: Unless you want to write tomorrows legacy code today.

Inga kommentarer: