tisdag 14 december 2010

PHPUnit på windows

Installera phpunit på windows

  1. Ta hem php-zip
  2. Packa upp
  3. Rename:a php.ini-development till php.ini
  4. Enabla curl, ta bort ; i php.ini framför extension=php_curl.dll
  5. Editera "Paths and directories" i php.ini
  6. Kör go-pear.bat under php-home
    pear config-set http_proxy 143.237.88.22:8080
    pear channel-discover pear.phpunit.de
    pear channel-discover pear.symfony-project.com
    pear channel-discover pear channel-discover components.ez.no
    
    
    pear install --alldeps phpunit/PHPUnit
    
    1. Om du får
      phpunit/PHPUnit requires PEAR Installer (version >= 1.9.2), installed version is 1.9.0 
      så kör
    2. pear install PEAR-1.9.2
    3. försök sen igen
  7. Nu finns phpunit.bat under php
  8. Du måste eventuellt lägga till pear till include_path i php.ini
    include_path = ".;c:\bin\php\includes;c:\bin\php\pear"
See http://www.keithlawless.com/?p=128 för info om att köra phpunit ifrån eclipse

måndag 13 december 2010

Eclipse - problem

Eclipse har slutat funka efter att jag lagt till PDT verkar det som. Hittade en blog http://www.eclipsezone.com/eclipse/forums/t61566.html som beskrev hur man kunde rensa upp. Tyvärr räckte inte det. Fick till slut installera om eclipse. Men det funkade inte det heller. Så det blev till att ge upp mitt gamla workspace helt, men fick åtminstone behålla mina inställningar tack vare bloggen ovan.

måndag 22 november 2010

Agila workshopövningar

Länkar till övningar som används för att illustrera agila principer:

http://tastycupcakes.com/

http://www.agilecoach.net/

torsdag 11 november 2010

JavaScript Resources

jQuery: http://api.jquery.com/

DOM: https://developer.mozilla.org/en/DOM

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.

måndag 8 november 2010

söndag 7 november 2010

Planering

Det här är en sida om varför och hur man planerar.

Först ut: En sammanfattande video efter maildiskussion på Agile Sweden som kommer fram till att planera gör man i första hand för att bygga lagkänsla och man gör det så enkelt som möjligt.

http://www.youtube.com/watch?v=7JrJL7hHDmI

fredag 8 oktober 2010

java-ee-spike-kata

Johannes Brodwall har bloggat om en java-ee-spike-kata:
http://johannesbrodwall.com/2010/05/02/six-ideas-that-improve-your-software-design/

Hela java-ee-spike-kata i "obruten form" finns här: http://jhannes.blip.tv/file/3487566/

Tips:

  •  pom:en behövs för att komma igång (från github, länk ovan), importera i eclipse och sätt igång.
  • log4j.properties under test/resources behövs för att få ut exceptions från jetty m.fl.
  • Ha org.mockito.Mockito, org.fest.assertions.Assertions som Type favorite i eclipse, se Preferences->Java->Editor->Content assist->Favorites->New Type.


log4j.rootLogger=warn, A


log4j.appender.A=org.apache.log4j.ConsoleAppender
log4j.appender.A.layout=org.apache.log4j.PatternLayout
log4j.appender.A.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

tisdag 4 maj 2010

Agila länkar

Har lite svårt att hitta något bra sätt att komma ihåg olika länkar som kan vara kul att återkomma till, så det får bli såhär tills vidare:

Om AI Retrospective: Always look at the bright side of life...
http://ellnestam.wordpress.com/2009/11/12/an-ai-retrospective/

fredag 9 april 2010

fredag 19 mars 2010

TDD Beyond Basics dag 2

5 minute rule for arguments, longer argument than that then let go à doesn’t matter!

Även denna dag började varje pass med teorier som
  • Maxwells theory – all is waves
  • Galileo - Speed is relavite to any frame of reference
  • Equivalence principle
  • Einsteins General relativity

Katas

TDD

Unit Tests must comply with FIRST:

FIRST

Fast
Isolated (Independent)
Repeatable
Self verifying
Timely

Fast

Tests need to be fast to be run.
Do not use production data, it contains too much clutter. Construct your data!
Discussion on Golden Copy vs Approval Testing.

Isolated

One fault should make only one test fail

Repeatable

Able to run anywhere repeatably with same result; plain, train, work, home, etc.

Self Verifying

Pass or Fail! Nothing in between or demanding human intervention (like reading logfiles)

Timely

Written first. The test is the specification.
1 code change = 1 test

Given when then

What about METHOD_WHEN_THEN, for a stack the test methods could be:
Push_empty_sizeIsOne
Pop_empty_throwUnderFlow
Push_full_throwOverFlow
Pop_sizeone_empty

Principles

#1                  Don’t test private or protected methods.
#2                  Testing trumps privacy
·        Make private methods package protected
·        Or extract into own class
#3                  Testing privates implies a design error

Put tests in same package

Preferably in same directory, but deploying without tests is tricky.

Fragile tests

xUnit Patterns à The fragile test “problem”

Interface Sensivity

Do not depend directly on UI-components
Open/Closed Principle (Bertrand Meyer), a class should be open for extension but closed for modification.
The best anticipation of change is change that already happened.

Behaviour Sensitivity

Avoid complex setup and tardown scenarios
Access the tested feature as directly as possibly

Data Sensitivity

Failure because of changed test data. Control your test data!

Context Sensitivity

-         Data/time
-         Available Memory
-         Network Services
-         Hardware
Mock out context dependencies. Mock out clock!

Overspecification

Failure because of change in system test should not care about. (The scope of test is too wide).

Sensitive Equality

Failure caused by an over-constrained comparison
-         Floating point, whitespace
-         Avoid it! J

Preserving tests

FIRST!
Failures are “stop the presses” events. Keep test code clean!

FitNesse

Put fixtures in same project as code under test. Test your fixtures.

Put under source control!

Check in all txt and xml-files under FitNesseRoot.

Same tests, different setup

Use symbolic links
Product
  Test One
  Test two
Dev
  Setup
  Symlink à Product
Prod
  Setup
  Symlink à Product

Special pages

PageHeader   Siblings gets page header
Setup            
TearDown

Variables

!define NAME {BOB}
The variable NAME is ${NAME}
Can define java definition and environment variables as well.

Old style (ColumnFixture)

  • Should be several small tests
  • States what to do, not what to test

New style

Misc

måndag 15 mars 2010

Kurs: TDD Beyond Basics med Uncle Bob

Måndag
Kursen startade lustigt nog med att Bob gick igenom grunderna för partikelfysik, foton, boson, fermions, etc. Började sedan varje delpass med mer partikelfysik. Ett intressant grepp som det ska bli kul att se poängen på.

Resistance and professionals

Vi gick sen igenom vilka problem som TDD-utövare kunde stöta på. Bob angrep passionerat ”organisational resistance”:
As programmers we are professionals. Like doctors, architecs we must ignore organisational pressure. Pressure is put on us for a good reason; to see if we really believe what we are saying. As professionals we know the best way to write code, noone else can tell us that. And as professionals we now the best way is to do test first.
As professionals we also do not want to deliver crap, we want to be proud. And we know that to be fast we need high quality. You are more likely to clean tested code!

Pairing

Bobs råd var att paira ca 50% av tiden, bump it up. Code review kan inte ersätta pairing när det gäller kodkvalitet, men är ett bra komplement för att lära ut sunda principer. Se dock till att det sker på ett sätt där alla är engagerade.

TDD basics


Några lösryckta yttranden som fastnade:
  • 30 seconds cycle time usually, about 1 hour when doing UI.
  • Tidsvinst: Less debug time
  • Trust in the test suite is essential à true maintainability
  • Code coverage bör ligga över 90%, helst 100%! (Vi gjorde ett antal övningar där målet var att nå 100%).
  • To be testable means modularized, able to isolate behaviour which leads to good design.
  • About 33% of code is usually tests, i.e. a 2:1 ratio between production code and tests.
  • I want to be proud of my code

Test Driven Documentation

TDD can stand for
  • Test Driven Development
  • Test Driven Design
  • Test Driven Documentation
“My documentation is formal, it compiles! How about your documentation?”

TDD – några regler

Do one thing

Varje metod/funktion ska bara göra en sak. Det har man uppnått ”when you cannot extract a method à extract till you drop”.
A method that does one thing is testable with one logical assert

Test one thing

Use one logical assert (notice the circular tendency to Do one thing).

Clean test – några mönster

Composed Assert
Composed test result

TDD och GUI

GUI-tests are fragile! Test “under” the GUI, to be continued…

Övningar dag 1

  • HuntTheWumpus. Bump up to 100%. Introduktion med syfte att visa hur enkelt det är att förstå välskriven kod.
  • Environmentalcontroller. Bump up to 100%. What’s good, what’s bad? Många intressanta diskussioner om felaktigheter.
  • Coding DOJO: word wrap. På en timme hann vi tre test J http://codingdojo.org/cgi-bin/wiki.pl?WhatIsCodingDojo

Verktyg

Git, msysgit för windows, http://code.google.com/p/msysgit/
git clone git://github.com/unclebob/HTW.git
git clone git://github.com/unclebob/fitnesse.git
git clone git://github.com/unclebob/environmentcontroller.git

tisdag 16 februari 2010