SlideShare une entreprise Scribd logo
1  sur  50
Everything I know about software I
 learned from spaghetti bolognese




        Managing complexity
             Holly Cummins, IBM
              @holly_cummins
            Martijn Verburg, jClarity
                  @karianna
What do we know about software?
Holly               Martijn
11 years with IBM   CTO - jClarity
WebSphere           Diabolical Developer
JVM performance     Community Cat Herder
What do we know about spaghetti?
Common understanding
 No more noodling with code.
Understanding interfaces
My users don't need to know about all my methods
●



I'd like to swap this implementation for that
●


  implementation
Understanding reuse
“Could I re-use some your code in my project,
  please?”

●
    Inheritance vs Composition
       ●
           Inheritance ~= Liskov Substitution Principle
       ●
           Composition ~= Does Type B only want only
            some/part of the behavior exposed by Type A?
Services

              Normal
            spaghetti
           bolognese




            Vegetarian
             spaghetti
            bolognese
Getting hold of implementations
Perpetual problem
●



Factories
●


    ●
        Factory factories
    ●
        Factory factory factories
    ●
        Factory factory factory factories
Home-rolled frameworks
●



META-INF/Services
●



OSGI services
●
Dependency injection
Externalised Factory Problem
●



Enable implementations to be switched in and out
●


●
    Avoids hard-couplings in runtime
●
    Enables effective testing and test-driven-development
        ●
            Implementations can be stubbed or mocked out
●
    Really helps modularity
●
    Guice, Picocontainer are light-weight starting points
What can I do?
●
    Be strict about dependency management
●
    Understand external and internal interfaces
       ●
           What do you want to be able to swap?
●
    Think about what type of re-use you're going for
●
    Draw out dependencies
       ●
           Tooling can help
JAR Hell
Problems with JARs
●
 JARs are transparent




March12, 2010     QCon London 2010   Ian Robinson   12
Problems with JARs
●
    Java Platform Modularity
                Classes encapsulate data                                  Jar
           ●


           ●
                Packages contain classes
                                                                    Package
           ●
                Jars contain packages
                                                                        Class

●
    Class visibility:                                                   Package
           ●
                private                                                       Class
                                                                                 Class
           ●
                package private
                                                                                Package
           ●
                protected
                                                                                    Class
           ●
                public                                                                 Class




●
    No “jar scoped” access modifiers.
March12, 2010                     QCon London 2010   Ian Robinson                              13
Problems with JARs
●
    No means for a jar to declare its
    dependencies.                                               Jar
                                                          Package

●
    No versioning.                                            Class


                                                              Package


    Jars have no modularization
                                                                    Class
●                                                                      Class


     characteristics                                                  Package

                                                                          Class
                                                                             Class


●
    At runtime there is just a collection of
    classes on a global classpath
March12, 2010           QCon London 2010   Ian Robinson                              14
More problems with jars
●
    In a normal jar, an implementation is just as easy to
     use as the interface.

    ●
        In a normal jar, an implementation easier to use than
         the interface
                ●
                    No worries about factory patterns
                ●
                    Encourages consumers to bust encapsulation
                     wide open



March12, 2010                QCon London 2010   Ian Robinson     15
Why classloading is broken




March12, 2010         QCon London 2010   Ian Robinson   16
What can I do?




Don't think JARs, think modules
Modularity Principles
This section is a tooling-free zone.




        Mostly.
Understanding dependencies
What other code does my code touch?
●




What happens if I change my code?
●
Understanding dependencies
●
    What other code does my code touch?

●
    When does it connect?
       ●
           Compile time?
       ●
           Runtime?
       ●
           Transitively?
       ●
           Only at test?
Modularity
Bad Modularity




●
    Dividing up the code != good modularity
●
    Retrofitting modularity is hard
●
    See Michael Feathers' “Dealing with Legacy Code”
Think about modularity from the start
Enforcing modularity with classloaders
Sharing between modules
 OSGi

                                 OSGi



OSGi
                            OSGi
          OSGi
Sharing between modules
A question of scale




●
    Need for modularity grows with size of project
Choose the right granularity
Choose the right granularity
Choose the right granularity
Choose the right granularity
●
    A common approach
       ●
           foo-api
       ●
           foo-core
       ●
           foo-ui


●
    Outsiders only rely on foo-api (interfaces!)

●
    It boils down to your domain modeling.
       ●
           Naming is everything
Modularity isn't free
What can I do?
●
    There is a bunch of tooling to help
        ●
            Maven, Ant/Ivy
        ●
            OSGi, Jboss Modules


●
    Nothing beats a whiteboard or a drawing pad
        ●
            TDD should be Test Driven Design
        ●
            Pair Programming? Think Pair Designing instead
Versioning
 Now that you have modules, how do you manage the
             relationship between them?




March12, 2010   QCon London 2010   Ian Robinson   34
Versioning




March12, 2010   QCon London 2010   Ian Robinson   35
Versioning
●
    Major increment: I break consumers
          ●
                Removal of existing methods or interfaces


●
    Minor increment: I break implementers
          ●
                Addition of methods to interfaces


●
    Micro increment: I promise I don't break anything
          ●
                “Clear” defect fixes
          ●
March12, 2010
                Internal improvements
                           QCon London 2010   Ian Robinson   36
Versioning
●
    But … causes developer depression
          ●
                Compatibility != amount of work
          ●
                Tempting to use marketing versions rather than
                  semantic versions


●
    A good example here is Java itself!




March12, 2010              QCon London 2010   Ian Robinson       37
What can I do?
●
    major.minor.trivial
          ●
                SNAPSHOT is acceptable internally


●
    If you have customers/clients
          ●
                You need to think about backwards compatibility
          ●
                Plugin systems are useful here
                    ●
                        Once more think dependency injection



March12, 2010                 QCon London 2010   Ian Robinson     38
Testing
Tasting
What does our pasta taste like?




Testing simple things is easy
●



Testing complex things is hard
●




●
    Make your things simple
Unit testing
Integration testing
What can I do?
●
    Test early, Test often

●
    Test at lots of granularities
        ●
            Unit
        ●
            Integration
        ●
            System


●
    Let machines do your testing for you!
Tools, Tips and Techniques
CI
OSGi
●
    Explicit dependency management
       ●
           Classloading


●
    Explicit version management

●
    Services
       ●
           No more hacky factories
OSGi
●
    Enables
        ●
            Reliability
                ●
                    No more ClassDefNotFoundException
        ●
            Small footprint
        ●
            Dynamism


●
    Easy to get started with – it's just simple manifests
        ●
            It's compatible too!
OSGi Manifests
 Manifest is a bit like a recipe




Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MyService bundle
Bundle-SymbolicName: com.sample.myservice
Bundle-Version: 1.0.0
Bundle-Activator: com.sample.myservice.Activator
Import-Package: org.apache.commons.logging;version="1.0.4"
Export-Package: com.sample.myservice.api;version="1.0.0"
All done!
Thank you
.... and now it's time for lunch.
    .... which may be pasta.

Contenu connexe

En vedette

VMET_Document - VERIFICATION OF MILITARY EDUCATION AND TRAINING (2015_09_22 2...
VMET_Document - VERIFICATION OF MILITARY EDUCATION AND TRAINING (2015_09_22 2...VMET_Document - VERIFICATION OF MILITARY EDUCATION AND TRAINING (2015_09_22 2...
VMET_Document - VERIFICATION OF MILITARY EDUCATION AND TRAINING (2015_09_22 2...Darryl Oliver Franklin
 
Fotos asón 1º eso 2016
Fotos asón 1º eso   2016Fotos asón 1º eso   2016
Fotos asón 1º eso 2016asoraya10
 
Jenner y pasteur
Jenner y pasteurJenner y pasteur
Jenner y pasteurmariibiris
 
Introduction to the course
Introduction to the courseIntroduction to the course
Introduction to the courseETS-UBC
 
Phát triển hoạt động kinh doanh thẻ tại ngân hàng thương mại cổ phần đầu tư v...
Phát triển hoạt động kinh doanh thẻ tại ngân hàng thương mại cổ phần đầu tư v...Phát triển hoạt động kinh doanh thẻ tại ngân hàng thương mại cổ phần đầu tư v...
Phát triển hoạt động kinh doanh thẻ tại ngân hàng thương mại cổ phần đầu tư v...https://www.facebook.com/garmentspace
 
царскосельский лицей а.с.пушкина
царскосельский лицей а.с.пушкинацарскосельский лицей а.с.пушкина
царскосельский лицей а.с.пушкинаNatalya Dyrda
 
Безопасный интернет
Безопасный интернетБезопасный интернет
Безопасный интернетNatalya Dyrda
 
классный час русь ремесленная
классный час русь ремесленнаяклассный час русь ремесленная
классный час русь ремесленнаяnordf4st
 

En vedette (14)

VMET_Document - VERIFICATION OF MILITARY EDUCATION AND TRAINING (2015_09_22 2...
VMET_Document - VERIFICATION OF MILITARY EDUCATION AND TRAINING (2015_09_22 2...VMET_Document - VERIFICATION OF MILITARY EDUCATION AND TRAINING (2015_09_22 2...
VMET_Document - VERIFICATION OF MILITARY EDUCATION AND TRAINING (2015_09_22 2...
 
Fotos asón 1º eso 2016
Fotos asón 1º eso   2016Fotos asón 1º eso   2016
Fotos asón 1º eso 2016
 
Jenner y pasteur
Jenner y pasteurJenner y pasteur
Jenner y pasteur
 
Estructuras
EstructurasEstructuras
Estructuras
 
Introduction to the course
Introduction to the courseIntroduction to the course
Introduction to the course
 
Phát triển hoạt động kinh doanh thẻ tại ngân hàng thương mại cổ phần đầu tư v...
Phát triển hoạt động kinh doanh thẻ tại ngân hàng thương mại cổ phần đầu tư v...Phát triển hoạt động kinh doanh thẻ tại ngân hàng thương mại cổ phần đầu tư v...
Phát triển hoạt động kinh doanh thẻ tại ngân hàng thương mại cổ phần đầu tư v...
 
Плакаты учащихся
Плакаты учащихсяПлакаты учащихся
Плакаты учащихся
 
Презентация Новиковой Е.А.
Презентация Новиковой Е.А.Презентация Новиковой Е.А.
Презентация Новиковой Е.А.
 
Иностранные языки в нашей школе
Иностранные языки в нашей школеИностранные языки в нашей школе
Иностранные языки в нашей школе
 
Microsoft excel
Microsoft excelMicrosoft excel
Microsoft excel
 
царскосельский лицей а.с.пушкина
царскосельский лицей а.с.пушкинацарскосельский лицей а.с.пушкина
царскосельский лицей а.с.пушкина
 
Безопасный интернет
Безопасный интернетБезопасный интернет
Безопасный интернет
 
Hitachi Solutions Ecommerce Store Front Designer Guide
Hitachi Solutions Ecommerce Store Front Designer GuideHitachi Solutions Ecommerce Store Front Designer Guide
Hitachi Solutions Ecommerce Store Front Designer Guide
 
классный час русь ремесленная
классный час русь ремесленнаяклассный час русь ремесленная
классный час русь ремесленная
 

Similaire à Everything I know about software in spaghetti bolognese: managing complexity

Building a Company atop of Open Source
Building a Company atop of Open SourceBuilding a Company atop of Open Source
Building a Company atop of Open SourceAnoop Thomas Mathew
 
Android Frameworks: Highlighting the Need for a Solid Development Framework 
Android Frameworks: Highlighting the Need for a Solid Development Framework Android Frameworks: Highlighting the Need for a Solid Development Framework 
Android Frameworks: Highlighting the Need for a Solid Development Framework Mutual Mobile
 
Working With Legacy Code
Working With Legacy CodeWorking With Legacy Code
Working With Legacy CodeAndrea Polci
 
Design for Testability
Design for Testability Design for Testability
Design for Testability Pawel Kalbrun
 
Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?Jérôme Petazzoni
 
Concurrency - Why it's hard ?
Concurrency - Why it's hard ?Concurrency - Why it's hard ?
Concurrency - Why it's hard ?Ramith Jayasinghe
 
Patterns: The new Javascript framweork
Patterns: The new Javascript framweorkPatterns: The new Javascript framweork
Patterns: The new Javascript framweorkFranco Pellegrini
 
Drools planner - 2012-10-23 IntelliFest 2012
Drools planner - 2012-10-23 IntelliFest 2012Drools planner - 2012-10-23 IntelliFest 2012
Drools planner - 2012-10-23 IntelliFest 2012Geoffrey De Smet
 
Design Patterns Illustrated
Design Patterns IllustratedDesign Patterns Illustrated
Design Patterns IllustratedHerman Peeren
 
Nightmare on Docker street
Nightmare on Docker streetNightmare on Docker street
Nightmare on Docker streetKris Buytaert
 
BDD workshop for JavaScript developers
BDD workshop for JavaScript developersBDD workshop for JavaScript developers
BDD workshop for JavaScript developersCarlos Ble
 
TS 5341 Rethinking the ESB
TS 5341 Rethinking the ESBTS 5341 Rethinking the ESB
TS 5341 Rethinking the ESBaegloff
 
Django Bootstrapping with Ease
Django Bootstrapping with EaseDjango Bootstrapping with Ease
Django Bootstrapping with EaseConcentric Sky
 
VIB - Very Important Bundles
VIB - Very Important BundlesVIB - Very Important Bundles
VIB - Very Important BundlesRoman Roelofsen
 
Needs of Other November2011
Needs of Other November2011Needs of Other November2011
Needs of Other November2011Razi Masri
 

Similaire à Everything I know about software in spaghetti bolognese: managing complexity (20)

Building a Company atop of Open Source
Building a Company atop of Open SourceBuilding a Company atop of Open Source
Building a Company atop of Open Source
 
Android Frameworks: Highlighting the Need for a Solid Development Framework 
Android Frameworks: Highlighting the Need for a Solid Development Framework Android Frameworks: Highlighting the Need for a Solid Development Framework 
Android Frameworks: Highlighting the Need for a Solid Development Framework 
 
Groovy android
Groovy androidGroovy android
Groovy android
 
Working With Legacy Code
Working With Legacy CodeWorking With Legacy Code
Working With Legacy Code
 
Design for Testability
Design for Testability Design for Testability
Design for Testability
 
Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?
 
Why Concurrency is hard ?
Why Concurrency is hard ?Why Concurrency is hard ?
Why Concurrency is hard ?
 
Making Strongly-typed NETCONF Usable
Making Strongly-typed NETCONF UsableMaking Strongly-typed NETCONF Usable
Making Strongly-typed NETCONF Usable
 
Concurrency - Why it's hard ?
Concurrency - Why it's hard ?Concurrency - Why it's hard ?
Concurrency - Why it's hard ?
 
Patterns: The new Javascript framweork
Patterns: The new Javascript framweorkPatterns: The new Javascript framweork
Patterns: The new Javascript framweork
 
Drools planner - 2012-10-23 IntelliFest 2012
Drools planner - 2012-10-23 IntelliFest 2012Drools planner - 2012-10-23 IntelliFest 2012
Drools planner - 2012-10-23 IntelliFest 2012
 
Design Patterns Illustrated
Design Patterns IllustratedDesign Patterns Illustrated
Design Patterns Illustrated
 
Nightmare on Docker street
Nightmare on Docker streetNightmare on Docker street
Nightmare on Docker street
 
BDD workshop for JavaScript developers
BDD workshop for JavaScript developersBDD workshop for JavaScript developers
BDD workshop for JavaScript developers
 
effective java
effective javaeffective java
effective java
 
TS 5341 Rethinking the ESB
TS 5341 Rethinking the ESBTS 5341 Rethinking the ESB
TS 5341 Rethinking the ESB
 
Git. Transition.
Git. Transition.Git. Transition.
Git. Transition.
 
Django Bootstrapping with Ease
Django Bootstrapping with EaseDjango Bootstrapping with Ease
Django Bootstrapping with Ease
 
VIB - Very Important Bundles
VIB - Very Important BundlesVIB - Very Important Bundles
VIB - Very Important Bundles
 
Needs of Other November2011
Needs of Other November2011Needs of Other November2011
Needs of Other November2011
 

Plus de JAX London

Devops with the S for Sharing - Patrick Debois
Devops with the S for Sharing - Patrick DeboisDevops with the S for Sharing - Patrick Debois
Devops with the S for Sharing - Patrick DeboisJAX London
 
Busy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript AppsBusy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript AppsJAX London
 
It's code but not as we know: Infrastructure as Code - Patrick Debois
It's code but not as we know: Infrastructure as Code - Patrick DeboisIt's code but not as we know: Infrastructure as Code - Patrick Debois
It's code but not as we know: Infrastructure as Code - Patrick DeboisJAX London
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerLocks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerJAX London
 
Worse is better, for better or for worse - Kevlin Henney
Worse is better, for better or for worse - Kevlin HenneyWorse is better, for better or for worse - Kevlin Henney
Worse is better, for better or for worse - Kevlin HenneyJAX London
 
Java performance: What's the big deal? - Trisha Gee
Java performance: What's the big deal? - Trisha GeeJava performance: What's the big deal? - Trisha Gee
Java performance: What's the big deal? - Trisha GeeJAX London
 
Clojure made-simple - John Stevenson
Clojure made-simple - John StevensonClojure made-simple - John Stevenson
Clojure made-simple - John StevensonJAX London
 
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfHTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfJAX London
 
Play framework 2 : Peter Hilton
Play framework 2 : Peter HiltonPlay framework 2 : Peter Hilton
Play framework 2 : Peter HiltonJAX London
 
Complexity theory and software development : Tim Berglund
Complexity theory and software development : Tim BerglundComplexity theory and software development : Tim Berglund
Complexity theory and software development : Tim BerglundJAX London
 
Why FLOSS is a Java developer's best friend: Dave Gruber
Why FLOSS is a Java developer's best friend: Dave GruberWhy FLOSS is a Java developer's best friend: Dave Gruber
Why FLOSS is a Java developer's best friend: Dave GruberJAX London
 
Akka in Action: Heiko Seeburger
Akka in Action: Heiko SeeburgerAkka in Action: Heiko Seeburger
Akka in Action: Heiko SeeburgerJAX London
 
NoSQL Smackdown 2012 : Tim Berglund
NoSQL Smackdown 2012 : Tim BerglundNoSQL Smackdown 2012 : Tim Berglund
NoSQL Smackdown 2012 : Tim BerglundJAX London
 
Closures, the next "Big Thing" in Java: Russel Winder
Closures, the next "Big Thing" in Java: Russel WinderClosures, the next "Big Thing" in Java: Russel Winder
Closures, the next "Big Thing" in Java: Russel WinderJAX London
 
Java and the machine - Martijn Verburg and Kirk Pepperdine
Java and the machine - Martijn Verburg and Kirk PepperdineJava and the machine - Martijn Verburg and Kirk Pepperdine
Java and the machine - Martijn Verburg and Kirk PepperdineJAX London
 
Mongo DB on the JVM - Brendan McAdams
Mongo DB on the JVM - Brendan McAdamsMongo DB on the JVM - Brendan McAdams
Mongo DB on the JVM - Brendan McAdamsJAX London
 
New opportunities for connected data - Ian Robinson
New opportunities for connected data - Ian RobinsonNew opportunities for connected data - Ian Robinson
New opportunities for connected data - Ian RobinsonJAX London
 
HTML5 Websockets and Java - Arun Gupta
HTML5 Websockets and Java - Arun GuptaHTML5 Websockets and Java - Arun Gupta
HTML5 Websockets and Java - Arun GuptaJAX London
 
The Big Data Con: Why Big Data is a Problem, not a Solution - Ian Plosker
The Big Data Con: Why Big Data is a Problem, not a Solution - Ian PloskerThe Big Data Con: Why Big Data is a Problem, not a Solution - Ian Plosker
The Big Data Con: Why Big Data is a Problem, not a Solution - Ian PloskerJAX London
 
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...JAX London
 

Plus de JAX London (20)

Devops with the S for Sharing - Patrick Debois
Devops with the S for Sharing - Patrick DeboisDevops with the S for Sharing - Patrick Debois
Devops with the S for Sharing - Patrick Debois
 
Busy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript AppsBusy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript Apps
 
It's code but not as we know: Infrastructure as Code - Patrick Debois
It's code but not as we know: Infrastructure as Code - Patrick DeboisIt's code but not as we know: Infrastructure as Code - Patrick Debois
It's code but not as we know: Infrastructure as Code - Patrick Debois
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerLocks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael Barker
 
Worse is better, for better or for worse - Kevlin Henney
Worse is better, for better or for worse - Kevlin HenneyWorse is better, for better or for worse - Kevlin Henney
Worse is better, for better or for worse - Kevlin Henney
 
Java performance: What's the big deal? - Trisha Gee
Java performance: What's the big deal? - Trisha GeeJava performance: What's the big deal? - Trisha Gee
Java performance: What's the big deal? - Trisha Gee
 
Clojure made-simple - John Stevenson
Clojure made-simple - John StevensonClojure made-simple - John Stevenson
Clojure made-simple - John Stevenson
 
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfHTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
 
Play framework 2 : Peter Hilton
Play framework 2 : Peter HiltonPlay framework 2 : Peter Hilton
Play framework 2 : Peter Hilton
 
Complexity theory and software development : Tim Berglund
Complexity theory and software development : Tim BerglundComplexity theory and software development : Tim Berglund
Complexity theory and software development : Tim Berglund
 
Why FLOSS is a Java developer's best friend: Dave Gruber
Why FLOSS is a Java developer's best friend: Dave GruberWhy FLOSS is a Java developer's best friend: Dave Gruber
Why FLOSS is a Java developer's best friend: Dave Gruber
 
Akka in Action: Heiko Seeburger
Akka in Action: Heiko SeeburgerAkka in Action: Heiko Seeburger
Akka in Action: Heiko Seeburger
 
NoSQL Smackdown 2012 : Tim Berglund
NoSQL Smackdown 2012 : Tim BerglundNoSQL Smackdown 2012 : Tim Berglund
NoSQL Smackdown 2012 : Tim Berglund
 
Closures, the next "Big Thing" in Java: Russel Winder
Closures, the next "Big Thing" in Java: Russel WinderClosures, the next "Big Thing" in Java: Russel Winder
Closures, the next "Big Thing" in Java: Russel Winder
 
Java and the machine - Martijn Verburg and Kirk Pepperdine
Java and the machine - Martijn Verburg and Kirk PepperdineJava and the machine - Martijn Verburg and Kirk Pepperdine
Java and the machine - Martijn Verburg and Kirk Pepperdine
 
Mongo DB on the JVM - Brendan McAdams
Mongo DB on the JVM - Brendan McAdamsMongo DB on the JVM - Brendan McAdams
Mongo DB on the JVM - Brendan McAdams
 
New opportunities for connected data - Ian Robinson
New opportunities for connected data - Ian RobinsonNew opportunities for connected data - Ian Robinson
New opportunities for connected data - Ian Robinson
 
HTML5 Websockets and Java - Arun Gupta
HTML5 Websockets and Java - Arun GuptaHTML5 Websockets and Java - Arun Gupta
HTML5 Websockets and Java - Arun Gupta
 
The Big Data Con: Why Big Data is a Problem, not a Solution - Ian Plosker
The Big Data Con: Why Big Data is a Problem, not a Solution - Ian PloskerThe Big Data Con: Why Big Data is a Problem, not a Solution - Ian Plosker
The Big Data Con: Why Big Data is a Problem, not a Solution - Ian Plosker
 
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...
 

Dernier

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
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
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
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: 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
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
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
 
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
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
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
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
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
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 

Dernier (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
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
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
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: 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
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
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
 
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
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
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
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.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
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 

Everything I know about software in spaghetti bolognese: managing complexity

  • 1. Everything I know about software I learned from spaghetti bolognese Managing complexity Holly Cummins, IBM @holly_cummins Martijn Verburg, jClarity @karianna
  • 2. What do we know about software? Holly Martijn 11 years with IBM CTO - jClarity WebSphere Diabolical Developer JVM performance Community Cat Herder
  • 3. What do we know about spaghetti?
  • 4. Common understanding No more noodling with code.
  • 5. Understanding interfaces My users don't need to know about all my methods ● I'd like to swap this implementation for that ● implementation
  • 6. Understanding reuse “Could I re-use some your code in my project, please?” ● Inheritance vs Composition ● Inheritance ~= Liskov Substitution Principle ● Composition ~= Does Type B only want only some/part of the behavior exposed by Type A?
  • 7. Services Normal spaghetti bolognese Vegetarian spaghetti bolognese
  • 8. Getting hold of implementations Perpetual problem ● Factories ● ● Factory factories ● Factory factory factories ● Factory factory factory factories Home-rolled frameworks ● META-INF/Services ● OSGI services ●
  • 9. Dependency injection Externalised Factory Problem ● Enable implementations to be switched in and out ● ● Avoids hard-couplings in runtime ● Enables effective testing and test-driven-development ● Implementations can be stubbed or mocked out ● Really helps modularity ● Guice, Picocontainer are light-weight starting points
  • 10. What can I do? ● Be strict about dependency management ● Understand external and internal interfaces ● What do you want to be able to swap? ● Think about what type of re-use you're going for ● Draw out dependencies ● Tooling can help
  • 12. Problems with JARs ● JARs are transparent March12, 2010 QCon London 2010 Ian Robinson 12
  • 13. Problems with JARs ● Java Platform Modularity Classes encapsulate data Jar ● ● Packages contain classes Package ● Jars contain packages Class ● Class visibility: Package ● private Class Class ● package private Package ● protected Class ● public Class ● No “jar scoped” access modifiers. March12, 2010 QCon London 2010 Ian Robinson 13
  • 14. Problems with JARs ● No means for a jar to declare its dependencies. Jar Package ● No versioning. Class Package Jars have no modularization Class ● Class characteristics Package Class Class ● At runtime there is just a collection of classes on a global classpath March12, 2010 QCon London 2010 Ian Robinson 14
  • 15. More problems with jars ● In a normal jar, an implementation is just as easy to use as the interface. ● In a normal jar, an implementation easier to use than the interface ● No worries about factory patterns ● Encourages consumers to bust encapsulation wide open March12, 2010 QCon London 2010 Ian Robinson 15
  • 16. Why classloading is broken March12, 2010 QCon London 2010 Ian Robinson 16
  • 17. What can I do? Don't think JARs, think modules
  • 18. Modularity Principles This section is a tooling-free zone. Mostly.
  • 19. Understanding dependencies What other code does my code touch? ● What happens if I change my code? ●
  • 20. Understanding dependencies ● What other code does my code touch? ● When does it connect? ● Compile time? ● Runtime? ● Transitively? ● Only at test?
  • 22. Bad Modularity ● Dividing up the code != good modularity ● Retrofitting modularity is hard ● See Michael Feathers' “Dealing with Legacy Code”
  • 23. Think about modularity from the start
  • 25. Sharing between modules OSGi OSGi OSGi OSGi OSGi
  • 27. A question of scale ● Need for modularity grows with size of project
  • 28. Choose the right granularity
  • 29. Choose the right granularity
  • 30. Choose the right granularity
  • 31. Choose the right granularity ● A common approach ● foo-api ● foo-core ● foo-ui ● Outsiders only rely on foo-api (interfaces!) ● It boils down to your domain modeling. ● Naming is everything
  • 33. What can I do? ● There is a bunch of tooling to help ● Maven, Ant/Ivy ● OSGi, Jboss Modules ● Nothing beats a whiteboard or a drawing pad ● TDD should be Test Driven Design ● Pair Programming? Think Pair Designing instead
  • 34. Versioning Now that you have modules, how do you manage the relationship between them? March12, 2010 QCon London 2010 Ian Robinson 34
  • 35. Versioning March12, 2010 QCon London 2010 Ian Robinson 35
  • 36. Versioning ● Major increment: I break consumers ● Removal of existing methods or interfaces ● Minor increment: I break implementers ● Addition of methods to interfaces ● Micro increment: I promise I don't break anything ● “Clear” defect fixes ● March12, 2010 Internal improvements QCon London 2010 Ian Robinson 36
  • 37. Versioning ● But … causes developer depression ● Compatibility != amount of work ● Tempting to use marketing versions rather than semantic versions ● A good example here is Java itself! March12, 2010 QCon London 2010 Ian Robinson 37
  • 38. What can I do? ● major.minor.trivial ● SNAPSHOT is acceptable internally ● If you have customers/clients ● You need to think about backwards compatibility ● Plugin systems are useful here ● Once more think dependency injection March12, 2010 QCon London 2010 Ian Robinson 38
  • 40. Tasting What does our pasta taste like? Testing simple things is easy ● Testing complex things is hard ● ● Make your things simple
  • 43. What can I do? ● Test early, Test often ● Test at lots of granularities ● Unit ● Integration ● System ● Let machines do your testing for you!
  • 44. Tools, Tips and Techniques
  • 45. CI
  • 46. OSGi ● Explicit dependency management ● Classloading ● Explicit version management ● Services ● No more hacky factories
  • 47. OSGi ● Enables ● Reliability ● No more ClassDefNotFoundException ● Small footprint ● Dynamism ● Easy to get started with – it's just simple manifests ● It's compatible too!
  • 48. OSGi Manifests Manifest is a bit like a recipe Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: MyService bundle Bundle-SymbolicName: com.sample.myservice Bundle-Version: 1.0.0 Bundle-Activator: com.sample.myservice.Activator Import-Package: org.apache.commons.logging;version="1.0.4" Export-Package: com.sample.myservice.api;version="1.0.0"
  • 50. Thank you .... and now it's time for lunch. .... which may be pasta.