Code faster by writing your code as an RLW (an original acronym introduced in this piece that stands for Read, Logic, Write) using the RLW template. RLWs are faster to code than other code because they’re faster to test and less coupled. Faster testing means faster debugging which means faster coding. And less coupling means less communication which means faster coding.
Non-RLW
Consider the following code that’s not an RLW. It’s fast to write and well structured, although slow to unit test and debug. It’s short, 38 lines, and solves a simple algorithmic programming problem from my apprentice Chris Liu.
#!/usr/bin/env python3
import sys
def is_s_int(s):
try:
int(s)
return True
except ValueError:
return False
def main():
t = int(sys.stdin.readline())
for i in range(t):
n = int(sys.stdin.readline())
current_answer = ord(sys.stdin.readline()[0])
for j in range(n-1):
relative_position = sys.stdin.readline().strip()…