DEV Community

Cover image for Having a type system is more productive
Serhii
Serhii

Posted on

Having a type system is more productive

A type system enables multiple benefits to developers. At least, it uncovers data flow complexity.

A codebase with types becomes more intuitive and connected, primarily by making data flow visible. So, at each moment of time when I work with code, I know the input and the result after transformation or some processing.

Types + codebase

On the contrary, working with a language like Javascript provides more flexibility. However, the cost is huge: you hide data flow complexity while the problem is still there. By silencing the issue, we don't solve it, even though we can postpone encountering the consequent problems that stem from this root issue.

For example, I may send to a function invalid input without knowing it (assume this function is large and complex to understand), which results in a runtime error, that we'd like to avoid.

invalid function input

A type system tells what's wrong when a developer writes code. Thus, it's easier to catch problems before they arise in a production system.

function input with types

The code becomes more readable since you now understand the interconnectedness between various components better. Both writing and reading code are faster.


Originally published on absolyd.com.

Top comments (0)