Live data from Hacker News

Do-nothing scripting: the key to gradual automation

blog.danslimmon.com

81–90 of 126 posts

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

#81
post #43

Earlier quoted context omitted.

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

Well... that is certainly correct in 99.99% of cases. But does it really apply when you write a "Do Nothing Script"(!) with the intention of automating the steps later? If you follow the "rules" to the end you just end up deleting the file after writing it, because it has no effect.

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

#82
post #81
post #43

Earlier quoted context omitted.

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

Well... that is certainly correct in 99.99% of cases. But does it really apply when you write a "Do Nothing Script"(!) with the intention of automating the steps later? If you follow the "rules" to the end you just end up deleting the file after writing it, because it has no effect.

Only if your intention encompasses as much detail as you're leaving out in advance. It's baggage and comes with nigh certainty of wasting your willpower.

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

#83
post #53

Earlier quoted context omitted.

You can do automation incrementally, but it's quite a different mindset to automate computer than to write a checklist for humans. If you try to emulate a person with a checklist, then you will often find it is actually harder to automate, because the steps often rely on human adaptability and common sense.

What other approach do you suggest, then, in the extremely common scenario where you have an existing, tedious yet reliable multi-step manual process, and you’d like to automate it?

I think you just have to look at the process and consider why is it being tedious. Is there anything specific humans do? Often there are many small decisions hidden in the checklist.

The second thing I would do would be to make sure that the automation happens in a "clean" environment, or at least, there is a clear boundary. Humans can adapt to changing conditions and have no issues to adapt the checklists where circumstances are a bit different.

IMHO the key part to creating automation is to make sure you operate in environment that you can fully control. You can avoid a lot of trouble with emulating the decisions that humans need to take if you just create environment where the machine doesn't have to make the decisions.

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

#84
I have a script in our automation setup called "be-the-change" which takes either markdown or a wiki url as a parameter. It will output the markdown or wiki content, wait for the user to confirm they've completed the steps and then print:

Doing manual steps sucks, wouldn't it be great if this was automated for the next person? Be the change you want to see in the world.

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

#85

Combined with the concept of literate programming this would also help capture the "why"s of the slog, resulting in inline documentation. Jupyter and org-mode for the win!

Running such a checklist in Jupyter seems like a very good approach.

The big advantage is someone else can pick up from where you started.

And reporting is built in as you can save the notebook and review it later.

The only thing it lacks is control flow. A good operations script has exit points: if an operation fails, you often want to rollback and abort. Though even there, you can save state in a variable and have a check.

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

#86
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?

> Do not put code in your program that might be used. Do not leave hooks on which you can hang extensions. The things you might want to do are infinite; that means that each has 0 probability of realization. If you need an extension later, you can code it later and probably do a better job than if you did it now. And if someone else adds the extension, will he notice the hooks you left? Will you document this aspect of your program?

From http://wiki.c2.com/?PrematureGeneralization

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

#87
post #35

Earlier quoted context omitted.

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

This should be read in conjunction with this other great article about how to gradually automate your process: https://queue.acm.org/detail.cfm?id=3197520

This is a great article, providing even more context for why this stepwise automation is smart.

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

#89
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

My face fell when I saw the code. I will actually henceforth use this as an example of this anti-pattern.

Whether or not the author was a Java programmer shouldn't matter - I think one should try to writing idiomatic code in any language, unless there are reasonable reasons against it.

Post reply on HN