Home/Blog/Why Documenting Your Code Prevents Dumpster Fires
Home/Blog/Why Documenting Your Code Prevents Dumpster Fires

Why Documenting Your Code Prevents Dumpster Fires

DevPath Team
5 min read
content
Getting at the Root Problem
Long-term benefits for documentation
Five types of technical documentation your team should start using today
Conclusion 

Will sparse or poorly maintained documentation derail your team's project? It will, eventually, by letting bugs creep in and allow mismatches between user requirements and what's delivered.

Or maybe you're dealing with code changes with zero documentation into what changed and why.

widget

A project's success often hinges on precise and detailed documentation, from creating a software design document to understanding system architecture. 

There are hundreds of articles on building a "writing culture" in your team…and for good reason.

Companies like Etsy recognize the importance of technical documentation and tested a system of immutable documentation called the FYI system — bringing about markedly improved documentation.

At a personal level, you may recall a project manual that looked more like a cryptic puzzle than a guide — filled with inconsistencies, technical jargon, and missed critical details. Your team spent weeks decoding it, delaying the project and causing undue stress.

There's an invaluable lesson about the importance of clear and accurate documentation. 

It's not just a formality — documentation can make or break a project.

Getting at the Root Problem

Before learning "how to write perfect documentation”, it's meaningless without addressing the root problem —

widget

- Simply "not worth it."

Unlike coding, where end-users may notice improvements, you might never see someone applaud your documentation.

- Detail vs. Chicken Scratch

Finding the right balance in documentation is challenging. Too much detail? You overwhelm the reader with too much granular information. Too little information? You get confusion and unanswered questions.

These points offer a snapshot of developers' frustrations with writing or reading documentation. By understanding these issues, organizations can take steps to make documentation more accessible, enjoyable, and valuable for their development teams.

Standardize processes and docs across Product and Engineering Teams
Standardize processes and docs across Product and Engineering Teams

Long-term benefits for documentation

Is the investment in improving documentation, from methodology to metrics to use cases, worth it?

Poor discipline in software documentation leads to several negative impacts that affect both the development process and the overall success of a project. 

If your team needs help understanding the impact of good documentation, here are five benefits you should consider.

1. Saved Time and Resources: 

Unclear or incomplete documentation may cause developers to spend unnecessary time interpreting the documentation or correcting mistakes, leading to wasted resources and delays in milestones.

2. Improved Collaboration and Communication:

A lack of a shared understanding can create communication barriers, resulting in disjointed efforts and a lack of alignment in the project's direction. Proper system overview and architecture design can improve alignment among stakeholders, project managers, and team members.

3. Lower Maintenance Costs: 

Documentation of algorithms, functional requirements, and system architecture lessens maintenance nightmares. Future developers will need help understanding the original code structure, logic, or intent, leading to higher costs for troubleshooting, bug fixing, and implementing new features.

4. Better Code Quality and Reliability: 

Inadequate documentation will lead to a lack of clarity in requirements, design decisions, and coding standards. A good software system design and precise software product specifications will create a better product.

5. Accelerated Onboarding for New Team Members: 

Clear system architecture, project goals, user interface design, data definitions, and system design documentation assist new team members.

In summary, inadequate software engineering documentation doesn't just affect the immediate writing or reading experience; it has far-reaching consequences that can hinder a project's success, waste valuable resources, and damage the product's reputation and the organization. 

Five types of technical documentation your team should start using today

widget

1. User Stories: These are short, simple descriptions of a feature or function, told from the perspective of the person who desires the new capability.

User stories are meant to be simple, including the following criteria:

  1. Title: a brief description

  2. Priority & estimated completion time

  3. User details:

    1. As a [type of user]

    2. I want [an action or a feature]

    3. So that [a benefit or reason]

  4. Acceptance Criteria

  5. Additional notes

2. Database / ERD Diagrams (Entity Relationship Diagrams): These visually represent the layout of databases, describing how database tables are related.

Here are some example checklists and styles to consider for ERD Diagrams:

  • Entities: usually represented by rectangles (Examples: "User", "Order", "Product", etc.)

  • Attributes: usually represented by ovals (Examples: "UserID”, "LastName”, "Email")

  • Relationships: usually represented by diamonds or lines

  • Cardinality and Modality: number and nature of relationships b/w entities (Examples: “One-to-One 1:1”, “One-to-Many 1:N”, “Many-to-Many N:N”)

widget

3. API Documentation: Describes what an API does, its functions, classes, return types, arguments, and more, often using tools like Swagger and

widget

Source: Stripe API 

4. Commenting Code: Inline explanations within the codebase that elucidate complex code sections or offer context on why specific solutions were implemented.

Consider including the following information:

  • Purpose and Clarity: Define the purpose of your comment then write with as much detail without verbosity.   Ask yourself, is the purpose of this comment to:

    • Explain complex code logic

    • Document a function's input, output, usage, and behavior

    • Point out any hacks or workarounds

    • Indicate modifications when fixing bugs

    • Provide context for future testing

    • Remind of areas requiring future attention with comment notes like “TODO” or “FIXME”

Example for TODO comments
Example for TODO comments

Source: Best Practices for writing code comments

  • Audience: Tailor your comments to the expected background of the developer reading the documentation

widget

Source: Code Tells You How, Comments Tell You Why

  • Consistency: Keep a predictable commenting style throughout the codebase

  • Maintenance and Up-to-date Information: Outdated comments are arguably worse than no comments. As the code is refactored or updated, associated comments should be revised.

Example for code modification comments
Example for code modification comments

Source: Best Practices for writing code comments

5. Software Requirement Specifications (SRS): Detailed descriptions of the system's functionalities, constraints, and behaviors.

Consider your documentation to include the following elements:

  • Introduction: defining objectives, goals, scope, and definitions of the software or system

  • Overall Description: product perspective, user characteristics, operating environment, design and implementation constraints

  • Functional requirements: detailed breakdown of each functionality of the system with use cases or user stories

  • Non-functional requirements: performance requirements, safety and security requirements, usability and accessibility, reliability and availability

  • Validation criteria: acceptance criteria, quality assurance metrics, testing

Every team's needs may vary, but these types of documentation often prove essential for ensuring smooth development processes, effective team collaboration, and clear communication with stakeholders.

Conclusion 

Engineers often juggle many tasks, and documentation may seem less important. Yet with today's complex codebases and APIs, clear and accurate documentation is vital for the success of projects and end-user satisfaction.

You can better achieve project deliverables by being mindful of the five common scenarios above and implementing the provided documentation practices. Investing time and effort into producing quality documentation is not just a support task; it's a strategic move toward creating value for your organization and clients.

Standardize processes and docs across Product and Engineering Teams
Standardize processes and docs across Product and Engineering Teams


  

Free Resources

DevPath by Educative. Copyright ©2024 Educative, Inc. All rights reserved.

soc2