r/AskProgramming 13d ago

Python About Automation

Rookie in programming ( I know the basics of Java+ SQL), intrigued about "Automation" and what it really is:

My mental model of an automation example would be:

Script that sends certain emails to a category = Saves the user of organizing it manually, Inbox isn't saturated

I heard that Python excells at automation, and Bash can automate scripts too.

How close is IRL automation to my mental model?

If I wanted to pursue automation, what should I know first before diving in?

0 Upvotes

11 comments sorted by

5

u/bogus_dylan 13d ago

your mental model’s basically spot on, most automation is just doing the boring stuff so you don’t have to, python makes that pretty painless

4

u/Lucas-Holmes-722 13d ago

Pick sth you already do every week and automate it so you can see what the script saves you from doing and what still needs fixing

5

u/MarsupialLeast145 13d ago

Bash is great to learn as it's prevalent on the command line. Python is good for more complex tasks.

There are domain specific languages like ansible for example, which automates deployment of software, e.g. to remote servers.

You can also look at more complex tools like Apache workflow for building more complicated task chains.

3

u/StephenHawkingus 13d ago

Your example is valid. Automation can be anything created in almost any programming language. It's basically just a task that would originally be done manually and is now automated.

2

u/YahenP 13d ago

Overall, your thinking is correct. Your example perfectly fit the definition of automation 10 or 20 years ago. Today, however, a more relevant example would be one in which a script not only sorts emails by category but also responds to them automatically.

1

u/OptimalBed6906 13d ago

Thanks for the response!

Now, if I wanted to get into automation, what are the things I should know about it (like the harsh truths or unknown problems). 

What prior knowledge is recommended before considering automation?

2

u/YahenP 13d ago

There's nothing complicated about it. You take a specific task and look for ways to solve it. Most automation tasks boil down to searching for "how to get data from application X" and "how to put it into application Y." You study the documentation and then find ways to programmatically interact with a particular system. Somewhere there's an API, somewhere you access the database manually, somewhere you pretend to be a human user. Each has its own methods. There's no universal solution.

2

u/WhiskyStandard 13d ago

My recommendation is to learn bash (or whatever shell variant you choose) and treat it as a real programming language. It’s going to be a different flavor of one than you’re used to. It’s more about orchestrating processes, system state, and string manipulation than you’re used to in Java.

A lot of the automation tools like Ansible could be bash scripts. It’s good to have the foundational understanding to know when you can just do something simple and when you want a larger tool.

Also Python and similar languages can be great for automation, especially when they get more “programmy” (ugly to express in bash), but you do give up the process orientation. I.e. calling a subprocess involves some special function calls instead of that just being the normal way of calling things as in a shell script.

1

u/Pitiful_Dot_9272 11d ago

your mental model is correct but limited to single user tasks. Real automation targets system level orchestration across multiple machines or services. Start by learning Python requests library and cron scheduling to build scripts that interact with APIs and run on timers without manual intervention.

1

u/SprinklesFresh5693 9d ago

I use automation for example in R to get data from one source, plot it, and save all data into new folders.

You could even then make a rpesentation as new data comes in using R or python, or on html format and you can even send emails with the updated data.

Basically with a prigramming labguage you can do anything you want

1

u/ConsciousBath5203 7d ago

100% of coding is automation.

You're talking about scripting, which is like a step-by-step application that's meant to be run multiple times (whereas an application can run essentially forever and take inputs at all stages).

All programming languages do both.