
Programmers Should Automate More - shubhamjain
https://shubhamjain.co/2017/05/06/why-programmers-should-automate-more/
======
Derbasti
But where are the tools? Of course I can always write a shell script, but the
vast majority of GUI tools is not programmable.

I would love to automate my image capturing workflows, my tax filing, my
invoicing, my calendaring, my contacts, and SO many other things. But most
tools are not scriptable. They are sealed, proprietary binaries that I can't
interact with.

Conversely, I love tools like the shell, Emacs, and programming tools in
general, _because_ I can automate them. I can automate testing, compiling,
generating reports... And if something is not built-in, these tools provide
hooks and APIs to extend their functionality for my particular use cases.

In fact, we can already see the impact of smartphone-only students on their
ability to grasp and automate complex workflows. The fact that mobile apps are
largely non-composable and non-programmable seems to seriously limit students'
abilities in general digital problem solving.

~~~
flukus
As someone with some potential admin work coming up, can anyone recommend some
good cli tools for office work? I'd love to be able to take a word/libreoffice
template and generate a document by supplying command line parameters for
example.

> In fact, we can already see the impact of smartphone-only students on their
> ability to grasp and automate complex workflows. The fact that mobile apps
> are largely non-composable and non-programmable seems to seriously limit
> students' abilities in general digital problem solving.

Computers became so easy to use that no one learns how to use them. It's no
wonder grandma always opens that attachment with an exe extension, file
extensions have been hidden for as long as she's used computers, she doesn't
know what the convey.

Teaching kids to code is the latest fad but I think the majority of them would
be much better served learning some basic bash scripting and related unix
tools.

~~~
Immortalin
Visual Basic for Applications. The Red programming language.

~~~
flukus
Is VBA good from the command line? I did a course on it ~10 years ago but it
was always used from within applications.

~~~
ojosilva
Yes, you can run VBA from VBScript, Perl, etc. Basically any scripting
language that can instantiate ActiveX VBA automation.

[http://stackoverflow.com/questions/2050505/way-to-run-
excel-...](http://stackoverflow.com/questions/2050505/way-to-run-excel-macros-
from-command-line-or-batch-file)

[http://stackoverflow.com/questions/27613878/list-of-perl-
com...](http://stackoverflow.com/questions/27613878/list-of-perl-commands-to-
manipulate-windows-excel-with-win32ole-module)

------
jitl
This is the whole promise of UNIX. Do something once? Write a shell on-liner
at the console. Do it a second time? Save your one-liner to ~/bin or as a
shell function in your .${SHELL}RC. Need something more complex than a one-
liner? Grab Ruby or another "loose" language that adds some sanity -- but
importantly not too much.

When you build tools, try to add options to make my tools more flexible and
amenable to scripting. Options like -z, to separate records on STDOUT with
NULL, or having a trailing -- read input from STDIN, make tools much easier to
script.

~~~
pjmlp
Shells and automating work were already a thing before UNIX was created.

~~~
flukus
Did anyone else have the pipes and streams system that tied everything
together?

~~~
gumby
Like so many things in Unix they came from Multics, although Unix originally
didn't have them.

~~~
enqk
The officially known story is that pipes originated with Douglas McIlroy and
they were implemented under that name in Unix by Thomson.

~~~
gumby
That may be the official story but I can tell you as a onetime Multics
programmer, Multics definitely had pipes and as we all know Ken T worked on
Multics before going back to Bell Labs.

------
taneq
This is gonna sound funny, but once way to train yourself to do this is
playing Factorio[1]. Virtually every new thing you can build starts off as
"that's a pain, I'll just make it manually" and rapidly graduates to "oh I
need 5000 of them." You learn to just build at least a minimal production line
for _everything_.

[1] [https://www.factorio.com/](https://www.factorio.com/)

~~~
thecatspaw
and suddenly its 2 days later and you have 5 messages from your boss askin why
you havent come into work

~~~
elygre
Surely you have an email agent to deal with that?

~~~
falcolas
Yup. It feeds into a light array with combinators. Sadly, I "forgot" to
incorporate that into my latest power grid, so it's constantly dark.

------
vinceguidry
The first and second times I do something, I do them manually. The third time,
I create a repeatable procedure that I execute manually. The third time I use
that, I start writing scripts to take bites out of the time it takes.

Around the 30th or so time I have to do it, there's no point to automating any
further. But I've learned that automating to the point where you can put it on
a cron job is usually just not worth it. You haven't yet squeezed out all the
failure cases. If you could have completely scripted it and put it on a cron
job you would have done it at the beginning.

Usually when I find myself doing this, I'm doing it in response to emails that
have been sent with spreadsheets. It's a huge time pit to automate that the
first time you get one. You just don't know what they're going to keep sending
you each month, and you feel like such an asshole nagging them about it. Just
make a note in your procedure, and use an error to detect the case when you
finally script it.

~~~
tome
I really like this approach. Automating incrementally is solid engineering
practice.

------
SeriousM
Another great tool is Everything
[https://www.voidtools.com](https://www.voidtools.com) for Windows.

It's searching files with an ease that you start question yourself why windows
search is so fucking retarded

~~~
copperx
Everything doesn't index file contents, which makes the problem of searching
significantly simpler. It does require the human to remember filenames.
Offloading the problem to the user isn't the greatest idea.

~~~
ghusbands
You may be underestimating how bad Windows Search is - finding files by name
is something it is inordinately slow at, and Everything is a good solution.

------
tmikaeld
While Lightshot Screenshot is great, it cannot upload screenshots to other
services than prntscr.com and that makes it unsuitable for sensitive
information.

So far I've only found Greenshot that is cross-platform and let you choose
where to save the screenshot (It's also open source).

~~~
omegote
For Windows I use ShareX, which is also open-source but not cross-platform.
It's incredibly feature-packed.

~~~
anotheryou
It is sooo good. And I can also paste markdown to my ftp and get the url for
the parsed html back (markdown needs to be parsed by my server still).

------
janwillemb
I think a lot of programmers (and many other professions) can speed up a lot
by learning how to type properly with 10 fingers.

------
vfclists
This is what Smalltalk and Lisp workstations promised and went some way into
accomplishing, but they have never been built into the current generation of
desktops like Linux and Windows.

We even have Emacs where everything is configured with elisp. The current
problems come from building on the wrong foundations. The whole desktop
paradigm and OS paradigm needs to be rebooted, and sure as hell the impetus
will not come from Microsoft, Apple or Google, who seem to be entrenching sub
par practices.

------
vanous
imacros [1] for firefox has been great for automating long tasks and can also
be used on sites, that generate html elements with dynamic ID (for example
typo3 backend). Together with csv files, it's excellent. I spent two days to
find it, so you don't have to :))

[1] [https://addons.mozilla.org/en-US/firefox/addon/imacros-
for-f...](https://addons.mozilla.org/en-US/firefox/addon/imacros-for-firefox/)

------
scandox
The problem for me is in properly estimating the time it will take to automate
a particular task. I often underestimate the time it takes to do it well
enough to cover all the cases I would handle intuitively.

Usually though I never regret it - once it is done. But at the time putting a
day or two dent in my schedule makes me pretty cross.

------
irrational
My coworker has that XKCD comic on the wall. He spends so much time trying to
figure out what is worth his time to automate that all potential time savings
are negated.

~~~
flukus
I think the comic undersells the value of automation, there are documentation
and accuracy benefits as well, not to mention they can often remove a lot of
mental context switching.

~~~
mjw1007
I agree.

Two other effects which are often large:

First: suppose a task takes an hour and I do it once a month. If I can
automate it so that it takes a few seconds, I don't just save an hour a month,
I also have the option of doing it much more frequently.

Second: once a task has been automated it can become a building block for
other tasks which I previously wouldn't have considered.

~~~
tome
Somewhat related to
[https://en.wikipedia.org/wiki/Jevons_paradox](https://en.wikipedia.org/wiki/Jevons_paradox)

------
jason_slack
The author mentioned starting a static web server in any folder. I'd be
interested in Windows solutions for this. I usually just run Apache and vhosts
on my Windows laptop.

------
known
[https://en.wikipedia.org/wiki/Paperless_office](https://en.wikipedia.org/wiki/Paperless_office)

