Programming is writing for a computer. But more importantly, it is writing for a human.
That function you just wrote tells a little story. It has a point of view.
Some functions are written to tell how a web request flows through them. They are clear, easy to read, and tend to do badly if something goes wrong. That’s not the story they are meant to tell.
The worst functions have no point of view. Perhaps they were written badly, or perhaps they were edited to death by a later programmer with a different point of view. But they are hard to follow because they change point of view.
Think about who you are writing for. Think about the story your function should tell.
Comments