7±2 Reasons Psychology Will Help You Write Better Code
If there’s one thing I want to take I want you to take away from this section is that when you finish writing a piece of code, and you look at it, I want you to think about not if the names match what you’re looking at but I want you to think what is the next reader going to expect and fulfill those expectations.
Any fool can write code that that a computer can understand. Good programmers write code that humans can understand
If you have more than one way of getting a piece of data, more than one function that you can invoke to do the exact same thing, that is system one saying “mmm I’m not sure what I should do here let’s ask system two”. if you have only one way of getting that data only one way of performing that action, that is then system one just knows to pull out immediately what’s going on, which function you need to call. Allowing system two to focus on the story you’re trying to tell on the business logic, you’re trying to implement.
Ask ourselves what will my reader expect, what will the next developer after me expect to see when he sees that name. ask yourself that question makes it easier to understand.