this post was submitted on 22 Feb 2025
61 points (98.4% liked)

Programming

18348 readers
171 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
top 14 comments
sorted by: hot top controversial new old
[–] Ephera@lemmy.ml 2 points 5 hours ago

I like the idea, but I wouldn't really know how to put it into practice. It works quite well, if you're using Python to automate, but if you're using more dedicated tooling for CI/CD automation (à la Ansible, Puppet etc.) then those tend to not really have a way to pause execution until a user input happens. It's kind of anti-thetical to their end goal...

I guess, you could have a Python or Bash script, where each function just calls an Ansible task and once you've automated a chunk, you replace that with an Ansible playbook. But yeah, really not sure, if that's terribly sexy in practice.

[–] talkingpumpkin@lemmy.world 25 points 21 hours ago (2 children)

TLDR:

What the author baptizes "do-nothing scripts" are interactive scripts that print out the steps of some procedure one by one and wait for you to confirm each step (eg. "1. do this. press enter when done" "2. do something else. press enter when done" and so forth).

PS:

@OP (if you are the author)

I HATE those sites where popups come up when you are halfway reading something.

What's the idea behind it, besides annoying your users as much as possible?

[–] learnbyexample@programming.dev 1 points 8 hours ago

Not my site, just sharing a link I saw on HN.

[–] alnitak@lemmy.dbzer0.com 6 points 16 hours ago

They kind of glossed over the real value, which is using it as a template to automate a step at a time:

"Each step of the procedure is now encapsulated in a function, which makes it possible to replace the text in any given step with code that performs the action automatically."

It breaks the work down into more manageable tasks. I probably wouldn't give it to users until it was done, but putting placeholder functions is a common strategy.

[–] _____@lemm.ee 6 points 18 hours ago (3 children)

I have nothing to add except: man's really wrote like 7 classes to just have 1 function each

[–] Ephera@lemmy.ml 1 points 5 hours ago

Yeah, I'm really wondering why they thought this was a good idea. My best guess is that they want to keep everything within one file, since it makes the script easier to deal with. But when automation actually starts being implemented, they want the functions for each task to be grouped (and I believe, Python doesn't support inline modules), so they ~~ab~~use classes for that...?
Well, and I guess, it allows them to have pseudo-constants within each task, which don't need to be explicitly passed around between functions.

But yeah, really not a fan of needing this much boilerplate to start out with. In my opinion, the activation energy required to use this pattern instead of slapping down documentation needs to be as minimal as possible, otherwise folks will slap down documentation instead.

[–] bitcrafter@programming.dev 11 points 17 hours ago (1 children)

That is what makes it Enterprise-grade!

[–] _____@lemm.ee 4 points 16 hours ago

Honestly, if they want to go full enterprise at least use the javabeanfactoryfactoryfactory pattern

[–] alnitak@lemmy.dbzer0.com 3 points 16 hours ago* (last edited 16 hours ago) (2 children)

It's probably to allow for added complexity as they expand on each task. Makes it simpler to import elsewhere too.

[–] Ephera@lemmy.ml 1 points 6 hours ago

I would very much argue that you shouldn't add complexity unless you actually make us of it. Them all using a uniform structure doesn't help readability nearly as much as just not having the complexity...

[–] _____@lemm.ee 10 points 16 hours ago

"grug try watch patiently as cut points emerge from code and slowly refactor, with code base taking shape over time along with experience. no hard/ fast rule for this: grug know cut point when grug see cut point, just take time to build skill in seeing, patience

sometimes grug go too early and get abstractions wrong, so grug bias towards waiting

big brain developers often not like this at all and invent many abstractions start of project

grug tempted to reach for club and yell “big brain no maintain code! big brain move on next architecture committee leave code for grug deal with!”

https://grugbrain.dev/

[–] kibiz0r@midwest.social 7 points 20 hours ago

Pretty nice way to bridge the gap between documentation and automation.

It’s an interactive checklist.

[–] balder1993@programming.dev 2 points 21 hours ago

That’s a very nice idea, and something I’ll definitely implement for some annoying tasks in my company.