The "90-90-1 Rule" is a humorous observation, not a formal rule, in software development (including Python) that goes something like this:
- 90% of the coding takes 90% of the time.
- The remaining 10% of the coding takes another 90% of the time.
- Then, the final 1% of time is spent polishing, fixing bugs, and deploying, which can take a surprising amount of effort, equal to the other times.
What it means:
It highlights the tendency to underestimate the overall time and effort needed for software projects, especially the final stages. The initial burst of coding that gets the basic functionality working can feel quick, but debugging, testing, optimizing, and polishing often take significantly longer than anticipated.
Why it happens:
- Complexity: As a project nears completion, you encounter edge cases, subtle bugs, and integration problems that weren't apparent initially.
- Refinement: Getting the user interface right, ensuring performance, writing thorough documentation, and addressing security vulnerabilities can be time-consuming.
- Changing Requirements: Project requirements might evolve during development, requiring modifications to existing code.
- Technical Debt: Cutting corners earlier in the project can lead to difficulties and longer development times later.
- Unforeseen Issues: Unexpected problems with libraries, dependencies, or the deployment environment can arise.
Implications for Python Development:
- Planning: Don't underestimate the time required for debugging, testing, and polishing your Python code. Allocate sufficient time in your project schedule.
- Testing: Write comprehensive unit tests and integration tests to catch bugs early. The
unittest and pytest libraries are very popular.
- Code Quality: Follow Python's style guide (PEP 8) to ensure readability and maintainability. Tools like
flake8 and pylint can help.
- Debugging Tools: Become proficient with Python debuggers like
pdb or IDE-integrated debuggers (e.g., those in VS Code, PyCharm).
- Version Control: Use a version control system (like Git) to track changes and facilitate collaboration.
- Documentation: Write clear and concise documentation for your code, including docstrings, README files, and user guides. Tools like Sphinx can help.
- Continuous Integration/Continuous Deployment (CI/CD): Automate testing and deployment to streamline the final stages of the project.
- Don't over engineer: Keep things simple and understandable.
Example:
Imagine you're building a simple Python script to download data from a website:
- 90% (first 90% of time): You quickly write the code to make HTTP requests, parse the HTML, and extract the data. It works!
- 90% (second 90% of time): You then realize you need to handle errors (network issues, invalid HTML), implement retry mechanisms, and maybe support multiple websites. This takes much longer than the initial coding.
- 1%: Finally, you need to add command-line arguments, create a setup script for easy installation, write documentation, and deploy the script to a server. These steps can surprise you with the level of work they require.
In Summary:
The 90-90-1 Rule is a reminder to be realistic about software development timelines. By planning for the often underestimated tasks of debugging, testing, and polishing, and by using good coding practices, you can increase the chances of delivering a successful Python project on time and within budget.