Functional Architecture - goto copenhagen 2012
Upcoming SlideShare
Loading in...5

Functional Architecture - goto copenhagen 2012



Functional Architecture presentation on the Software Architecture track at goto conference in Copenhagen 2012.

Functional Architecture presentation on the Software Architecture track at goto conference in Copenhagen 2012.



Total Views
Views on SlideShare
Embed Views



6 Embeds 1,043 606 409 25
http://56tsh20135 1 1 1



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment
  • I work as a hands-on Software Architect AND Developer at Trayport.I work with the project team on the code on a day-to-day basis.
  • Wrote first commercial game when I was 13, nearly 30 years ago which makes me just over 27 ;)Characterized by functional concepts.Video games: state machines & DSLs, transformation, math, proceduralE-Commerce: immutable messages & commands (audit trail – no deletion)Machine Learning: computationTrading: immutable messages, computation, concurrency
  • C is assemblerC++ was initially called C with ClassesJava/C# = C with Classes + GC
  • 1980s/1990s Games written in C interpreters & custom DSLs with coroutines, engines written in Assembler including C2000s/2010s Games written in Lua & custom DSLs, engines written in C & C++
  • See: sample:
  • See: sample:
  • Runtime: 80/20 rule – performance of most code is not importantDevelopment: time to market is importantPsygnosis offered to pay: 25,000GBP to convert a video game in 6 months 75,000GBP to convert a video game in 3 months
  • Lightweight types with correct defaultsImmutabilityCompositionSeparation of concernsLightweight functions with correct defaultsIdempotentTestableType signatures
  • Map: (‘T -> ‘U) -> ‘T -> ‘U
  • Samples:Units in CellzLunar Landurz
  • Putting it all together:
  • Intellisense via the dot gives discoverabilityMakes it easy to explore an APIWorld bank sample

Functional Architecture - goto copenhagen 2012 Functional Architecture - goto copenhagen 2012 Presentation Transcript

  • FUNCTIONAL ARCHITECTURE Phillip Trelford Trayport
  • About MeFamily Values Retail Halo 3 Trade
  • Programming LanguagesAssemblers C with Classes Functional• 6502 • C++ • JavaScript• Z80 • Java • F#• 680x0 • C# • Lua• 80x86• 65c816• SH-2• R3000•C
  • Video Game Decades1980s/1990s 2000s/2010s Scripts Scripts C with Assemblers Classes
  • Coroutine ZombiesPseudo Coderandom_pause 10while not dead wait_until_in_range 50.0 home_in_on_target 10
  • Coroutine ZombiesPseudo Code F#random_pause 10 yield! random_pause 10while not dead while true do wait_until_in_range 50.0 yield! wait_range 50 home_in_on_target 10 yield! home_in 10
  • SpeedRuntime DevelopmentSuper Nintendo DSL• Interprets byte code • Close to domain• On 3.58MHz CPU • Easy to port• At 60FPS • Zero compile time
  • FP Sweet Spots DomainComputation Concurrency
  • Thoughtworks Tech Radar 2012F# Languages“F# is excellent at concisely expressing business and domain logic.”
  • TypesF# UML Class Diagramtype Object(name) = member this.Name = nametype Action = | Call of Object * string *Object | Async of Object * string *Object
  • FunctionsImply : Instrument[] -> Order[] -> Order[]
  • Computation
  • Concurrencyasync { do! control.MouseLeftButtonDown |> Async.AwaitEvent}
  • Joule Trading screen
  • Thoughtworks Tech Radar 2012“Developers trying to achieve explicit business logic within an application may opt to express their domain in F# with the majority of plumbing code in C#.”
  • ApplicationsErlang for Fault Tolerant Messaging• Messaging in Chat, Gaming, Messaging, NoSQL• Facebook, MMOG, RabbitMQ, Amazon, …F#/Scala• Computation in Insurance, Finance, Gaming• Credit Suisse, Jane Street, TrueSkill, Path of Go, …C#/Java/PHP/Python/Ruby…• CRUD in Line of Business Applications• Everything else
  • Classesreference.Member(argument, …)Member(reference, argument, …)
  • Dot Driven Development
  • ButtonsMethods 63Properties 63Events 35Constructors 1Total Members 162
  • XBLA: Path to Go – F# AI
  • Q&A• Twitter: @ptrelford• Email: phil at• Blog: