What can programmers learn from On Writing Well ?

“type writer beside clipboard on wooden surface” by Elijah O'Donnell on Unsplash

How is writing related to programming you wonder ?

Isn’t programming a different type of endeavour compared to writing ?

Although they are contrasting types of activities, they share similar foundation. Both require clear thinking and are a form of communication.

The bestseller On Writing Well, is an informal guide on writing non fiction such as articles, emails, memoirs, travel etc. The author, William Zinsser, who also wrote 18 books, was a writer, editor, and teacher who touched the lives of countless writers, editors, teachers and students.

This book demonstrates the importance of writing and clear thinking and communication, particularly for problem solving — such is the case with programming.

“The quality of your communication is the quality of your life” — unknown.

In my opinion, most problems we experience nowadays is due to misunderstandings occurring as a result of poor or non existent communication. Remember your last conflict ? What was the source of the problem ? Could it have been prevented if someone communicated better ?

How can this book help programmers ?

This book will certainly help programmers and any craftsmen such as designers in the art of written communication, whether they write emails, articles on their subjects of expertise or sharing content they want to write about.

Nonetheless, On Writing Well can also help improving your programming skills, as I personally experience. I am crafting my codes for better readability and comprehension while being easier to debug.

Programming is like writing, in the sense that both requires clear thinking and communication using words. I believe the most important part of programming well is to be able to communicate both with the machine and for other developers to understand. There is an intersection between writing and programming well.

Remove clutter

“white book marker on book page” by Olia Gozha on Unsplash

Try to get rid of every piece of code that can be removed. Simplify your codes whenever possible to improve code readability. For example, when writing HTML codes, try writing a minimum of elements and classes that makes it easy for a developer to read the codes.

Think of writing codes as a process — focus on the process. You can try improving at each iteration. Code with confidence. Do not be wary of making mistakes. Instead, learn from them.

Rewrite your codes, often. For first iterations or rapid prototyping, you can use random const and var, but then refactor to contextual constants and variables, to make it easier to understand.

On Learning

“You learn to write by writing” — William Zinsser.

The only way to learn programming is by programming. Repetition is the key. By working on a piece of code over and over again, improving it at each iteration, you become a better programmer.

As a developer, you cannot be content writing your codes the first time. Like a rough draft that delivers the basic functionality, your work is usually bland, difficult to read and mostly unscalable without introducing regressions.

You cannot solely rely on your first piece of work. By improving it, you also improve your development skills.

Start with an outline

Just like you would when writing an article, start with an outline — an introduction, part 1, part 2 and conclusion for instance. Obviously, programming a feature or user story is different. Yet having an order before starting to code makes it easier to have a workflow without randomly typing around.

You can start writing a function that beings by defining the constants and variables.

You can then add the needed validations.

Afterwards, you can plan on adding useful conditions.

This outline gives your codes a flow that makes it easier to read for yourself and any other developer. You can also refactor or rewrite part of this flow as it is well structured.

Imagine reading a function that starts with conditions - directly taking values from the parameters and mixing them in if else statements. Sure the codes might work, but the readability can certainly improve.

Start Small & Write in Chunks

“MacBook Pro near white open book” by Nick Morrison on Unsplash

This neat advice drastically helps you if you are overwhelmed when trying to start working on a gigantic feature or user story. Instead of focusing on the end result or the outcome, start small.

Start by creating the first component or coding the layout positioning. Or, if you still feel overwhelmed, break down the first part of the task into smaller chunks.

You can also try describing the flow from an end user perspective instead of the granular work required. This helps you with an eagle view of the feature.

To make programming easier, write one line of code that does one thing, for example, one variable declaration on one line.

Coding in small chunks or grouping similar lines together, rewriting whenever needed, can help you write better codes while being more productive.

Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” ― Martin Fowler



Senior Software Developer, Writer, Amateur Photographer, Reader

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abdallah Yashir

Abdallah Yashir

Senior Software Developer, Writer, Amateur Photographer, Reader