SlideShare a Scribd company logo
1 of 85
Download to read offline
Design	
  Principles	
  Behind	
  
      PATAGONIA         	
  
      Hernán Wilkinson
     hernan.wilkinson@10pines.com




                  agile software development & services
What is Patagonia?

▶    A beautiful place…
But also…


▶    Conference Registration System
▶    Sponsored by ESUG
▶    Developed by 10Pines
▶    Developed with:
     –  Pharo
     –  Seaside 3.0 (using JQuery in some places)
▶    Production:
     –  Pharo
     –  Amazon Cloud
     –  File based persistence (ReferenceStream… but
        GemStone is the best option, no doubt about it  )
What is Patagonia?
▶    User Registration front end
What is Patagonia?

▶    Group Registration front end
What is Patagonia?
▶    Administration front end
Some Statistics…

▶    Programming Errors: 1! (Fixed already)
▶    Functional gaps: some… we had to adjust as
     always
▶    Tests: 136 (no as many as I would like…)
▶    Classes: 269 (It includes some not functionality
     packages)
▶    Methods: 2415
▶    Lines Of Code: 16297
▶    Average Lines/Method: 6 (including comments…
     should be less)
▶    To do’s: 55 
Some info…

▶    Used at ESUG 2010
▶    License: MIT
▶    Code: www.squeaksource.com/Patagonia
▶    Limitations:
     –  Supports only paid conferences
     –  Some functionality is coupled with ESUG
        •  Invoice
        •  Payment
     –  Registration wizard not configurable
     –  And others…
Why “Design Principles Behind…” ?

We will see some design
          issues…




                           and



                                   Some tips about how to avoid
                                               them…


            (sorry Dan for stealing your title…)
Some Important design problems we saw…

Abstractions created from a technical
  perspective, not from the domain
  problem one

  –  UserDAO
  –  UserService
  –  … and User is just a data structure


        Essential - Accidental
Some Important design problems we saw…

           Objects without clear responsibilities
           Schizophrenic objects

              –  Too many responsibilities
              –  Representing too many entities




                  Essential - Accidental
Some Important design problems we saw…

           Tons of “nil doesNotUnderstand:” (or
             NullPointerException in “that great”
             language  )

             –  Difficult to see when an object “is
                complete”



                  Essential - Accidental
Some Important design problems we saw…



                                 Essential - Accidental



Constraints not part of the model

  –  Lots of invalid objects
  –  Models that “do not teach” new
     programmers
Design Tips’ Goals


▶    Write Robust Software
▶    Write software that is easy to understand and
     therefore to maintain
     –  The model has to provide means for the humans to
        understand it easily
     –  The model has to help you learn it!
     –  The model has to tell us when we make mistakes as
        soon as we make them (immediate feedback)
▶    Computers to do more and programmers less
     –  We will not care if it takes more time
     –  We will prefer human time vs. computer time
How do you know if they are good?


                     … well you don’t




▶    Based on some years of experience…
     –  I started writing down these “tips” more that six years ago
     –  I used them to develop different systems (financial/desktop,
        sales/web, patagonia, etc)
▶    Not sure if they apply to any kind of system
Let’s define software
       Computable Model of a Problem Domain




                           Paradigm	
  



          Computable	
                    Problem	
  
            Model	
                       Domain	
  

                                                        R	
  
And software development as…




  Knowledge acquisition       Knowledge representation


               A learning process… 
Software development
           Natural	
  Language	
  
           • Informal	
  
           • Incomplete	
  
           • Tacit	
  
                                        Analysis	
  
         A	
  difficult	
  
         task	
  

Programming	
  	
                                                   Diagrams	
  
Language	
                  Progra
                                                                    • Informal	
  
                            mming	
                    Design	
  
• Formal	
                                                          • Incomplete	
  
• Complete	
                                                        • Explicit	
  
• Explicit	
  
Example – Patagonia Requirement

▶    We cannot have two conferences with the same
     name
▶    A talk can not be registered twice (they can not
     have the same name)
▶    We use the names as unique identifiers but…
     –  Comparing them should not be case sensitive
     –  Blanks don’t matter
     –  They cannot be empty
▶    Where do we put that knowledge? Should we
     represent that knowledge?
Example


For most people, they are just
  Strings



                For some solitary people (like me),
                they have enough behavior to be
                reified. I called them Name
Another Example

                                  ?
                       same concept as
                        (pharo list discussion)




▶    Symbol  uniqueness
     –  why don’t we name it “UniqueString” for example?
▶    But SOME symbols are “selectors”
     –  They answer #isUnary, #isBinary, #precedence, etc
▶    One class is used to represent two different concepts
     –  Knowledge representation problem…
Another Example

If we remove #isBinary, #precedence to symbols, are they
   still symbols?




                      “A designer knows he has achieved
                     perfection not when there is nothing left
                     to add, but when there is nothing left
                                 to take away”
                                             (Saint Exupery)



 I think two classes would be better, UniqueString and
    MessageName (not even Selector… remember the axioms)
So…

▶    I don’t want the programmer to think all the
     time…
     –  “here, is it only a symbol or a message name?”
     –  Is this just a string or an identifier (a name)?
     –  Is this just a number or an amount of money?
▶    I want…




        computers do more… and people less…
Tip	
  1:	
  
  	
  Try	
  to	
  have	
  an	
  Isomorphism	
  
between	
  classes	
  and	
  concepts	
  of	
  
           the	
  problem	
  domain	
  
Tip 1: Isomorphism

▶    One to one mapping between classes and concepts




 Abstraction



     Concrete


                   Model                     Problem
                                             Domain
      Implementation
          Detail                                       R
Tip 1: Isomorphism

▶    No two classes for one concept (not common)




                Model                         Problem
                                              Domain

                                                        R
Tip 1: Isomorphism
▶    No one class for two concepts




                Model                Problem
                                     Domain

                                               R
Examples of one class, many concepts

▶    Symbol used to represent a day
     –  #Monday represents the day Monday, so you can as a day (i.e.
        Monday) if it is binary 
▶    Number to represent a year
     –  Is the number 2008 a good representation of the year 2008?
     –  What does it mean the factorial of year 2008?
     –  How do you know if year 2008 is leap or not?
▶    Number to represent a measure
     –  Is 10 a good representation for 10 dollars?
▶    String used to represent names (identifiers)
     –  “Hernan” will not be the same as “HERNAN” or “ HeRnAn “
▶    Just code…
     –  Is the code “initialCapital * interestRate * time” a good
        representation of the Interest received in an investment?
     –  Why not having an Interest class?
Tip 1 - Conclusion


▶    I’m not saying “create a class per each role they play in a
     context”. Example
     –  Numerator is not another class, we use integers to represent a
        fraction’s numerator, and that integer will play the role of the
        fraction’s numerator
▶    Some people say “It is more complex, you will have more
     classes”
     –  Remember Alan Kay?: “everything is about the verbs”
     –  The number of messages will be the same!
         •  #isBinary, #isKeyword, #precedence etc. will be in
            MessageName but we will not add new messages to it that
            were not in Symbol
▶    What we recognize as concept of the problem domain
     depends on our analysis capabilities and design experience
Tip 1 - Conclusion


▶    Benefits:
     –  Cohesion
     –  Direct mapping between the model and the problem
        domain
     –  Well defined abstractions
     –  Objects with clear responsibilities
     –  Easier to understand


▶    QUESTION: How do we create objects?
Classic way to create objects

 ▶    Setters

                                    Date   aDate

                    new
                         ^aDate
                    dayNumber: 14                      error
Incomplete
Reachable           monthNumber: 11
                                              isLeap
                    yearNumber: 2008

Complete


             time
Classic way to create objects

▶    Disadvantages:
     –  The user of the object has the responsibility of
        “completing” it
     –  That responsibility is distributed, error prone, not easy
        to maintain
     –  No easy way to ensure its completeness because
        nothing define when everything is set
     –  There is a time span where the object does not
        represent anything!
     –  Nothing prevents us from changing the object
Proposed way to create objects

  ▶    The object must represent the entity since time
       zero

                                    Date         aDate
                     dayNumber: 14 monthOfYear: November, 2008
                                           new
                                           ^aDate
Unreachable
                                        initializeDayNumber: 14
                                          monthOfYear: November, 2008
                           ^aDate
 Complete


              time
Tip 2: Objects must be
 complete since their
     creation time
Tip 2: Implementation - PatAttendee


                                      One instance creation
                                         message that will
                                       receive all the objects




         ▶    One initialization message
         ▶    initializeXxx pattern
Tip 2: Implementation - PatConference




      All instance creation messages send the
                       “real one”




                        One “real” instance
                          creation message
Tip 2: Advantages


▶    Objects will always answer no matter “when” the
     message is sent (they are “complete”)
▶    Programmer will not worry about “can I send this
     message here/now?” (we are simplifying the
     protocol!)
▶    Easy and consistent implementation
     –  Only one method does new and send initialize…
     –  Pattern: named: xxx  initializeNamed: xxx
     –  Easy to check that nobody but the class sends the
        initialization message
Tip 2: To think about…


▶    An object that is “filled out” later, should be
     represented at least by two objects
     –  We will see an example…



▶    QUESTION: But, are the objects really “valid”??
Valid Objects



          ▶    Should the model check that objects
               are valid?
          ▶    If an object represents an entity of
               the problem domain, what does an
               “invalid” object represent?
          ▶    If we allow invalid objects to exist,
               how are the programmers going to
               learn “from the model”?
We need “Self Defensive” Objects




   ▶    YES, our model should be:
        –  “self defensive” and
        –  “auto documented” about validity rules/
           constrains
Where should objects be self defensive?


▶    On the method that creates the object?
     –  Repeated code  Error prone
▶    Is the UI responsibility
     –  that a number has to be > 0?
     –  that a string can not be empty?
▶    What about the instance creation message itself?
     –  If one of the class responsibility is to create objects, why
        not validate its creation first?
Example - PatFee




(this is just an implementation example… you could
  use other implementation…)
Tip 3: Only Allow Valid
    Objects to Exist
Tip 3: Advantages


▶    Only VALID objects!!
▶    The model tells us when we make mistakes!! 
     learning feedback!!
▶    Easy to use and implement
▶    Some business rules are reified (we will need
     more)
▶    We can meta-program on them…
     –  Do you want to document when a fee is valid, just look
        at its creation assertions
Tip 3: Consequences


▶    If we have only complete and valid objects…
     –  Do we need to use nil?
     –  All variables reference to objects that are not nil…
Tip 3: Consequences

                                   No need for nil!!



    … a world without nil
    It’s easy if you try…
    you may say I’m a dreamer…

                                   … but I’m not the only one
                                   “Null References: The billon dollar
                                     mistake” (Tony Hoare)
http://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare
Tip 4: Do not use nil
Problems with nil


▶    nil is handy, but has so many meanings that
     makes it impossible to handle it correctly
     –  “Is this variable nil because it was not initialized or was
        it initialized with nil?”
▶    nil is not polymorphic with any other object,
     therefore:
     –  It forces us to use “isNil ifTrue:”
     –  Error prone
Tip 4 - Advice

▶    Reify what the absence of something represents
     (null object pattern kind of)
▶    Never use the “abstract” word in the class name
     (Thanks Leandro Caniglia!)
Tip 4 – To think about


                       ▶    Can we have an Image without nil?
                       ▶    Object superclass  nil
                            –  Why not NoSuperclass ? (no need
                               with ProtoObject)
                       ▶    What about NotInitializedVariable
                            instead of nil?

▶    Remember MouseOverHandler? (lots of problems??)
Going back to Tip 3: Consequences


▶    Can we show assertions description to the user?
     –  YES!!  Error descriptions are in one place, with the
        assertions
     –  We should show more than one error description at the
        same time
     –  We should show error descriptions in the right place


                            to



                             and
Tip 3: Consequences in the UI
UI Implementation - PatFeeRendererBuilder




  Model holder for each “part”
UI Implementation - PatFeeRendererBuilder




                                   A composite
                                     model holder
                                     for PatFee

    Using same instance creation
      message
UI Implementation - PatFeeRendererBuilder




  Show errors on the right model holders
  The model knows nothing about the UI
UI Implementation - PatFeeRendererBuilder

   Difficult to write?? Just write:




Let Smalltalk do the rest…
(Print it…)
How do we test it? - PatFeeTest




      Easy way to identify errors
      No Exception hierarchy explosion
      (Look at PatAssertionModel)
Tip 3: More Consequences


      No more setters!!




              WHAT are you talking about Wilkins!!!
No setters?


▶    We cannot have setters because
     –  An object could become invalid after a set
     –  Need to check validity on setters
         •  duplicated code
         •  Sometimes it is impossible (i.e. Date)
▶    But things do change!
     –  Do they really?...
     –  How often?
     –  The truth is most of the things are immutable (or we can
        model them like that)
Tip 5: Think about
immutable objects
Immutability


▶    When does an object have to be immutable?
     –  When the entity it represents is immutable!!
▶    Examples:
     –  Number, Date, Time, Measure, etc
     –  Invoice (in Argentina it can not change once the system
        generates it)
▶    Advantages
     –  No referential transparency problem
But some things do change…


▶    Things that are supposed to be fixed but change:
     •  An Attendee can change his registration
     •  A talk can change its name
     •  A Reduction ticket can change its discount %
▶    How do we model “the change”?
     –  Within the same object (classic solution) ?
     –  With a relation {change, point in time} ?
     –  Create a new object as a result of an event ?
▶    Remember: Identity does not change!
Case 1: Create a new object as a
result of an event
 ▶    Bad invoice model
      –  Invoice cannot change in Argentina
                                       anInvoice

         addLineDescribedBy: ‘iPhone’ value: 300 dollars
          total
                    ^321 dollars

       We give the invoice to the customer


         addLineDescribedBy: ‘something’ value: 10 dollars




How do we prevent this for happening?!!
Case 1: Create a new object as a
  result of an event
 ▶    Good invoice model
 ▶    Make time passing explicit
                                       anInvoiceForm
The event
            addLineDescribedBy: ‘iPhone’ value: 300 dollars
             tear
                       ^anInvoice

        We give the invoice to the customer                     anInvoice

            addLineDescribedBy: ‘something’ value: 10 dollars               dnu

            addLineDescribedBy: ‘something’ value: 10 dollars
Case 2: Relation {change,time}

▶      Convert systems from snapshots to “movies”

                                                   ‘Apple	
  
                                                   Compu
                                                    ters’	
  

                            State	
                              …	
  
             aStock	
  
                           {from,to}	
  




                                                   ‘Apple’	
  
                            State	
  
                           {from,to}	
  
                                                                 …	
  
time
             Identity                      State
Case 2: Relation {change,time}

▶    Advantages
     –  Time queries
     –  Persistence
     –  Transaction
     –  Audit
     –  Makes time pass explicit
▶    Disadvantages
     –  New paradigm
     –  New execution model?
     –  New meta-model?
Case 3: Using the same Objects

▶    Classic solution

                                                   aStock
                           issueAmount
                                    ^1M pesos
                           issueCurrency: dollar

                                      …
          Invalid

                           issueAmount: 1M dollars
          Valid

                    time

•  Same	
  problem	
  as	
  object	
  creaTon	
  
Case 3: Using the same Objects

▶    Proposed solution, synchronize at once!

                                              Stock   aStock

      newIssuedIn: dollar forATotalOf: 1M dollar
                      ^aNewStock
      synchronizeWith: aNewStock




•  Same	
  advantages	
  as	
  object	
  creaTon	
  
Tip 6: Change objects
synchronizing at once
Tip 6: Change objects synchronizing at once


▶    New objects are created to reflect the changes
▶    The original object synchronizes with the copy using just
     one message (synchronization message or object)
▶    Advantages:
      –  Business rules are kept in one place: instance creation
         message
      –  Objects are always valid!
▶    No setter means objects cannot be used as “data
     holders”
     –  This is common in the UI
     –  Solution: “model holders” as we saw before
How it works on the UI – Setting the model



                                      allDayValue
             model: aFee
                                                 ^10      aFee	
  


                              feeMH	
       oneDayValue
          model: 10                                       ^6
                                            model: 6
                allDays	
  
                  MH	
                    oneDay	
  
                                            MH	
  
How it works on the UI – Getting the model

                                                    …	
                  syncWith: newFee
                       model
                                       ^newFee                                 aFee	
  


                                           allDayIs: 11 oneDay: 7
                           feeMH	
  
                                                            ^newFee
     model
                 ^11         model         ^7
             allDays	
                                      PatFee	
  
               MH	
                    oneDay	
  
                                         MH	
  

▶    No special “object copy”, buffering, etc.
▶    If the user cancels, nothing gets changed
▶    Validations are done by model’s objects
… meaning of an object “in the system”?


▶    Model objects that handle the sets of cohesive
     objects
▶    I call these object SubSystems. For example:
     –  PatUserSystem
     –  PatAttendeeSystem
     –  PatPaymentSystem
     –  PatTalkSystem
     –  PatAwardSystem
     –  and of course… PatPatagoniaSystem
▶    They have the responsibility of verifying the
     business rules of an object “in the system”
Tip 7: Model system
     architecture
Tip 7 – Example of PatAttendeeSystem




                               Verifies system
                                 constrains
  Does the real work
Tip 7 – Example of PatAttendeeSystem




                               Verifies system
                                 constrains
   Does the real work
Tip 7 - Advice


▶    Very important for concurrency
▶    Check everything… even though you know it
     cannot happen due to UI implementation
     –  Because you know TODAY’S UI implementation!,
        somebody can change it!
     –  The UI is not the only interface of your system! (Rest,
        WebServices, etc.)
Tip 7 – How does affect tests?


                             Force you to have the
                               right setup
                             Need for factory objects
Tip 7 - Advantages

▶    Objects are complete and valid (previous tips)
▶    Objects in the system are valid
▶    “One system to rule them all”
     –  PatPatagoniaSystem
         •  It is the one registered in the SeaSide application
        •  It is the root for all objects in GemStone
▶    We can do meta-programming on the
     architecture!
▶    We can have different system implementations
     –  i.e. AuthenticationSystem
▶    We can distribute the systems…
Tip 7 – Advice: Model time system

▶    Tests have to control EVERYTHING, also the
     time…
Tip 7 – Advice: Model time system




     For the tests, PatPatagoniaSystem uses a
       PatTestTimeSystem
     We control the time to test “time” related
       constrains/events
There are more things to talk about like…
▶    Assertions model
▶    Patagonia WebUI Model (not as nice as I would
     like)
▶    But for sure we ran out of time…
Conclusions


▶    Axiom 1: Software as computable MODEL
▶    Axiom 2: Software development as LEARNING PROCESS
▶    Tip 1: Isomorphism between classes and concepts
▶    Tip 2: Objects must be complete since its creation time
▶    Tip 3: Verify domain rules at creation time
▶    Tip 4: Do not use nil
▶    Tip 5: Think on immutable objects
▶    Tip 6: Synchronize objects at once
▶    Tip 7: Model system architecture

▶    Create your culture around these tips
▶    Meta-Tip: Use tests to verify the use of these tips
Follow these tips and…



 And you will Sleep tight




                 because you will have just 1
                   error in your system…
QuesTons?	
  



   agile software development & services

More Related Content

Viewers also liked

Patagonia Digital Strategy Final Presentation
Patagonia Digital Strategy Final PresentationPatagonia Digital Strategy Final Presentation
Patagonia Digital Strategy Final Presentationgitrerac
 
Environmental Differentiation Strategy of Patagonia
Environmental Differentiation Strategy of PatagoniaEnvironmental Differentiation Strategy of Patagonia
Environmental Differentiation Strategy of PatagoniaJohannes Mahlich
 
Patagonia Case Analysis
Patagonia Case AnalysisPatagonia Case Analysis
Patagonia Case AnalysisWilliam Duncan
 

Viewers also liked (8)

Patagonia Digital Strategy Final Presentation
Patagonia Digital Strategy Final PresentationPatagonia Digital Strategy Final Presentation
Patagonia Digital Strategy Final Presentation
 
Patagonia inc
Patagonia incPatagonia inc
Patagonia inc
 
Patagonia 22 mars 2012
Patagonia   22 mars 2012Patagonia   22 mars 2012
Patagonia 22 mars 2012
 
Patagonia
PatagoniaPatagonia
Patagonia
 
Patagonia Ppt
Patagonia PptPatagonia Ppt
Patagonia Ppt
 
Environmental Differentiation Strategy of Patagonia
Environmental Differentiation Strategy of PatagoniaEnvironmental Differentiation Strategy of Patagonia
Environmental Differentiation Strategy of Patagonia
 
Patagonia Case Analysis
Patagonia Case AnalysisPatagonia Case Analysis
Patagonia Case Analysis
 
Patagonia: Case Analysis
Patagonia: Case AnalysisPatagonia: Case Analysis
Patagonia: Case Analysis
 

Similar to Design Principles Behind PATAGONIA

The 360 Developer
The 360 DeveloperThe 360 Developer
The 360 Developerenteritos
 
James Coplien - Trygve - October 17, 2016
James Coplien - Trygve - October 17, 2016James Coplien - Trygve - October 17, 2016
James Coplien - Trygve - October 17, 2016Foo Café Copenhagen
 
Welcometo imscomputers7
Welcometo imscomputers7Welcometo imscomputers7
Welcometo imscomputers7Anne Asplund
 
Teacher toolkit Pycon UK Sept 2018
Teacher toolkit Pycon UK Sept 2018Teacher toolkit Pycon UK Sept 2018
Teacher toolkit Pycon UK Sept 2018Sue Sentance
 
How not to fail at programming education
How not to fail at programming educationHow not to fail at programming education
How not to fail at programming educationEsther Seyffarth
 
Deep Learning: Towards General Artificial Intelligence
Deep Learning: Towards General Artificial IntelligenceDeep Learning: Towards General Artificial Intelligence
Deep Learning: Towards General Artificial IntelligenceRukshan Batuwita
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being DrivenAntonio Terreno
 
LxD - Learner Experience Design
LxD - Learner Experience DesignLxD - Learner Experience Design
LxD - Learner Experience DesignJulie Dirksen
 
Needs of Other November2011
Needs of Other November2011Needs of Other November2011
Needs of Other November2011Razi Masri
 
Eating The Elephant (that is ICT) and eating it one bite @ a time!
Eating The Elephant (that is ICT) and eating it one bite @ a time!Eating The Elephant (that is ICT) and eating it one bite @ a time!
Eating The Elephant (that is ICT) and eating it one bite @ a time!Rachel Evans Boyd
 
Assessing Students through Reflections and Writing
Assessing Students through Reflections and WritingAssessing Students through Reflections and Writing
Assessing Students through Reflections and WritingMelissa Smith
 
Lessons learned from building practical deep learning systems
Lessons learned from building practical deep learning systemsLessons learned from building practical deep learning systems
Lessons learned from building practical deep learning systemsXavier Amatriain
 
C# .NET - Um overview da linguagem
C# .NET - Um overview da linguagem C# .NET - Um overview da linguagem
C# .NET - Um overview da linguagem Claudson Oliveira
 
Machine Learning Workshop, TSEC 2020
Machine Learning Workshop, TSEC 2020Machine Learning Workshop, TSEC 2020
Machine Learning Workshop, TSEC 2020Siddharth Adelkar
 
Chunking and storyboarding
Chunking and storyboardingChunking and storyboarding
Chunking and storyboardingNelly Kamel
 
BIG2016- Lessons Learned from building real-life user-focused Big Data systems
BIG2016- Lessons Learned from building real-life user-focused Big Data systemsBIG2016- Lessons Learned from building real-life user-focused Big Data systems
BIG2016- Lessons Learned from building real-life user-focused Big Data systemsXavier Amatriain
 

Similar to Design Principles Behind PATAGONIA (20)

The 360 Developer
The 360 DeveloperThe 360 Developer
The 360 Developer
 
James Coplien - Trygve - October 17, 2016
James Coplien - Trygve - October 17, 2016James Coplien - Trygve - October 17, 2016
James Coplien - Trygve - October 17, 2016
 
Welcometo imscomputers7
Welcometo imscomputers7Welcometo imscomputers7
Welcometo imscomputers7
 
Teacher toolkit Pycon UK Sept 2018
Teacher toolkit Pycon UK Sept 2018Teacher toolkit Pycon UK Sept 2018
Teacher toolkit Pycon UK Sept 2018
 
How not to fail at programming education
How not to fail at programming educationHow not to fail at programming education
How not to fail at programming education
 
Deep Learning: Towards General Artificial Intelligence
Deep Learning: Towards General Artificial IntelligenceDeep Learning: Towards General Artificial Intelligence
Deep Learning: Towards General Artificial Intelligence
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being Driven
 
LxD - Learner Experience Design
LxD - Learner Experience DesignLxD - Learner Experience Design
LxD - Learner Experience Design
 
Needs of Other November2011
Needs of Other November2011Needs of Other November2011
Needs of Other November2011
 
Eating The Elephant (that is ICT) and eating it one bite @ a time!
Eating The Elephant (that is ICT) and eating it one bite @ a time!Eating The Elephant (that is ICT) and eating it one bite @ a time!
Eating The Elephant (that is ICT) and eating it one bite @ a time!
 
Assessing Students through Reflections and Writing
Assessing Students through Reflections and WritingAssessing Students through Reflections and Writing
Assessing Students through Reflections and Writing
 
Lessons learned from building practical deep learning systems
Lessons learned from building practical deep learning systemsLessons learned from building practical deep learning systems
Lessons learned from building practical deep learning systems
 
C# .NET - Um overview da linguagem
C# .NET - Um overview da linguagem C# .NET - Um overview da linguagem
C# .NET - Um overview da linguagem
 
The Art Of Design
The Art Of DesignThe Art Of Design
The Art Of Design
 
Machine Learning Workshop, TSEC 2020
Machine Learning Workshop, TSEC 2020Machine Learning Workshop, TSEC 2020
Machine Learning Workshop, TSEC 2020
 
Chunking and storyboarding
Chunking and storyboardingChunking and storyboarding
Chunking and storyboarding
 
Introduction to Design Thinking Workshop
Introduction to Design Thinking WorkshopIntroduction to Design Thinking Workshop
Introduction to Design Thinking Workshop
 
tensorflow.pptx
tensorflow.pptxtensorflow.pptx
tensorflow.pptx
 
Exploring French Job Ads, Lynn Cherny
Exploring French Job Ads, Lynn ChernyExploring French Job Ads, Lynn Cherny
Exploring French Job Ads, Lynn Cherny
 
BIG2016- Lessons Learned from building real-life user-focused Big Data systems
BIG2016- Lessons Learned from building real-life user-focused Big Data systemsBIG2016- Lessons Learned from building real-life user-focused Big Data systems
BIG2016- Lessons Learned from building real-life user-focused Big Data systems
 

More from ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsESUG
 

More from ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Recently uploaded

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
 
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
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 

Recently uploaded (20)

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
 
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
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 

Design Principles Behind PATAGONIA

  • 1. Design  Principles  Behind   PATAGONIA   Hernán Wilkinson hernan.wilkinson@10pines.com agile software development & services
  • 2. What is Patagonia? ▶  A beautiful place…
  • 3. But also… ▶  Conference Registration System ▶  Sponsored by ESUG ▶  Developed by 10Pines ▶  Developed with: –  Pharo –  Seaside 3.0 (using JQuery in some places) ▶  Production: –  Pharo –  Amazon Cloud –  File based persistence (ReferenceStream… but GemStone is the best option, no doubt about it  )
  • 4. What is Patagonia? ▶  User Registration front end
  • 5. What is Patagonia? ▶  Group Registration front end
  • 6. What is Patagonia? ▶  Administration front end
  • 7. Some Statistics… ▶  Programming Errors: 1! (Fixed already) ▶  Functional gaps: some… we had to adjust as always ▶  Tests: 136 (no as many as I would like…) ▶  Classes: 269 (It includes some not functionality packages) ▶  Methods: 2415 ▶  Lines Of Code: 16297 ▶  Average Lines/Method: 6 (including comments… should be less) ▶  To do’s: 55 
  • 8. Some info… ▶  Used at ESUG 2010 ▶  License: MIT ▶  Code: www.squeaksource.com/Patagonia ▶  Limitations: –  Supports only paid conferences –  Some functionality is coupled with ESUG •  Invoice •  Payment –  Registration wizard not configurable –  And others…
  • 9. Why “Design Principles Behind…” ? We will see some design issues… and Some tips about how to avoid them… (sorry Dan for stealing your title…)
  • 10. Some Important design problems we saw… Abstractions created from a technical perspective, not from the domain problem one –  UserDAO –  UserService –  … and User is just a data structure Essential - Accidental
  • 11. Some Important design problems we saw… Objects without clear responsibilities Schizophrenic objects –  Too many responsibilities –  Representing too many entities Essential - Accidental
  • 12. Some Important design problems we saw… Tons of “nil doesNotUnderstand:” (or NullPointerException in “that great” language  ) –  Difficult to see when an object “is complete” Essential - Accidental
  • 13. Some Important design problems we saw… Essential - Accidental Constraints not part of the model –  Lots of invalid objects –  Models that “do not teach” new programmers
  • 14. Design Tips’ Goals ▶  Write Robust Software ▶  Write software that is easy to understand and therefore to maintain –  The model has to provide means for the humans to understand it easily –  The model has to help you learn it! –  The model has to tell us when we make mistakes as soon as we make them (immediate feedback) ▶  Computers to do more and programmers less –  We will not care if it takes more time –  We will prefer human time vs. computer time
  • 15. How do you know if they are good? … well you don’t ▶  Based on some years of experience… –  I started writing down these “tips” more that six years ago –  I used them to develop different systems (financial/desktop, sales/web, patagonia, etc) ▶  Not sure if they apply to any kind of system
  • 16. Let’s define software Computable Model of a Problem Domain Paradigm   Computable   Problem   Model   Domain   R  
  • 17. And software development as… Knowledge acquisition Knowledge representation A learning process… 
  • 18. Software development Natural  Language   • Informal   • Incomplete   • Tacit   Analysis   A  difficult   task   Programming     Diagrams   Language   Progra • Informal   mming   Design   • Formal   • Incomplete   • Complete   • Explicit   • Explicit  
  • 19. Example – Patagonia Requirement ▶  We cannot have two conferences with the same name ▶  A talk can not be registered twice (they can not have the same name) ▶  We use the names as unique identifiers but… –  Comparing them should not be case sensitive –  Blanks don’t matter –  They cannot be empty ▶  Where do we put that knowledge? Should we represent that knowledge?
  • 20. Example For most people, they are just Strings For some solitary people (like me), they have enough behavior to be reified. I called them Name
  • 21. Another Example ? same concept as (pharo list discussion) ▶  Symbol  uniqueness –  why don’t we name it “UniqueString” for example? ▶  But SOME symbols are “selectors” –  They answer #isUnary, #isBinary, #precedence, etc ▶  One class is used to represent two different concepts –  Knowledge representation problem…
  • 22. Another Example If we remove #isBinary, #precedence to symbols, are they still symbols? “A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away” (Saint Exupery) I think two classes would be better, UniqueString and MessageName (not even Selector… remember the axioms)
  • 23. So… ▶  I don’t want the programmer to think all the time… –  “here, is it only a symbol or a message name?” –  Is this just a string or an identifier (a name)? –  Is this just a number or an amount of money? ▶  I want… computers do more… and people less…
  • 24. Tip  1:    Try  to  have  an  Isomorphism   between  classes  and  concepts  of   the  problem  domain  
  • 25. Tip 1: Isomorphism ▶  One to one mapping between classes and concepts Abstraction Concrete Model Problem Domain Implementation Detail R
  • 26. Tip 1: Isomorphism ▶  No two classes for one concept (not common) Model Problem Domain R
  • 27. Tip 1: Isomorphism ▶  No one class for two concepts Model Problem Domain R
  • 28. Examples of one class, many concepts ▶  Symbol used to represent a day –  #Monday represents the day Monday, so you can as a day (i.e. Monday) if it is binary  ▶  Number to represent a year –  Is the number 2008 a good representation of the year 2008? –  What does it mean the factorial of year 2008? –  How do you know if year 2008 is leap or not? ▶  Number to represent a measure –  Is 10 a good representation for 10 dollars? ▶  String used to represent names (identifiers) –  “Hernan” will not be the same as “HERNAN” or “ HeRnAn “ ▶  Just code… –  Is the code “initialCapital * interestRate * time” a good representation of the Interest received in an investment? –  Why not having an Interest class?
  • 29. Tip 1 - Conclusion ▶  I’m not saying “create a class per each role they play in a context”. Example –  Numerator is not another class, we use integers to represent a fraction’s numerator, and that integer will play the role of the fraction’s numerator ▶  Some people say “It is more complex, you will have more classes” –  Remember Alan Kay?: “everything is about the verbs” –  The number of messages will be the same! •  #isBinary, #isKeyword, #precedence etc. will be in MessageName but we will not add new messages to it that were not in Symbol ▶  What we recognize as concept of the problem domain depends on our analysis capabilities and design experience
  • 30. Tip 1 - Conclusion ▶  Benefits: –  Cohesion –  Direct mapping between the model and the problem domain –  Well defined abstractions –  Objects with clear responsibilities –  Easier to understand ▶  QUESTION: How do we create objects?
  • 31. Classic way to create objects ▶  Setters Date aDate new ^aDate dayNumber: 14 error Incomplete Reachable monthNumber: 11 isLeap yearNumber: 2008 Complete time
  • 32. Classic way to create objects ▶  Disadvantages: –  The user of the object has the responsibility of “completing” it –  That responsibility is distributed, error prone, not easy to maintain –  No easy way to ensure its completeness because nothing define when everything is set –  There is a time span where the object does not represent anything! –  Nothing prevents us from changing the object
  • 33. Proposed way to create objects ▶  The object must represent the entity since time zero Date aDate dayNumber: 14 monthOfYear: November, 2008 new ^aDate Unreachable initializeDayNumber: 14 monthOfYear: November, 2008 ^aDate Complete time
  • 34. Tip 2: Objects must be complete since their creation time
  • 35. Tip 2: Implementation - PatAttendee One instance creation message that will receive all the objects ▶  One initialization message ▶  initializeXxx pattern
  • 36. Tip 2: Implementation - PatConference All instance creation messages send the “real one” One “real” instance creation message
  • 37. Tip 2: Advantages ▶  Objects will always answer no matter “when” the message is sent (they are “complete”) ▶  Programmer will not worry about “can I send this message here/now?” (we are simplifying the protocol!) ▶  Easy and consistent implementation –  Only one method does new and send initialize… –  Pattern: named: xxx  initializeNamed: xxx –  Easy to check that nobody but the class sends the initialization message
  • 38. Tip 2: To think about… ▶  An object that is “filled out” later, should be represented at least by two objects –  We will see an example… ▶  QUESTION: But, are the objects really “valid”??
  • 39. Valid Objects ▶  Should the model check that objects are valid? ▶  If an object represents an entity of the problem domain, what does an “invalid” object represent? ▶  If we allow invalid objects to exist, how are the programmers going to learn “from the model”?
  • 40. We need “Self Defensive” Objects ▶  YES, our model should be: –  “self defensive” and –  “auto documented” about validity rules/ constrains
  • 41. Where should objects be self defensive? ▶  On the method that creates the object? –  Repeated code  Error prone ▶  Is the UI responsibility –  that a number has to be > 0? –  that a string can not be empty? ▶  What about the instance creation message itself? –  If one of the class responsibility is to create objects, why not validate its creation first?
  • 42. Example - PatFee (this is just an implementation example… you could use other implementation…)
  • 43. Tip 3: Only Allow Valid Objects to Exist
  • 44. Tip 3: Advantages ▶  Only VALID objects!! ▶  The model tells us when we make mistakes!!  learning feedback!! ▶  Easy to use and implement ▶  Some business rules are reified (we will need more) ▶  We can meta-program on them… –  Do you want to document when a fee is valid, just look at its creation assertions
  • 45. Tip 3: Consequences ▶  If we have only complete and valid objects… –  Do we need to use nil? –  All variables reference to objects that are not nil…
  • 46. Tip 3: Consequences No need for nil!! … a world without nil It’s easy if you try… you may say I’m a dreamer… … but I’m not the only one “Null References: The billon dollar mistake” (Tony Hoare) http://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare
  • 47. Tip 4: Do not use nil
  • 48. Problems with nil ▶  nil is handy, but has so many meanings that makes it impossible to handle it correctly –  “Is this variable nil because it was not initialized or was it initialized with nil?” ▶  nil is not polymorphic with any other object, therefore: –  It forces us to use “isNil ifTrue:” –  Error prone
  • 49. Tip 4 - Advice ▶  Reify what the absence of something represents (null object pattern kind of) ▶  Never use the “abstract” word in the class name (Thanks Leandro Caniglia!)
  • 50. Tip 4 – To think about ▶  Can we have an Image without nil? ▶  Object superclass  nil –  Why not NoSuperclass ? (no need with ProtoObject) ▶  What about NotInitializedVariable instead of nil? ▶  Remember MouseOverHandler? (lots of problems??)
  • 51. Going back to Tip 3: Consequences ▶  Can we show assertions description to the user? –  YES!!  Error descriptions are in one place, with the assertions –  We should show more than one error description at the same time –  We should show error descriptions in the right place to and
  • 52. Tip 3: Consequences in the UI
  • 53. UI Implementation - PatFeeRendererBuilder Model holder for each “part”
  • 54. UI Implementation - PatFeeRendererBuilder A composite model holder for PatFee Using same instance creation message
  • 55. UI Implementation - PatFeeRendererBuilder Show errors on the right model holders The model knows nothing about the UI
  • 56. UI Implementation - PatFeeRendererBuilder Difficult to write?? Just write: Let Smalltalk do the rest… (Print it…)
  • 57. How do we test it? - PatFeeTest Easy way to identify errors No Exception hierarchy explosion (Look at PatAssertionModel)
  • 58. Tip 3: More Consequences No more setters!! WHAT are you talking about Wilkins!!!
  • 59. No setters? ▶  We cannot have setters because –  An object could become invalid after a set –  Need to check validity on setters •  duplicated code •  Sometimes it is impossible (i.e. Date) ▶  But things do change! –  Do they really?... –  How often? –  The truth is most of the things are immutable (or we can model them like that)
  • 60. Tip 5: Think about immutable objects
  • 61. Immutability ▶  When does an object have to be immutable? –  When the entity it represents is immutable!! ▶  Examples: –  Number, Date, Time, Measure, etc –  Invoice (in Argentina it can not change once the system generates it) ▶  Advantages –  No referential transparency problem
  • 62. But some things do change… ▶  Things that are supposed to be fixed but change: •  An Attendee can change his registration •  A talk can change its name •  A Reduction ticket can change its discount % ▶  How do we model “the change”? –  Within the same object (classic solution) ? –  With a relation {change, point in time} ? –  Create a new object as a result of an event ? ▶  Remember: Identity does not change!
  • 63. Case 1: Create a new object as a result of an event ▶  Bad invoice model –  Invoice cannot change in Argentina anInvoice addLineDescribedBy: ‘iPhone’ value: 300 dollars total ^321 dollars We give the invoice to the customer addLineDescribedBy: ‘something’ value: 10 dollars How do we prevent this for happening?!!
  • 64. Case 1: Create a new object as a result of an event ▶  Good invoice model ▶  Make time passing explicit anInvoiceForm The event addLineDescribedBy: ‘iPhone’ value: 300 dollars tear ^anInvoice We give the invoice to the customer anInvoice addLineDescribedBy: ‘something’ value: 10 dollars dnu addLineDescribedBy: ‘something’ value: 10 dollars
  • 65. Case 2: Relation {change,time} ▶  Convert systems from snapshots to “movies” ‘Apple   Compu ters’   State   …   aStock   {from,to}   ‘Apple’   State   {from,to}   …   time Identity State
  • 66. Case 2: Relation {change,time} ▶  Advantages –  Time queries –  Persistence –  Transaction –  Audit –  Makes time pass explicit ▶  Disadvantages –  New paradigm –  New execution model? –  New meta-model?
  • 67. Case 3: Using the same Objects ▶  Classic solution aStock issueAmount ^1M pesos issueCurrency: dollar … Invalid issueAmount: 1M dollars Valid time •  Same  problem  as  object  creaTon  
  • 68. Case 3: Using the same Objects ▶  Proposed solution, synchronize at once! Stock aStock newIssuedIn: dollar forATotalOf: 1M dollar ^aNewStock synchronizeWith: aNewStock •  Same  advantages  as  object  creaTon  
  • 69. Tip 6: Change objects synchronizing at once
  • 70. Tip 6: Change objects synchronizing at once ▶  New objects are created to reflect the changes ▶  The original object synchronizes with the copy using just one message (synchronization message or object) ▶  Advantages: –  Business rules are kept in one place: instance creation message –  Objects are always valid! ▶  No setter means objects cannot be used as “data holders” –  This is common in the UI –  Solution: “model holders” as we saw before
  • 71. How it works on the UI – Setting the model allDayValue model: aFee ^10 aFee   feeMH   oneDayValue model: 10 ^6 model: 6 allDays   MH   oneDay   MH  
  • 72. How it works on the UI – Getting the model …   syncWith: newFee model ^newFee aFee   allDayIs: 11 oneDay: 7 feeMH   ^newFee model ^11 model ^7 allDays   PatFee   MH   oneDay   MH   ▶  No special “object copy”, buffering, etc. ▶  If the user cancels, nothing gets changed ▶  Validations are done by model’s objects
  • 73. … meaning of an object “in the system”? ▶  Model objects that handle the sets of cohesive objects ▶  I call these object SubSystems. For example: –  PatUserSystem –  PatAttendeeSystem –  PatPaymentSystem –  PatTalkSystem –  PatAwardSystem –  and of course… PatPatagoniaSystem ▶  They have the responsibility of verifying the business rules of an object “in the system”
  • 74. Tip 7: Model system architecture
  • 75. Tip 7 – Example of PatAttendeeSystem Verifies system constrains Does the real work
  • 76. Tip 7 – Example of PatAttendeeSystem Verifies system constrains Does the real work
  • 77. Tip 7 - Advice ▶  Very important for concurrency ▶  Check everything… even though you know it cannot happen due to UI implementation –  Because you know TODAY’S UI implementation!, somebody can change it! –  The UI is not the only interface of your system! (Rest, WebServices, etc.)
  • 78. Tip 7 – How does affect tests? Force you to have the right setup Need for factory objects
  • 79. Tip 7 - Advantages ▶  Objects are complete and valid (previous tips) ▶  Objects in the system are valid ▶  “One system to rule them all” –  PatPatagoniaSystem •  It is the one registered in the SeaSide application •  It is the root for all objects in GemStone ▶  We can do meta-programming on the architecture! ▶  We can have different system implementations –  i.e. AuthenticationSystem ▶  We can distribute the systems…
  • 80. Tip 7 – Advice: Model time system ▶  Tests have to control EVERYTHING, also the time…
  • 81. Tip 7 – Advice: Model time system For the tests, PatPatagoniaSystem uses a PatTestTimeSystem We control the time to test “time” related constrains/events
  • 82. There are more things to talk about like… ▶  Assertions model ▶  Patagonia WebUI Model (not as nice as I would like) ▶  But for sure we ran out of time…
  • 83. Conclusions ▶  Axiom 1: Software as computable MODEL ▶  Axiom 2: Software development as LEARNING PROCESS ▶  Tip 1: Isomorphism between classes and concepts ▶  Tip 2: Objects must be complete since its creation time ▶  Tip 3: Verify domain rules at creation time ▶  Tip 4: Do not use nil ▶  Tip 5: Think on immutable objects ▶  Tip 6: Synchronize objects at once ▶  Tip 7: Model system architecture ▶  Create your culture around these tips ▶  Meta-Tip: Use tests to verify the use of these tips
  • 84. Follow these tips and… And you will Sleep tight because you will have just 1 error in your system…
  • 85. QuesTons?   agile software development & services