shlogg · Early preview
Maxi Contieri @mcsee1

Favor Immutability For Predictable And Thread-safe Code.

Favor immutability to prevent unexpected changes caused by aliasing. Immutable objects ensure predictability, reduce bugs & improve thread safety.

Favor immutability to retain control of your objects

TL;DR: Use immutable objects to prevent unexpected changes caused by aliasing.

  
  
  Problems

Unexpected mutations
Difficult bug tracking
Unpredictable code behavior
Reduced code predictability
Increased coupling
Compromised thread safety

  
  
  Solutions

Use immutable objects
Implement defensive copying
Favor functional programming

  
  
  Refactorings


  
    
      
    
  
  
    
      Refactoring 008 - Convert Variables to Constant
      Maxi Contieri ・ Aug 26 '22
      
        #javascript
        #webdev
        #beginners...