Document Your Resources

Documentation can be used not only to explain what your code is doing and why you made a decision, but also where you came up with the idea. If you are struggling to solve a problem and you find a solution online in a blog post or online forum, you should mention your inspiration in your comments. By doing so, you are giving credit where credit is due; you are, after all, using someone else’s solution. If your inspiration comes from a trusted source, such acknowledgment can also give your code more credibility (it’s like saying that you made your investment decisions based on advice from Warren Buffett). You are also making that resource known and available to other developers who read your comments. Those developers can ...

Get Learning to Program now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.