SlideShare uma empresa Scribd logo
1 de 33
Scala Days 2013
Gilt Groupe
ebowman@gilt.com
http://www.flickr.com/photos/justusthane/1252907196/
Gilt provides insider access to today’s top designer labels, at up to 60% off retail.
Through our daily flash sales, which begin at noon EST, we offer everything from
high-end designer clothing and home furnishings to fine dining experiences. Our
products are grouped into five stores: Women, Men, Baby & Kids, Home and City.
Working from New York City, Dublin, or home/remotely, Gilt Tech’s 120 engineers
develop all of our technology in-house. Since Gilt’s founding days, we have
pursued a structure that enables us to address unique needs other e-commerce
platforms simply cannot support. These needs include the ability to handle
intense traffic spikes, offer prompt customer service, manage operations
(inventory, payments and shipping), and execute many other tasks.
As a rapidly growing company with an international customer base, Gilt’s priorities
focus on scalability and personalization. Gilt.com was originally built on Ruby on
Rails, but our rapid growth quickly led to scalability issues — prompting us to
migrate many parts of our website to the Java Virtual Machine. In 2011 we began
migrating our operations to Scala, which is currently our core stack.
http://search.savills.com/property-detail/gbedrseds090073
http://en.wikipedia.org/wiki/File:John_Paul_Jones_by_Charles_Wilson_Peale,_c1781.jpg
http://books.google.ie/books?id=diROAAAAYAAJ&pg=PA400&img=1&zoom=3&hl=en&sig=ACfU3U35lRj3v5Hwfzqe6ANIFr5f4L5RdA&ci=365%2C82%2C311%2C259&edge=0
“Symmetry,aswideorasnarrow
asyoumaydefineitsmeaning,is
oneideabywhichmanthrough
theageshastriedtocomprehend
andcreateorder,beauty,and
perfection.”--HermannWeyl
Symmetry:NotHowItLooks
Symmetryischanging
withoutchanging.
HowisScala
Symmetric?
EverythingisanObject
Java Scala
void dump(int x) {
System.out.println(
Integer.toString(x));
}
def dump(x: Int): Unit = {
println(x.toString)
}
void dump(Complex x) {
System.out.println(
x.toString());
}
def dump(x: Complex): Unit = {
println(x.toString)
}
:(
def dump[T](x: T): Unit = {
println(x.toString)
}
UniformAccessPrinciple
Java Scala
public class Datum {
public final int x;
public Datum(int x) {
this.x = x;
}
}
class Datum(val x: Int)
public class Datum {
private final int y;
public int x() {
return f(g(y));
}
public Datum(int y) {
this.y = y;
}
}
class Datum(y: Int) {
def x = f(g(y))
}
“All services offered by a module should be available through a
uniform notation, which does not betray whether they are implemented
through storage or through computation” - Bertrand Meyer
http://en.wikipedia.org/wiki/Uniform_access_principle
Immutable|Mutable
List<String> foo() {
ArrayList<String> items = computeItems();
return items;
}
Immutable|Mutable
List<String> foo() {
ArrayList<String> items = computeItems();
if (unlikelyThing()) {
return items.subList(
0, items.size() / 2);
} else {
return items;
}
}
List<String> foo() {
ArrayList<String> items = computeItems();
return items;
}
PatternMatching
x match {
case even if (x % 2) == 0 => even/2
case odd => odd + 1
}
PatternMatching
x match {
case even if (x % 2) == 0 => even/2
case odd => odd + 1
}
catch {
case io: IOException => ...
case e: Exception => ...
}
PatternMatching
x match {
case even if (x % 2) == 0 => even/2
case odd => odd + 1
}
catch {
case io: IOException => ...
case e: Exception => ...
}
val split: String => String = {
case null => None
case str => Some(str)
}
Monads
for {
x <- monad1
y <- monad2
} yield x op y
Monads
for {
x <- monad1
y <- monad2
} yield x op y
Traversable
Option
Future
IO
Reader
Writer
Error
Continuation
Asymmetry
PointlessSymmetry
try {
Class c = Class.forName("MyClass");
Object instance = c.newInstance();
c.getMethod("myMethod").invoke(instance);
} catch (NullPointerException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
} catch (ClassNotFoundException e) {
} catch (NoSuchMethodException e) {
} catch (InstantiationException e) {
}
http://www.metalev.org/2011/04/source-code-symmetry-and-transcendent.html
a[i].x += a[i - 1].x;
a[i].y += a[i - 1].y;
Ill-ConceivedSymmetry
http://www.metalev.org/2011/04/source-code-symmetry-and-transcendent.html
a[i].x += a[i - 1].x;
a[i].y += a[i - 1].y;
a(i) += a(i - 1)
Ill-ConceivedSymmetry
private def immediateAstNodes(n: Any): List[AstNode] = n match {
case a: AstNode List(a)
case t: Token Nil
case Some(x) immediateAstNodes(x)
case xs @ (_ :: _) xs flatMap { immediateAstNodes(_) }
case Left(x) immediateAstNodes(x)
case Right(x) immediateAstNodes(x)
case (l, r) immediateAstNodes(l) ++ immediateAstNodes(r)
case (x, y, z) immediateAstNodes(x) ++ immediateAstNodes(y) ++ immediateAstNodes(z)
case true | false | Nil | None Nil
}
http://stackoverflow.com/questions/8618082/visitor-pattern-in-scala
BeautifulAsymmetry
Symmetry&Aesthetics
Symmetry&Aesthetics
http://pages.cs.wisc.edu/~dyer/vsam/images/mona.gif
Symmetry&Aesthetics
http://pages.cs.wisc.edu/~dyer/vsam/images/mona.gif
http://www.leonardodavinci.net/images/gallery/monalisa_detail1.jpg
Symmetry&Aesthetics
http://pages.cs.wisc.edu/~dyer/vsam/images/mona.gif
http://www.leonardodavinci.net/images/gallery/monalisa_detail1.jpg
http://www.saylor.org/site/wp-content/uploads/2012/04/6-mona-lisa.gif
Balance
Rest
Binding
Order
Law
Rigidity
Constraint
Motion
Loosening
Arbitrariness
Accident
Life & Play
Freedom
http://www.acadeuro.org/fileadmin/user_upload/publications/ER_Symmetry_supplement/Lorenz.pdf
Balance
Rest
Binding
Order
Law
Rigidity
Constraint
Motion
Loosening
Arbitrariness
Accident
Life & Play
Freedom
http://www.acadeuro.org/fileadmin/user_upload/publications/ER_Symmetry_supplement/Lorenz.pdf
Platform Product
Symmetry Asymmetry
http://upload.wikimedia.org/wikipedia/commons/thumb/d/db/MaryRose-carpentry_tools1.jpg/250px-MaryRose-carpentry_tools1.jpg
http://test.classconnection.s3.amazonaws.com/324/flashcards/95324/png/altarpiece.png
http://upload.wikimedia.org/wikipedia/commons/6/63/Michelangelos_David.jpg
http://amolife.com/image/images/stories/Art&Abstract/most_popular_sculptures%20(7).jpg
http://www.biographyonline.net/artists/images/Much-The_Scream.jpg
http://www.pics24h.com/img/artwork/5-most-famous-paintings/5-most-famous-paintings03.jpg
http://upload.wikimedia.org/wikipedia/commons/6/63/Michelangelos_David.jpg
http://amolife.com/image/images/stories/Art&Abstract/most_popular_sculptures%20(7).jpg
http://www.biographyonline.net/artists/images/Much-The_Scream.jpg
http://www.pics24h.com/img/artwork/5-most-famous-paintings/5-most-famous-paintings03.jpg
http://www.iie.org/~/media/Images/Corporate/Static-Header/D-F/SH-EmmyNoether.ashx?mh=235&mw=300
http://memegenerator.net/instance/38640565
FinFin
http://tech.gilt.com
@gilttech
@ebowman
ebowman@gilt.com

Mais conteúdo relacionado

Semelhante a Scala & symmetry

Semelhante a Scala & symmetry (11)

Priming Java for Speed at Market Open
Priming Java for Speed at Market OpenPriming Java for Speed at Market Open
Priming Java for Speed at Market Open
 
Agile Data Science 2.0
Agile Data Science 2.0Agile Data Science 2.0
Agile Data Science 2.0
 
From clever code to better code
From clever code to better codeFrom clever code to better code
From clever code to better code
 
Art of Javascript
Art of JavascriptArt of Javascript
Art of Javascript
 
Scaling business app development with Play and Scala
Scaling business app development with Play and ScalaScaling business app development with Play and Scala
Scaling business app development with Play and Scala
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practices
 
vertopal.com_DataEncodingForDataClustering-5 (1).pdf
vertopal.com_DataEncodingForDataClustering-5 (1).pdfvertopal.com_DataEncodingForDataClustering-5 (1).pdf
vertopal.com_DataEncodingForDataClustering-5 (1).pdf
 
Deep Anomaly Detection from Research to Production Leveraging Spark and Tens...
 Deep Anomaly Detection from Research to Production Leveraging Spark and Tens... Deep Anomaly Detection from Research to Production Leveraging Spark and Tens...
Deep Anomaly Detection from Research to Production Leveraging Spark and Tens...
 
JavaScript Refactoring
JavaScript RefactoringJavaScript Refactoring
JavaScript Refactoring
 
Joining the Club: Using Spark to Accelerate Big Data at Dollar Shave Club
Joining the Club: Using Spark to Accelerate Big Data at Dollar Shave ClubJoining the Club: Using Spark to Accelerate Big Data at Dollar Shave Club
Joining the Club: Using Spark to Accelerate Big Data at Dollar Shave Club
 
Idioms in swift 2016 05c
Idioms in swift 2016 05cIdioms in swift 2016 05c
Idioms in swift 2016 05c
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 

Scala & symmetry