News for hackers. Stuff that matters.
Re:Cognitive loads in programming by AceJohnny2 on Wednesday August 31, 2022 @06:38PM (#32669252)
Offtopic:

I'm saddened to see YAML get a bad rap for effectively being shoehorned to fit a task that it's just bad at.

In my experience, YAML is a great format for legibly declaring a dict/array structure, with added benefits over JSON like anchors/references (effectively pointers, which thus allow it to describe a graph), comments, and overloads (great for defaults!).

But YAML has no facilities for conditionals, loops, or any logic. So these get tacked-on, ad-hoc, by systems that need them, and that pulls YAML towards Greenspun's Tenth Rule ("Any sufficiently complicated [system] contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp")

I'm glad better languages like Dhall exist for the problem-space that YAML is just not designed for.

Re:Cognitive loads in programming by wyuenho on Wednesday August 31, 2022 @10:21PM (#32671105)
I'm saddened to see people complaining about YAML when it's actually Helm and Jinja and treating configs files as plain text file like it's still the early 2000s that are the problem. In my experience, syntax tree based composition tools like kustomize solves much of the problem for me. I appreciate this is sorta kinda new for devops people, but come on, this idea has been around for decades.
Re:Cognitive loads in programming by smitty1e on Wednesday August 31, 2022 @09:57PM (#32670918)
My grief is seeing YAML/JSON browbeaten past being static textual files, and into being interpreted files with nasty embedded functions (looking at YOU, CloudFormation).

My latest project is gaffing all that off and using .xlsx to hold configuration, openpyxl to load the .xlsx, and then transforming the content into a target format (terraform) in the python.

Let each piece in the system do what it's good at.

Re:Cognitive loads in programming by Octabrain on Thursday September 01, 2022 @10:26AM (#32676702)
> Let each piece in the system do what it's good at.

Althought I strongly dislike the idea of introducing Excel in any equation, I wholehearthly agree with that quoted statement of yours. However, if I were you, I would use csv format. It can be easily read/edit from Excel if that's a strict requirement, and in that way, you can keep a grepable plain text versioned in the repository (the csv itself). The best of two worlds I guess. Also, from the top of my head, the Python standard library has a module for reading CSV, so less dependencies too.

Re:Cognitive loads in programming by chii on Wednesday August 31, 2022 @10:52PM (#32671331)
> using .xlsx to hold configuration

what the?! I would imagine that .xlsx is even worse than a plain text file for holding configuration. You have to open it with a spreadsheet editor, and how would you diff a binary format when committing into source repository?

Re:Cognitive loads in programming by smitty1e on Wednesday August 31, 2022 @11:50PM (#32671727)
Git does binaries.

Excel is on the desktop, and ot has diffing tools.

This is a work project, not something for regular GitHub release.

Re:Cognitive loads in programming by Gigachad on Wednesday August 31, 2022 @10:50PM (#32671312)
If you need all of those features I think the best way is to just define objects in TypeScript. You have the full power of a real and well understood language then.
Re:Cognitive loads in programming by rpeszek on Thursday September 01, 2022 @06:11PM (#32684020)
About YAML, I like YAML too, only not so much for 5K+ configuration lines.