Why oo

70 %
30 %
Information about Why oo

Published on June 3, 2013

Author: valtechsweden

Source: slideshare.net


Varför kodar vi objektorienterat när funktionell programmering lämpar sig så mycket bättre för webben?
Av Jimmy Larsosn, Valtech AB

Varför  objektorienterar  viegentligen?Jimmy  Larsson  -­  @jimlar

Web  sites  are  not  aboutobjects!

Jimmy  LarssonValtechie  since  2007Coding  my  way  through  the  last  28  years  or  soASM,  C,  C++,  Pascal,  Scheme,  Perl,  Java,  Ruby,  Python,Scala,  Clojure,  JavascriptArchitecture····

History  made  us  do  it

Abstracting  ComputationAlonzo  Church-­  Lamda  calculusAlan  Turing-­  Turing  machine

EngineersJohn  McCarthy-­  LISPJohn  von  Neumann-­  Von  Neumann  Architecture

YouarehereComputationLambda  CalculusLISPTuring  MachineAssemblerCOOLISP  Machines©  Jessica  Kerr  -­  http://blog.jessitron.com/

Functional  Programming

What  is  it?f(x)  =  yData  transformation(range  3)  =>  [0  1  2](map  inc  [0  1  2])  =>  [1  2  3]find  .  -­name  *.txt  |  xargs  cat  |  grep  ERROR  |  sort  |  uniq  -­c··

The  Web  Application****   COMMODORE   64   BASIC   V2   ****64K   RAM   SYSTEM   38911   BASIC   BYTES   FREEREADY.10   LOAD   "“”DATA"“”20   TRANSFORM   "“”DATA"“”30   IF   X="“”DONE"“”   THEN   50:   END40   GOTO   1050   SAVE   "“”DATA"“”60   OUTPUT   "“”HTML"“”

The  Code

Loading  RDBMS  data(def  db  "postgresql://localhost:5432/food")(query  db        (select  *  :products  (order-­by  :name)))=>  [{:id  "basil"  :name  "Basil"}  {:id  "cucumber"  :name  "Cucumber"}]

Integration  with  an  HTTP  API(def  url  "http://api.medveten-­mat.se/stock")(-­>  url  slurp  json/parse-­string)=>  {"basil"  15  "cucumber"  3  ...}                

A  Word  On  Testability

Creating  HTML(deftemplate  product-­template  "product.html"  [name  stock]        [:p#name]  name        [:p#stock]  stock)(product-­template  "Tomato"  7)                <html  xmlns="http://www.w3.org/1999/xhtml">        <head>                <title>Medveten  Mat</title>        </head>        <body>                <p  id="name">Cucumber</p>                <p  id="stock">15  in  stock</p>        </body></html>                

Full  application(def  db  "postgresql://localhost:5432/food")(def  url  "http://api.medveten-­mat.se/stock")(defn  stock  [id]        (get  (-­>  url  slurp  json/parse-­string)  id))(deftemplate  product-­template  "product.html"  [name  stock]        [:p#name]  name        [:p#stock]  stock)(defn  product-­page  [id]        (query  db              (select  *  :product  (where  {:id  id}))              :row-­fn  #(product-­template  (:name  %)  (stock  id))))(defroutes  app        (GET  "/products/:id"  [id]  (product-­page  id))        (not-­found  (render-­404)))

Tests(fact  "parse-­line  gives  empty  hash  map  on  bad  line"        (parse-­line  "")  =>  {}        (parse-­line  "  ")  =>  {}        (parse-­line  "  put")  =>  {}        (parse-­line  "n")  =>  {})                

Leonardo  Fibonacci

Add a comment

Related pages


Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
Read more

Why Oo | Facebook

Why Oo is on Facebook. Join Facebook to connect with Why Oo and others you may know. Facebook gives people the power to share and makes the world more...
Read more

About O&O

That is why 76% of the companies listed in DAX use O&O products, as well as 43% of those companies listed in the “Forbes 100 International”.
Read more

Why use ABAP OO with Workflow? | SCN

This is the start of a series on how to use ABAP OO with workflow. How do I know this is relevant to me? ABAP OO for workflow is available on ...
Read more

Why I Love U So Sammy Oo - YouTube

Why I Love U So Sammy Oo Sammy Oo. Subscribe Subscribed Unsubscribe 3 3. Loading ... by Sammy Oo (radio mix) - Duration: 3:35. Sammy Oo 79 views ...
Read more


OO.com - Shopping Any Other Way is Pointless. Learn more about the team behind OO.com at our blog! GIVE. Opportunities. GET. Great Brands.
Read more

Apache OpenOffice - Official Site - The Free and Open ...

The official home page of the Apache OpenOffice open source project, home of OpenOffice Writer, Calc, Impress, Draw and Base.
Read more

Why Apache OpenOffice

Why Apache OpenOffice Why should I use Apache OpenOffice?¶ Apache OpenOffice is the leading open-source office software suite for word processing ...
Read more

O&O Software GmbH – Creating Solutions for Windows™

O&O Software develops award-winning windows software for PC-optimization, data imaging, backup, secure data deletion, data recovery and administration.
Read more