When Static Typing Is Helpful?
Allen Madsen
Customers don't care about static typing
Developers don't care about static typing
Static typing is just a tool
Customers care about
- Stability - Will the stuff I use continue working?
- Iteration Speed - When will you build the thing I want to use?
- Task Speed - How long does it take me to complete a task? (e.g. Do pages take a long time to load?)
Developers care about
- Cycle time - How quickly do I discover a mistake?
- Iteration Speed - Does it feel like I'm just dragging on this feature?
- Correctness - Will my code work?
Tools have trade-offs
Pros
Static typing as tests
class WrappedThing
def run
CalledThing.call
end
end
class CalledThing
def call
:return_value
end
end
allow_any_instance_of(CalledThing).to receive(:call).and_return(:return_value)
WrappingThing.run()
class WrappedThing
def run
CalledThing.cal
end
end
Static typing as docs
def contact(customer: User): Unit = {
send_email(customer.email)
}
# vs
def contact(customer) = {
send_email(customer.email)
}
Static typing as performance enhancer
Static typing can lead to compile time performance optimizations. Though, this largely doesn't apply to languages that compile to javascript.
Cons
Types as noise
User user = new User;
Types as complexity
let foo = Option<Rc<Vec<u32>>>
Types as a constraint
All Programs
Correct programs
Typed programs
deck
By blatyo
deck
- 677