SlideShare a Scribd company logo
1 of 24
Download to read offline
Scala in Goozy

         Alexey Zlobin
         E-Legion
Index

1. Goozy overview
2. Scala's place
3. Lift
4. Cake pattern in scale
5. Scalaz and other fancy stuff
6. Summary
What is Goozy?
A social network built around
the concept of sticky note

 ● A note could be left
   anywhere in the Web.
 ● It is associated with
   particular page element.

Central UI concept: user's
related feed with all new notes
and comments
Top-level architecture
Scala's place

API server

Main functions:
 ● Storage access
 ● Background tasks (feed writing, e-mails)
 ● Email sending
 ● Text indexing
Why scala?

● Fast
● Сoncise
● Expressive
● Advanced OO
● Some functional stuff
   ○ Simple concurrency
● All Java legacy
  available
The team

● 2 persons
● Strong Java background
● Fancy about technologies
● Love to try new things
Lift
       Utilized features:
        ● REST
        ● JSON serialisation

       That's it...
Lift: issues
Localisation performance
 ● Hand-made localisation on standard resource bundles
   gave 4 times throughput improvement.

Very memory-consuming JSON serialisation.
 ● Not so efficient PrettyPrinter is used
 ● Functional-styled string escaping

Poor code style
 ● Extremely long map-match-if hierarchies
 ● Mutable, difficult to debug LiftRules design
Lift: shift from

Some plans about             But we have a strong
migration to less            dependency from Boot
sophisticated framework...   and configuration

Ideally small and simple     And there is some aspect-
enough to be completely      like hooks on HTTP
rewritten in case of any     processing, which are
issue.                       unportable.
Goozy API logical structure

Application is composed
from three layers.

Each layer consists from
several similar
components. Like
UserStorage,
GroupStorage, etc.
Conceptual problems

● Components of each level depend from each other
● Components most likely have several dependencies
  from the previous level
● A lot of common stuff inside a level
    ○ Every storage needs a DB connection
    ○ Every service needs an entire storage system and
      access to text indexes
    ○ Etc...
The solution: cake pattern
● Each logically closed piece
  of functionality is
  represented as component
● Dependencies are
  expressed as self-type
● Common features expressed
  as mix-ins
● Common combinations of
  functionality are expressed
  as mix-ins of several
  components
Cake pattern: consequences
+ All top-level architecture   - Long dependency lists
is expressed in one less         ● Poor design?
than 100 LOC file
                               - Implicit dependency on mix-
+ Compile-time                 in order (linearisation strikes
dependency checks              back)
                                 ● Prefer def and lazy
+ The biggest file is
around 1000 LOC                - A bit unclear how to deal
                               with several dependencies of
                               the same type but different
                               runtime implementation
scalaz.Validation
                    One sweet morning I sent a
                    link to the colleague...

                    On the next morning we had
                    a new dependency and
                    totally refactored request
                    parameters analysis.

                    Now everything is validated.
Validation: pros and cons
+ Comprehensible error      - Monads and Applicatives
aggregation and reporting   cause massive brain
                            damage
+ The only imaginable way
to deal with 20+ request    - Complicated error reports
parameters with 2-3         from the compiler
constraints on each
                            - You can't just ignore
+ Unified approach to       possibility of runtime
request validation and      exception
runtime error handling

+ Type-level check for
correct error handling
Validations and exceptions
Problem: exceptions are here




Solution: catch'em and convert!
Error handling: big picture
Lessons

1. Always prefer simple tools
2. Options and Eithers (Validations): they really work
    ○ It is possible to live with both exceptions and eithers
    ○ Performance consequences are not clear
    ○ Some times I had to use things far behind my
      understanding (sequence, traverse)
3. Server-side testing is difficult
    ○ Testing approach should be established before any code
      is written
References

1. http://www.assembla.
   com/spaces/liftweb/wiki/REST_Web_Services - REST
   support in Lift
2. http://jonasboner.com/2008/10/06/real-world-scala-
   dependency-injection-di.html - complete cake pattern intro
3. https://gist.github.com/970717 - easy Validation example
Testing

A lot of features

Very quickly evolved at the beginning

We needed to exclude possibility of regression
Testing: solution

● Integration testing from the client point of view
● All test deal only with the http interface
● Every case is a short (5-10 reqs.) scenario
● Every case is wrapped into JUnit test for convenience
Testing: logical architecture

1. JUnit wrapper
2. Scenario
3. Library of available
   operation on http interface
4. Groovy's HTTPBuilder
Integration testing: problems

Groovy
 1. Dynamic typing
 2. Not obvious ways to do simple things
 3. One extra language in project

Execution time

More Related Content

What's hot

Use notes objects in memory and other useful java tips for xpages development
Use notes objects in memory and other useful java tips for xpages developmentUse notes objects in memory and other useful java tips for xpages development
Use notes objects in memory and other useful java tips for xpages developmentFrank van der Linden
 
Consume wsa
Consume wsaConsume wsa
Consume wsamahe797
 
Async Scope With Mule ESB
Async Scope With Mule ESBAsync Scope With Mule ESB
Async Scope With Mule ESBJitendra Bafna
 
From monolith web app to micro-frontends
From monolith web app to micro-frontendsFrom monolith web app to micro-frontends
From monolith web app to micro-frontendsRustam Aliyev
 
Kharkiv JS 2015 - Creating isomorphic applications in React (en)
Kharkiv JS  2015 - Creating isomorphic applications in React (en)Kharkiv JS  2015 - Creating isomorphic applications in React (en)
Kharkiv JS 2015 - Creating isomorphic applications in React (en)Viktor Turskyi
 
Before you jump into Angular
Before you jump into AngularBefore you jump into Angular
Before you jump into AngularM A Hossain Tonu
 
JavaScript Comprehensive Overview
JavaScript Comprehensive OverviewJavaScript Comprehensive Overview
JavaScript Comprehensive OverviewMohamed Loey
 
Quartz connector mule
Quartz connector   muleQuartz connector   mule
Quartz connector muleSindhu VL
 
Introduction to Reactjs
Introduction to ReactjsIntroduction to Reactjs
Introduction to ReactjsNodeXperts
 
.Net framework
.Net framework.Net framework
.Net frameworkteach4uin
 
Architecture diagram of jvm
Architecture diagram of jvmArchitecture diagram of jvm
Architecture diagram of jvmhome
 
Introduction to Robot Framework (external)
Introduction to Robot Framework (external)Introduction to Robot Framework (external)
Introduction to Robot Framework (external)Zhe Li
 

What's hot (18)

Use notes objects in memory and other useful java tips for xpages development
Use notes objects in memory and other useful java tips for xpages developmentUse notes objects in memory and other useful java tips for xpages development
Use notes objects in memory and other useful java tips for xpages development
 
Consume wsa
Consume wsaConsume wsa
Consume wsa
 
jQuery (intermediate)
jQuery (intermediate)jQuery (intermediate)
jQuery (intermediate)
 
Async Scope With Mule ESB
Async Scope With Mule ESBAsync Scope With Mule ESB
Async Scope With Mule ESB
 
From monolith web app to micro-frontends
From monolith web app to micro-frontendsFrom monolith web app to micro-frontends
From monolith web app to micro-frontends
 
Kharkiv JS 2015 - Creating isomorphic applications in React (en)
Kharkiv JS  2015 - Creating isomorphic applications in React (en)Kharkiv JS  2015 - Creating isomorphic applications in React (en)
Kharkiv JS 2015 - Creating isomorphic applications in React (en)
 
Before you jump into Angular
Before you jump into AngularBefore you jump into Angular
Before you jump into Angular
 
JavaScript Comprehensive Overview
JavaScript Comprehensive OverviewJavaScript Comprehensive Overview
JavaScript Comprehensive Overview
 
Quartz connector mule
Quartz connector   muleQuartz connector   mule
Quartz connector mule
 
Introduction to Reactjs
Introduction to ReactjsIntroduction to Reactjs
Introduction to Reactjs
 
Flow
FlowFlow
Flow
 
Scripting robot
Scripting robotScripting robot
Scripting robot
 
Day 8 - jRuby
Day 8 - jRubyDay 8 - jRuby
Day 8 - jRuby
 
.Net framework
.Net framework.Net framework
.Net framework
 
Architecture diagram of jvm
Architecture diagram of jvmArchitecture diagram of jvm
Architecture diagram of jvm
 
Introduction to Robot Framework (external)
Introduction to Robot Framework (external)Introduction to Robot Framework (external)
Introduction to Robot Framework (external)
 
Mule quartz
Mule quartz Mule quartz
Mule quartz
 
Quartz in Mule
Quartz in MuleQuartz in Mule
Quartz in Mule
 

Viewers also liked

Actividad 2
Actividad 2Actividad 2
Actividad 2acidmau
 
Totus subidus
Totus subidusTotus subidus
Totus subiduskarmele
 
Présentation ubib
Présentation ubibPrésentation ubib
Présentation ubibscduag
 
Gruppo Hera - Relazione trimestrale al 30 settembre 2012
Gruppo Hera - Relazione trimestrale al 30 settembre 2012Gruppo Hera - Relazione trimestrale al 30 settembre 2012
Gruppo Hera - Relazione trimestrale al 30 settembre 2012Hera Group
 
Proyecto emprendedores 2014
Proyecto emprendedores 2014Proyecto emprendedores 2014
Proyecto emprendedores 2014Isha Mtz
 
Beckham david
Beckham davidBeckham david
Beckham davideflcafe
 
деловой велосипед 2014
деловой велосипед 2014деловой велосипед 2014
деловой велосипед 2014Pashka Gorbunov
 
Carancho Albino[1]
Carancho Albino[1]Carancho Albino[1]
Carancho Albino[1]vergaramax
 
El Teatro Isabelino
El Teatro IsabelinoEl Teatro Isabelino
El Teatro Isabelinoguestfc4e36
 
Sortie a saigon v2
Sortie a saigon v2Sortie a saigon v2
Sortie a saigon v2lfiduras
 
Manos Pintadas R
Manos Pintadas RManos Pintadas R
Manos Pintadas RJorge Llosa
 
Perioada "preweb" e-mail si icq
Perioada "preweb" e-mail si icqPerioada "preweb" e-mail si icq
Perioada "preweb" e-mail si icqKristeen Bumbac
 
Dn13 u3 a26_lswa
Dn13 u3 a26_lswaDn13 u3 a26_lswa
Dn13 u3 a26_lswawendatgo
 
Saga Crespúsculo
Saga CrespúsculoSaga Crespúsculo
Saga Crespúsculoguest5e4d0b
 
Правительство Ростовской области
Правительство Ростовской областиПравительство Ростовской области
Правительство Ростовской областиBabenchuk
 
Space project.
Space project. Space project.
Space project. joh0073
 
A nossa estatística (2)
A nossa estatística (2)A nossa estatística (2)
A nossa estatística (2)Sasuke Sakura
 

Viewers also liked (20)

Actividad 2
Actividad 2Actividad 2
Actividad 2
 
Totus subidus
Totus subidusTotus subidus
Totus subidus
 
Présentation ubib
Présentation ubibPrésentation ubib
Présentation ubib
 
Gruppo Hera - Relazione trimestrale al 30 settembre 2012
Gruppo Hera - Relazione trimestrale al 30 settembre 2012Gruppo Hera - Relazione trimestrale al 30 settembre 2012
Gruppo Hera - Relazione trimestrale al 30 settembre 2012
 
Proyecto emprendedores 2014
Proyecto emprendedores 2014Proyecto emprendedores 2014
Proyecto emprendedores 2014
 
Beckham david
Beckham davidBeckham david
Beckham david
 
деловой велосипед 2014
деловой велосипед 2014деловой велосипед 2014
деловой велосипед 2014
 
Carancho Albino[1]
Carancho Albino[1]Carancho Albino[1]
Carancho Albino[1]
 
El Teatro Isabelino
El Teatro IsabelinoEl Teatro Isabelino
El Teatro Isabelino
 
Sortie a saigon v2
Sortie a saigon v2Sortie a saigon v2
Sortie a saigon v2
 
Manos Pintadas R
Manos Pintadas RManos Pintadas R
Manos Pintadas R
 
Perioada "preweb" e-mail si icq
Perioada "preweb" e-mail si icqPerioada "preweb" e-mail si icq
Perioada "preweb" e-mail si icq
 
Buenas dias escuela
Buenas dias escuelaBuenas dias escuela
Buenas dias escuela
 
Dn13 u3 a26_lswa
Dn13 u3 a26_lswaDn13 u3 a26_lswa
Dn13 u3 a26_lswa
 
Saga Crespúsculo
Saga CrespúsculoSaga Crespúsculo
Saga Crespúsculo
 
Правительство Ростовской области
Правительство Ростовской областиПравительство Ростовской области
Правительство Ростовской области
 
Space project.
Space project. Space project.
Space project.
 
License
LicenseLicense
License
 
Capstone
CapstoneCapstone
Capstone
 
A nossa estatística (2)
A nossa estatística (2)A nossa estatística (2)
A nossa estatística (2)
 

Similar to Алексей Злобин «Scala in Goozy»

Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - TalkMatthias Noback
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN StackRob Davarnia
 
DevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 SlidesDevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 SlidesAlex Cruise
 
Headless cms architecture
Headless cms architectureHeadless cms architecture
Headless cms architectureKevin Wenger
 
Real World Single Page App - A Knockout Case Study
Real World Single Page App - A Knockout Case StudyReal World Single Page App - A Knockout Case Study
Real World Single Page App - A Knockout Case Studyhousecor
 
SOA with PHP and Symfony
SOA with PHP and SymfonySOA with PHP and Symfony
SOA with PHP and SymfonyMichalSchroeder
 
React - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesReact - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesJumping Bean
 
AngularJS in Production (CTO Forum)
AngularJS in Production (CTO Forum)AngularJS in Production (CTO Forum)
AngularJS in Production (CTO Forum)Alex Ross
 
apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...
apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...
apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...apidays
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQLKonstantin Gredeskoul
 
Daniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého SchizmaDaniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého SchizmaDevelcz
 
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling StoryPHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Storyvanphp
 
Fighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless phpFighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless phpFabio Pellegrini
 

Similar to Алексей Злобин «Scala in Goozy» (20)

Full stack development
Full stack developmentFull stack development
Full stack development
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - Talk
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
DevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 SlidesDevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 Slides
 
Headless cms architecture
Headless cms architectureHeadless cms architecture
Headless cms architecture
 
stigbot_beta
stigbot_betastigbot_beta
stigbot_beta
 
Real World Single Page App - A Knockout Case Study
Real World Single Page App - A Knockout Case StudyReal World Single Page App - A Knockout Case Study
Real World Single Page App - A Knockout Case Study
 
SOA with PHP and Symfony
SOA with PHP and SymfonySOA with PHP and Symfony
SOA with PHP and Symfony
 
React.js at Cortex
React.js at CortexReact.js at Cortex
React.js at Cortex
 
Node.js Course 2 of 2 - Advanced techniques
Node.js Course 2 of 2 - Advanced techniquesNode.js Course 2 of 2 - Advanced techniques
Node.js Course 2 of 2 - Advanced techniques
 
React - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesReact - The JavaScript Library for User Interfaces
React - The JavaScript Library for User Interfaces
 
AngularJS in Production (CTO Forum)
AngularJS in Production (CTO Forum)AngularJS in Production (CTO Forum)
AngularJS in Production (CTO Forum)
 
apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...
apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...
apidays Paris 2022 - Of graphQL, DX friction, and surgical monolithectomy, Fr...
 
Modularity problems
Modularity  problemsModularity  problems
Modularity problems
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
Daniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého SchizmaDaniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého Schizma
 
Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)
 
Cloud Orchestration is Broken
Cloud Orchestration is BrokenCloud Orchestration is Broken
Cloud Orchestration is Broken
 
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling StoryPHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
 
Fighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless phpFighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless php
 

More from e-Legion

MBLT16: Elena Rydkina, Pure
MBLT16: Elena Rydkina, PureMBLT16: Elena Rydkina, Pure
MBLT16: Elena Rydkina, Puree-Legion
 
MBLT16: Alexander Lukin, AppMetrica
MBLT16: Alexander Lukin, AppMetricaMBLT16: Alexander Lukin, AppMetrica
MBLT16: Alexander Lukin, AppMetricae-Legion
 
MBLT16: Vincent Wu, Alibaba Mobile
MBLT16: Vincent Wu, Alibaba MobileMBLT16: Vincent Wu, Alibaba Mobile
MBLT16: Vincent Wu, Alibaba Mobilee-Legion
 
MBLT16: Dmitriy Geranin, Afisha Restorany
MBLT16: Dmitriy Geranin, Afisha RestoranyMBLT16: Dmitriy Geranin, Afisha Restorany
MBLT16: Dmitriy Geranin, Afisha Restoranye-Legion
 
MBLT16: Marvin Liao, 500Startups
MBLT16: Marvin Liao, 500StartupsMBLT16: Marvin Liao, 500Startups
MBLT16: Marvin Liao, 500Startupse-Legion
 
MBLT16: Andrey Maslak, Aviasales
MBLT16: Andrey Maslak, AviasalesMBLT16: Andrey Maslak, Aviasales
MBLT16: Andrey Maslak, Aviasalese-Legion
 
MBLT16: Andrey Bakalenko, Sberbank Online
MBLT16: Andrey Bakalenko, Sberbank OnlineMBLT16: Andrey Bakalenko, Sberbank Online
MBLT16: Andrey Bakalenko, Sberbank Onlinee-Legion
 
Rx Java architecture
Rx Java architectureRx Java architecture
Rx Java architecturee-Legion
 
MBLTDev15: Hector Zarate, Spotify
MBLTDev15: Hector Zarate, SpotifyMBLTDev15: Hector Zarate, Spotify
MBLTDev15: Hector Zarate, Spotifye-Legion
 
MBLTDev15: Cesar Valiente, Wunderlist
MBLTDev15: Cesar Valiente, WunderlistMBLTDev15: Cesar Valiente, Wunderlist
MBLTDev15: Cesar Valiente, Wunderliste-Legion
 
MBLTDev15: Brigit Lyons, Soundcloud
MBLTDev15: Brigit Lyons, SoundcloudMBLTDev15: Brigit Lyons, Soundcloud
MBLTDev15: Brigit Lyons, Soundcloude-Legion
 
MBLTDev15: Egor Tolstoy, Rambler&Co
MBLTDev15: Egor Tolstoy, Rambler&CoMBLTDev15: Egor Tolstoy, Rambler&Co
MBLTDev15: Egor Tolstoy, Rambler&Coe-Legion
 
MBLTDev15: Alexander Orlov, Postforpost
MBLTDev15: Alexander Orlov, PostforpostMBLTDev15: Alexander Orlov, Postforpost
MBLTDev15: Alexander Orlov, Postforposte-Legion
 
MBLTDev15: Artemiy Sobolev, Parallels
MBLTDev15: Artemiy Sobolev, ParallelsMBLTDev15: Artemiy Sobolev, Parallels
MBLTDev15: Artemiy Sobolev, Parallelse-Legion
 
MBLTDev15: Alexander Dimchenko, DIT
MBLTDev15: Alexander Dimchenko, DITMBLTDev15: Alexander Dimchenko, DIT
MBLTDev15: Alexander Dimchenko, DITe-Legion
 
MBLTDev: Evgeny Lisovsky, Litres
MBLTDev: Evgeny Lisovsky, LitresMBLTDev: Evgeny Lisovsky, Litres
MBLTDev: Evgeny Lisovsky, Litrese-Legion
 
MBLTDev: Alexander Dimchenko, Bright Box
MBLTDev: Alexander Dimchenko, Bright Box MBLTDev: Alexander Dimchenko, Bright Box
MBLTDev: Alexander Dimchenko, Bright Box e-Legion
 
MBLTDev15: Konstantin Goldshtein, Microsoft
MBLTDev15: Konstantin Goldshtein, MicrosoftMBLTDev15: Konstantin Goldshtein, Microsoft
MBLTDev15: Konstantin Goldshtein, Microsofte-Legion
 
MBLTDev15: Anna Mikhina, Maxim Evdokimov, Tinkoff Bank
MBLTDev15: Anna Mikhina, Maxim Evdokimov, Tinkoff Bank MBLTDev15: Anna Mikhina, Maxim Evdokimov, Tinkoff Bank
MBLTDev15: Anna Mikhina, Maxim Evdokimov, Tinkoff Bank e-Legion
 

More from e-Legion (20)

MBLT16: Elena Rydkina, Pure
MBLT16: Elena Rydkina, PureMBLT16: Elena Rydkina, Pure
MBLT16: Elena Rydkina, Pure
 
MBLT16: Alexander Lukin, AppMetrica
MBLT16: Alexander Lukin, AppMetricaMBLT16: Alexander Lukin, AppMetrica
MBLT16: Alexander Lukin, AppMetrica
 
MBLT16: Vincent Wu, Alibaba Mobile
MBLT16: Vincent Wu, Alibaba MobileMBLT16: Vincent Wu, Alibaba Mobile
MBLT16: Vincent Wu, Alibaba Mobile
 
MBLT16: Dmitriy Geranin, Afisha Restorany
MBLT16: Dmitriy Geranin, Afisha RestoranyMBLT16: Dmitriy Geranin, Afisha Restorany
MBLT16: Dmitriy Geranin, Afisha Restorany
 
MBLT16: Marvin Liao, 500Startups
MBLT16: Marvin Liao, 500StartupsMBLT16: Marvin Liao, 500Startups
MBLT16: Marvin Liao, 500Startups
 
MBLT16: Andrey Maslak, Aviasales
MBLT16: Andrey Maslak, AviasalesMBLT16: Andrey Maslak, Aviasales
MBLT16: Andrey Maslak, Aviasales
 
MBLT16: Andrey Bakalenko, Sberbank Online
MBLT16: Andrey Bakalenko, Sberbank OnlineMBLT16: Andrey Bakalenko, Sberbank Online
MBLT16: Andrey Bakalenko, Sberbank Online
 
Rx Java architecture
Rx Java architectureRx Java architecture
Rx Java architecture
 
Rx java
Rx javaRx java
Rx java
 
MBLTDev15: Hector Zarate, Spotify
MBLTDev15: Hector Zarate, SpotifyMBLTDev15: Hector Zarate, Spotify
MBLTDev15: Hector Zarate, Spotify
 
MBLTDev15: Cesar Valiente, Wunderlist
MBLTDev15: Cesar Valiente, WunderlistMBLTDev15: Cesar Valiente, Wunderlist
MBLTDev15: Cesar Valiente, Wunderlist
 
MBLTDev15: Brigit Lyons, Soundcloud
MBLTDev15: Brigit Lyons, SoundcloudMBLTDev15: Brigit Lyons, Soundcloud
MBLTDev15: Brigit Lyons, Soundcloud
 
MBLTDev15: Egor Tolstoy, Rambler&Co
MBLTDev15: Egor Tolstoy, Rambler&CoMBLTDev15: Egor Tolstoy, Rambler&Co
MBLTDev15: Egor Tolstoy, Rambler&Co
 
MBLTDev15: Alexander Orlov, Postforpost
MBLTDev15: Alexander Orlov, PostforpostMBLTDev15: Alexander Orlov, Postforpost
MBLTDev15: Alexander Orlov, Postforpost
 
MBLTDev15: Artemiy Sobolev, Parallels
MBLTDev15: Artemiy Sobolev, ParallelsMBLTDev15: Artemiy Sobolev, Parallels
MBLTDev15: Artemiy Sobolev, Parallels
 
MBLTDev15: Alexander Dimchenko, DIT
MBLTDev15: Alexander Dimchenko, DITMBLTDev15: Alexander Dimchenko, DIT
MBLTDev15: Alexander Dimchenko, DIT
 
MBLTDev: Evgeny Lisovsky, Litres
MBLTDev: Evgeny Lisovsky, LitresMBLTDev: Evgeny Lisovsky, Litres
MBLTDev: Evgeny Lisovsky, Litres
 
MBLTDev: Alexander Dimchenko, Bright Box
MBLTDev: Alexander Dimchenko, Bright Box MBLTDev: Alexander Dimchenko, Bright Box
MBLTDev: Alexander Dimchenko, Bright Box
 
MBLTDev15: Konstantin Goldshtein, Microsoft
MBLTDev15: Konstantin Goldshtein, MicrosoftMBLTDev15: Konstantin Goldshtein, Microsoft
MBLTDev15: Konstantin Goldshtein, Microsoft
 
MBLTDev15: Anna Mikhina, Maxim Evdokimov, Tinkoff Bank
MBLTDev15: Anna Mikhina, Maxim Evdokimov, Tinkoff Bank MBLTDev15: Anna Mikhina, Maxim Evdokimov, Tinkoff Bank
MBLTDev15: Anna Mikhina, Maxim Evdokimov, Tinkoff Bank
 

Recently uploaded

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 

Recently uploaded (20)

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 

Алексей Злобин «Scala in Goozy»

  • 1. Scala in Goozy Alexey Zlobin E-Legion
  • 2. Index 1. Goozy overview 2. Scala's place 3. Lift 4. Cake pattern in scale 5. Scalaz and other fancy stuff 6. Summary
  • 3. What is Goozy? A social network built around the concept of sticky note ● A note could be left anywhere in the Web. ● It is associated with particular page element. Central UI concept: user's related feed with all new notes and comments
  • 5. Scala's place API server Main functions: ● Storage access ● Background tasks (feed writing, e-mails) ● Email sending ● Text indexing
  • 6. Why scala? ● Fast ● Сoncise ● Expressive ● Advanced OO ● Some functional stuff ○ Simple concurrency ● All Java legacy available
  • 7. The team ● 2 persons ● Strong Java background ● Fancy about technologies ● Love to try new things
  • 8. Lift Utilized features: ● REST ● JSON serialisation That's it...
  • 9. Lift: issues Localisation performance ● Hand-made localisation on standard resource bundles gave 4 times throughput improvement. Very memory-consuming JSON serialisation. ● Not so efficient PrettyPrinter is used ● Functional-styled string escaping Poor code style ● Extremely long map-match-if hierarchies ● Mutable, difficult to debug LiftRules design
  • 10. Lift: shift from Some plans about But we have a strong migration to less dependency from Boot sophisticated framework... and configuration Ideally small and simple And there is some aspect- enough to be completely like hooks on HTTP rewritten in case of any processing, which are issue. unportable.
  • 11. Goozy API logical structure Application is composed from three layers. Each layer consists from several similar components. Like UserStorage, GroupStorage, etc.
  • 12. Conceptual problems ● Components of each level depend from each other ● Components most likely have several dependencies from the previous level ● A lot of common stuff inside a level ○ Every storage needs a DB connection ○ Every service needs an entire storage system and access to text indexes ○ Etc...
  • 13. The solution: cake pattern ● Each logically closed piece of functionality is represented as component ● Dependencies are expressed as self-type ● Common features expressed as mix-ins ● Common combinations of functionality are expressed as mix-ins of several components
  • 14. Cake pattern: consequences + All top-level architecture - Long dependency lists is expressed in one less ● Poor design? than 100 LOC file - Implicit dependency on mix- + Compile-time in order (linearisation strikes dependency checks back) ● Prefer def and lazy + The biggest file is around 1000 LOC - A bit unclear how to deal with several dependencies of the same type but different runtime implementation
  • 15. scalaz.Validation One sweet morning I sent a link to the colleague... On the next morning we had a new dependency and totally refactored request parameters analysis. Now everything is validated.
  • 16. Validation: pros and cons + Comprehensible error - Monads and Applicatives aggregation and reporting cause massive brain damage + The only imaginable way to deal with 20+ request - Complicated error reports parameters with 2-3 from the compiler constraints on each - You can't just ignore + Unified approach to possibility of runtime request validation and exception runtime error handling + Type-level check for correct error handling
  • 17. Validations and exceptions Problem: exceptions are here Solution: catch'em and convert!
  • 19. Lessons 1. Always prefer simple tools 2. Options and Eithers (Validations): they really work ○ It is possible to live with both exceptions and eithers ○ Performance consequences are not clear ○ Some times I had to use things far behind my understanding (sequence, traverse) 3. Server-side testing is difficult ○ Testing approach should be established before any code is written
  • 20. References 1. http://www.assembla. com/spaces/liftweb/wiki/REST_Web_Services - REST support in Lift 2. http://jonasboner.com/2008/10/06/real-world-scala- dependency-injection-di.html - complete cake pattern intro 3. https://gist.github.com/970717 - easy Validation example
  • 21. Testing A lot of features Very quickly evolved at the beginning We needed to exclude possibility of regression
  • 22. Testing: solution ● Integration testing from the client point of view ● All test deal only with the http interface ● Every case is a short (5-10 reqs.) scenario ● Every case is wrapped into JUnit test for convenience
  • 23. Testing: logical architecture 1. JUnit wrapper 2. Scenario 3. Library of available operation on http interface 4. Groovy's HTTPBuilder
  • 24. Integration testing: problems Groovy 1. Dynamic typing 2. Not obvious ways to do simple things 3. One extra language in project Execution time