Simple Automation Guidelines for Student Developers
Overview
Tired of typing the same things over and over, or making the same mouse movements, whenever you run a test, or push a feature?
As programmers, we can write code to carry out these steps, interactively or non-interactively. The environment in which we run programs is called a shell, and many shells also support some form of scripting.
Common shells and scripting languages
- Windows: Command Prompt, PowerShell, Windows Subsystem for Linux (WSL)
- Mac: Bash, Zsh, AppleScript
- Linux: Bash, Zsh, Python, Perl
You can save your scripts and run/invoke them from the shell/command line, carrying out many steps with a single stroke!
Automation
On your own computer, you can schedule your scripts to run at regular intervals.
On platforms such as GitHub Actions, or Google Cloud Run, scripts can be configured to run on certain triggers.
For example, the NYJC Computing static site has some GitHub Actions configured to test the Markdown files, deploy (publish) them, and synchronize upstream changes to downstream branches.
Key Principles
When creating small to medium applications, automation should help make your development process easier without adding unnecessary complexity.
1. Start Simple
- Automate repetitive tasks like testing and builds
- Keep automation scripts simple and easy to understand
- Focus on time-saving opportunities
2. Maintain Control
- Include ways to run processes manually if needed
- Keep automation optional rather than mandatory
- Document how automated processes work
3. Focus on Development Tasks
- Automate test runs
- Set up simple build processes
- Create basic deployment scripts
- Automate code formatting and linting
4. Test Before Implementing
- Try processes manually first
- Automate only what you understand well
- Start with basic scripts before adding complexity
Best Practices
- Documentation
- Write clear comments in automation scripts
- Document how to run processes manually
- Keep instructions simple and direct
- Testing
- Test automated processes thoroughly
- Have a way to verify results
- Keep test runs simple and focused
- Maintenance
- Review automation scripts regularly
- Update as project needs change
- Remove unused automation
Implementation Tips
- Start with basic task runners
- Use built-in IDE automation features
- Keep scripts in a single, organized location
- Test frequently during development
Remember: For small-to-medium-scale projects, simple and reliable automation is better than complex systems. Focus on automating tasks that directly help your development process.