What is a good code example?

In a technical writing, a good code example is a self-contained code, it has no or relative small dependencies on any other code snippets, projects.

Why? Because written in that way, the reader will easily read and understand the code, they can even execute the code themselves to see the actual result.

And when I say technical writing, it's not only blog posts or technical papers, it can even be a technical questions.

Whenever you post a question on to the internet, try to make your question clear with a good code example. If you have a coding problem from a work-related projects, don't copy the whole function which will call thousand of other functions in your project, try to stripe out everything that are not related to your question. It will save a lot of time for the person who read your question.

Date: 2019-01-09 Wed 00:00

Author: Huy Tran

Created: 2019-04-22 Mon 14:41