"Do-nothing scripting" advocates for a gradual approach to automation. Instead of immediately trying to fully automate a complex task, you start by writing a script that simply performs the steps manually, echoing each command to the screen. This allows you to document the process precisely and identify potential issues without the risk of automated errors. As you gain confidence, you incrementally replace the manual execution of each command within the script with its automated equivalent. This iterative process minimizes disruption, allows for easy rollback, and makes the transition to full automation smoother and more manageable.
Dan Slimmon's 2019 blog post, "Do-nothing scripting: the key to gradual automation," advocates for a measured, iterative approach to automating tasks, termed "do-nothing scripting," which prioritizes building trust and understanding before implementing full automation. Instead of immediately replacing a manual process with a fully automated script, the author suggests starting with a script that merely documents the existing manual steps. This initial script acts as a passive observer, mimicking the human operator’s actions by printing the commands that would be executed, without actually executing them.
This "do-nothing" phase offers several crucial advantages. First, it forces the developer to meticulously document each step in the process, revealing often overlooked nuances and edge cases. This thorough understanding is critical for building robust automation later. Second, it allows for gradual introduction of automation, building confidence in the script's accuracy and reliability. As confidence grows, individual commands can be switched from "print" to "execute" one by one, effectively transitioning the script from passive observer to active participant. This gradual transition allows for continuous testing and validation at each stage, minimizing the risk of unforeseen errors and disruptions.
Slimmon illustrates this concept with a concrete example of automating server setup. Initially, the script merely prints the commands required for tasks like installing packages, configuring settings, and creating users. As the script is repeatedly used and validated, individual commands are activated, gradually automating the process piece by piece. This allows the user to verify the correctness of each automated step before proceeding further.
The post emphasizes the importance of this "trust-building" phase, particularly in scenarios involving critical systems or complex procedures. By starting with a do-nothing script and incrementally adding automation, developers can ensure a smooth transition, reduce the risk of errors, and build confidence in the automated process. This approach not only streamlines automation but also serves as valuable documentation, fostering a deeper understanding of the underlying system and facilitating future modifications and troubleshooting. The author concludes by highlighting the benefits of this method in terms of reduced stress, improved maintainability, and the ability to tackle automation projects incrementally, making seemingly daunting tasks more manageable and ultimately leading to more reliable and trustworthy automated solutions.
Summary of Comments ( 81 )
https://news.ycombinator.com/item?id=42976698
Hacker News users generally praised the "do-nothing scripting" approach as a valuable tool for understanding existing processes before automating them. Several commenters highlighted the benefit of using this technique to gain stakeholder buy-in and build trust, particularly when dealing with complex or mission-critical systems. Some shared similar experiences or suggested alternative methods like using
strace
ordtrace
. One commenter suggested incorporating progressive logging to further refine the script's insights over time, while another cautioned against over-reliance on this approach, advocating for a move towards true automation once sufficient understanding is gained. Some skepticism was expressed regarding the practicality for highly interactive processes. Overall, the commentary reflects strong support for the core idea as a practical step toward thoughtful and effective automation.The Hacker News post titled "Do-nothing scripting: the key to gradual automation (2019)" has a healthy discussion with several compelling comments. Many commenters agree with the author's core premise – that starting with a "do-nothing" script that simply logs intended actions is a valuable first step in automating a task. This approach allows for careful observation and refinement before introducing actual changes, reducing the risk of errors and unintended consequences.
Several users share their personal anecdotes and experiences that reinforce the article's points. One commenter describes using this technique for database migrations, emphasizing how it helped catch edge cases and build confidence before executing the real migration. Another commenter mentions using a similar strategy for refactoring, starting with logging and gradually introducing changes, highlighting the importance of observability and testability during the automation process.
Some comments discuss specific tools and techniques related to "do-nothing" scripting. One user suggests using the
tee
command in Unix-like systems to simultaneously log actions and execute them, offering a smooth transition from the "do-nothing" phase to full automation. Others mention tools likeauditd
for system-level monitoring and various logging libraries in programming languages.A few commenters offer alternative perspectives or extensions of the core idea. One comment highlights the importance of human review even with automated systems, suggesting that the logged output from a "do-nothing" script could serve as valuable documentation for future reviews. Another comment emphasizes the psychological benefit of starting with a small, working script, which can help overcome inertia and build momentum for larger automation projects. There's also a discussion around the benefits of this approach in team environments, as it allows for collaboration and shared understanding of the automation process.
A recurring theme in the comments is the value of observability and gradualism in automation. The "do-nothing" scripting approach is presented as a practical way to achieve these goals, allowing for iterative development, testing, and refinement of automation scripts while minimizing risks.