Friday, January 28, 2022

Code & Coffee - 1/28/2022

 

Notes for Code & Coffee: 1/28/2022

  • Replacing the six year old mouse
  • SICP for javascript is available for pre-order
    • link
  • Found this out from hacker newsletter
  • x Driven x
  • Coupling question
    • Building an interface just for the sake of building an interface
    • Talked about the usefulness and when to use and not use an interface
    • It is cheap to extract so what is the reason to make them unnessecarily
  • Stringly typed interfaces
    • Open API contract first
    • Contract is outside the code so does not get accidently changed
    • Service POJO is generated from Open API
    • First thing that happens is a conversion from the POJO to a Domain Object
    • (Immutable) Domain Object has the validation
    • Each Domain Object has invariants and will throw and exception if attempting to construct an invalid object
    • Validation code is concentrated into the Domain Objects, not strewn about
    • Disadvantages
      • Changing the rules can expose issues with previously stored data
      • Example changing a business rule that will make a newly required field
        • There will be a problem loading the previously saved fields.
      • Just be careful ;-)
  • DRY 
    • What is too dry
    • Rule of three
    • Is code that looks the same really the same?
      • maybe/maybe not
    • Summing the budget and the audience is not the same.
      • How do you round the audience members?
  • Splitting the domain object
    • In three parts
      • ID - invented key or perhaps multi-part 
        • guid
        • or guid + userId
        • validated at ID construction time
        • don't cross the streams ;-)
      • Data - User controllable data
      • MetaData - System created data
    • Insert - xData comes in and is validated - return ID
    • Update - .... something something something.
    • Only need the parts you need.
  • Immutable grass is what I need
    • it doesn't grow so I don't need to waste time cutting it.

No comments:

Post a Comment