35 ⻚页(共 45 ⻚页) http://abdullin.com/long/happypancake/#toc_0 In the longer term I hope to convert these tests to self-documenting expectations (like I did in my previous .NET projects). Ability to have up-to-date documentation of the code that is expressed in human-readable language can be a powerful thing for keeping project stake- holders involved in the project. This means better feedback and faster iterations. Code looks like this in golang: func (x *context) Test_given_nancy_flirts_bob_when_GET_bobs_alerts(c *C) { s := run_nancy_flirts_bob(x) r := x.GetJson(s.bobId, "/alerts") c.Assert(r.Code, Equals, http.StatusOK) var m model r.Unmarhal(&m) c.Check(m.Title, Equals, "Alerts") c.Check(m.HasMore, Equals, false) c.Assert(m.Items, HasLen, 1) i1 := m.Items[0] c.Check(i1.Member.Nickname, Equals, "nancy") c.Check(i1.Unread, Equals, true) c.Check(i1.Member.IsOnline, Equals, true) // since we have allOnline c.Check(x.Service.AnyUnread(s.bobId), Equals, false) } where nancy flirts bob scenario is a simple code setting up preconditions on the system: func run_nancy_flirts_bob(x *context) (info *nancy_flirts_bob) { info = &nancy_flirts_bob{hpc.NewId(), hpc.NewId()} x.Dispatch(hpc.NewRegistrationApproved( hpc.NewId(), info.bobId, "bob", hpc.Male, hpc.NewBirthday(time.Now().AddDate(-23, 0, 0)), "email", hpc.NoPortraitMale)) x.Dispatch(hpc.NewRegistrationApproved( hpc.NewId(), info.nancyId, "nancy", hpc.Female, hpc.NewBirthday(time.Now().AddDate(-22, 0, 0)), "email", hpc.NoPortraitFemale)) x.Dispatch(&hpc.FlirtSent{hpc.NewId(), info.nancyId, info.bobId}) return } The Truth is Born in Argument I can’t be grateful enough to Pieter who has enough patience to go with me through the design discussions in cases when we disagree about something. Talking things through with him is one of the reasons why our design stays simple, clear and capable of future evolution. Design Game A lot of our work resembles some sort of puzzle, where we have to do 3 things: find names and words that let us communicate better (we are a distributed team from different countries); discover ways to break down large problem into small coherent parts (team is too small to be able to tackle huge problems); decide on optimal order in which these parts could be handled (our time is limited and has to be applied to the areas where it will make the biggest impact for the project).