Define lazily
Defining eagerly:
a = 1
dddd = a*2
bb = 1
ccc = bb + a
return bb + dddd
Defining lazily:
a = 1
bb = 1
ccc = bb + a
dddd = a*2
return bb + dddd
Reason: Defining lazily minimizes the number of definitions at each line of code.
The fewer definitions
The fewer variables in a programmer’s head
The faster the programmer can reason about the code
Note: a, bb, ccc, and dddd are bad variable names for real code, but they give order and shape to the point we’re making in this article.