Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Better Than X
1. Better than X
Happstack: The framework
formerly known as HAppS
Presented February 10th, 2009
Thomas Hartman and Matthew Elder
4760 Boelter Hall, UCLA campus
2. A brief history of HAppS
• Big Bang 2005
• Alex Jacobson
markets aggressively
• Interest starts to wane
in 2007
* For more information see http://www.reddit.com/r/haskell/comments/7ug41/mathew_elder_joins_patchtagcom_as_a_partner_the/c07frjk
3. A Lonely 2008 for HAppS
• Few commits
• Low mailing list traffic
• Hard to get help on
IRC
• Happstutorial
released
4. Happstack Announced
• In 2009 Matthew Elder decides to rebrand
HAppS as “Happstack”
• It turns out a lot of people want to work on
HAppS
• Matthew Elder joins Patch-Tag as a
partner
6. How does it work?
• Happstack has a builtin HTTP Server
• Templating system agnostic (common
choices are HSP and HStringTemplate)
• State is serialized to disk for durability (like
MySQL)
• Entire state is kept in ram for maximum
performance (no memcached needed)*
* This was inspired by Prevayler For more information see http://www.prevayler.org
7. Why bother
When we have:
• Rails
• Django
• Zope
• Catalyst
• (…)?
8. Haskell is better than Ruby
The Ruby claim to fame? terse and beautiful code
quicksort in Ruby
def quicksort(list)
return list if list.size <= 1
pivot = list.pop
left, right = list.partition { |e| e < pivot }
quicksort(left) + [pivot] + quicksort(right)
end
quicksort in Haskell
qsort [] = []
qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ qsort (filter (>= x) xs)
Haskell Wins.
9. Happstack is better than Rails
Model
Rails Happstack
Object-Relational No ORM needed, Native
Impedance Mismatch datatypes via MACID
Error-prone database Typesafe migration
migration strategy strategy via MACID
Database queries scale In-memory map lookups
pretty good scale awesomely
10. Happstack is better than Rails
View
Rails Happstack
ERB allows mixing HStringTemplate
presentation and enforces separation of
business logic Controller / View
ERB does not prevent HSP guarantees well-
malformed xml output formed XML
11. Happstack is better than Rails
Controller
Rails Happstack
Scaffolding creates a Composable Server
huge mess of Parts keep things simple
unmaintainable code
Routing logic is Routing logic is
unnecessarily magic straightforward
12. Haskell is better than Ruby/Rails
BUT . . .
Ruby programmers have jobs!
Clicks Per Day:
• Ruby: 1613
• Haskell: 69
• HAppS: Not enough data to give estimates
• Source: Google Adwords Estimator
Ruby Wins.
13. Haskell programmers need jobs!
• Some Day . . .
• Soon . . .
• Haskell Devs will be
paid for developing
webapps in Haskell
• Instead of doing
ruby/java/.net by day
and Haskell by night
14. Rails Envy? Not us!
Clicks Per Day:
• Ruby: 1613
• Haskell: 69
• HAppS: Not enough data to give estimates
• PHP: 8672
The real nemesis of Happstack is PHP.
15. The End?
• Happstack may not really be better than
everything, but we try.
• Patch-Tag and happstutorial are proof that
Happstack is usable today.
• Visit the website: happstack.com
• Join us on #happs on irc.freenode.net
• OR http://groups.google.com/group/HAppS