Live data from Hacker News

Do-nothing scripting: the key to gradual automation

blog.danslimmon.com

41–50 of 126 posts

Re: Do-nothing scripting: the key to gradual automation

#41
post #39

I know this isn’t the point of the article but the code shown there is the archetypal case where writing classes is an anti-pattern, as argued in “Stop Writing Classes” [1]. All the classes in that code can — should! — be functions. There’s no downside, and it’s less code (and otherwise identical). [1] https://news.ycombinator.com/item?id=3717715

You will tire yourself out long before you change the minds of many SAs when it comes to code quality.

They're a breed with a very strong sense of "It works so I don't care", and honestly I don't really blame them.

Re: Do-nothing scripting: the key to gradual automation

#43
post #39

I know this isn’t the point of the article but the code shown there is the archetypal case where writing classes is an anti-pattern, as argued in “Stop Writing Classes” [1]. All the classes in that code can — should! — be functions. There’s no downside, and it’s less code (and otherwise identical). [1] https://news.ycombinator.com/item?id=3717715

maybe he was a Java programmer? all joking aside, the reason he's doing classes seems to be an intention towards making a FooStep (and/or a BarStep) which could then maybe handle generic Foo stuff (authentication comes to mind) in the future?

"maybe"..."in the future" is the root of much object oriented evil

Re: Do-nothing scripting: the key to gradual automation

#44
post #39

I know this isn’t the point of the article but the code shown there is the archetypal case where writing classes is an anti-pattern, as argued in “Stop Writing Classes” [1]. All the classes in that code can — should! — be functions. There’s no downside, and it’s less code (and otherwise identical). [1] https://news.ycombinator.com/item?id=3717715

maybe he was a Java programmer? all joking aside, the reason he's doing classes seems to be an intention towards making a FooStep (and/or a BarStep) which could then maybe handle generic Foo stuff (authentication comes to mind) in the future?

YAGNI

Re: Do-nothing scripting: the key to gradual automation

#45
I'd go farther... you can have steps that literally "do nothing". They can be comments, or simple echo statements. They're placeholders to remember to write the code for that step later. This is particularly important when you need to deal with integration that isn't necessarily easy - handling auth credential safely, making sure it works in your pipeline, etc.

But all this gets back to something I used to say a lot, and the more refined version I say now. I used to say "Have humans do what humans do well; have computers do what computers do well". The key part of that was the idea that computers can't do what humans do. Now, I say "Anything a computer can do well, a human cannot do well". Which includes those pesky twenty step manual processes.

Re: Do-nothing scripting: the key to gradual automation

#46
post #39

I know this isn’t the point of the article but the code shown there is the archetypal case where writing classes is an anti-pattern, as argued in “Stop Writing Classes” [1]. All the classes in that code can — should! — be functions. There’s no downside, and it’s less code (and otherwise identical). [1] https://news.ycombinator.com/item?id=3717715

There's a decent python library for these kind of things - https://www.fabfile.org/ (amongst others)

Allows you to do both local and ssh based interactions

Re: Do-nothing scripting: the key to gradual automation

#47
post #14
post #12

Seems basically to be a checklist. However, I don't think it's a good idea. Checklists are not bad, but they are to be executed by humans. I think trying to automate an existing human process directly is a mistake. Human processes often have features that only humans can do, such as pattern recognition or adapting to small difference. It's often easier to create a computerized (automated) process from scratch than to…

>Checklists are not bad, but they are to be executed by humans. I disagree. People employ checklists precisely in the situations where it is most critical that every step be executed, in order, as written. The airline industry flies on checklists. >I think trying to automate an existing human process directly is a mistake. Human processes often have features that only humans can do, such as pattern recognition or ada…

> People employ checklists precisely in the situations where it is most critical that every step be executed

I am not arguing against checklists per se. At work, I work on (a rather old) software product which also largely runs on checklists. (Various installation and maintenance procedures are described by a checklist.)

> Now, you're letting perfect prevent you from ever attempting the good.

No. I just, based on my experience with checklists, argue that they are often poor starting point. Often they rely on abilities of humans to execute them properly.

For example, the checklist might read "edit this text file and add this and this line after line that is like this". This is difficult to automate correctly - the proper way might be perhaps to generate or keep a correct copy of the text file so automation can pick it up.

Humans are good at adapting checklists for the purpose at hand, computers aren't. That makes (human-oriented) checklists somewhat difficult to automate.

Re: Do-nothing scripting: the key to gradual automation

#48

This idea is great. You could even argue that these scripts actually do something: they allow storing and updating the state of a process. By having these scripts run in a shell rather than in your head, the current state is stored in a machine, not in an unreliable human brain.

also they allow you to gradually script stuff as you figure it out.

this seems like the real magic here. The author states at the start, automating all of the steps of something can be daunting. But this script can incrementally become a do everything script.

Re: Do-nothing scripting: the key to gradual automation

#49
This feels like a useful concept.

I stumbled into doing roughly the same in my macOS system bootstrap script. I found it from the other side, though--usually only after failing to find a good way to automate a step, or realizing automation would be vastly more complex/fragile than just prompting myself to do something manually at the right time.

Probably a more useful concept when it's conscious from the getgo. :)

Re: Do-nothing scripting: the key to gradual automation

#50
post #25

Is anyone else bothered by how they were handling ssh keys in the example? The whole point of public keys is that the private key never has to leave the box it’s generated on. Once you go sharing them you might as well just use a random passphrase.

Yes, very much so. In addition stop using RSA[0] and use ed25519 with `ssh-keygen -t ed25519` [0]: https://blog.trailofbits.com/2019/07/08/fuck-rsa/

Unless you're using a hardware token via gpg-agent. In that case RSA is the only way most of the time.
Post reply on HN