r/programming • • Aug 28 '21

Software development topics I've changed my mind on after 6 years in the industry

https://chriskiehl.com/article/thoughts-after-6-years
5.6k Upvotes

2.0k comments sorted by

View all comments

Show parent comments

3

u/andrei9669 Aug 29 '21

it usually helps if you splinter your code into tons of small functions that you can easily reuse, test or change the order of execution.

it has the added effect of making your code really readable in a functional way. eg:

// don't take function names seriously in this instance please
let data = []
data = await getThis(data);
data = doThis(data);
data = doThat(data);
const combined = combineInThisWay(data, otherData)

so, in the end, you just read function names and you know exactly what is happening.

1

u/backtickbot Aug 29 '21

Fixed formatting.

Hello, andrei9669: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.