SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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)
 

Ähnlich wie Алексей Злобин «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
 

Ähnlich wie Алексей Злобин «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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Kürzlich hochgeladen (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Алексей Злобин «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