Playing around with the FOSS game Cataclysm DDA, I felt compelled to parse and connect the CPP and JSON to see relationships and complexity. It’s the first time I’ve really felt motivated to do so. I’m just trying to wrap my head around how some features are implemented like z-levels, mining tools and various actions; simple stuff really. I find it challenging to parse something quite this large, so I started scripting a way to track down objects across the code base to see what is defined in JSON and what is hard coded. Normal? Obvious? FOSS alternatives to do this? I’m basically chaining a bunch of grep commands to print pretty trees with bat.

13 points
*

Even better: do a git history of certain files to get a broad sense of history and understand it’s evolution.

I highly advise this practice for familiarizing yourself with parts of a codebase you may otherwise not know anything about. Interesting commits you should git show.

Though combining this with scripting would also be interesting. 🤔

permalink
report
reply
11 points

I usually just use VS Code to do full-text searches, and write down notes in a note taking app. That, and browse the documentation.

permalink
report
reply
9 points

The code is my bible, the grep is my friend.

That and breakpoints.

permalink
report
reply
1 point

this but ack

permalink
report
parent
reply
9 points

This is a really neat idea. I’m frequently put off by large highly distributed (among files and dependencies) codebases with no obvious entry point. I wanted to make some changes to GNU’s mailutils and the code felt genuinely incomprehensible (BSD’s implementation of mail was a bit easier).

Perhaps another approach is to parse ptrace.

permalink
report
reply
8 points

To grep is to grok.

I have a grepconf alias for a find-grep loop on my nixos config that comes in handy. Treesitter can be a godsend too.

permalink
report
reply

Programming

!programming@programming.dev

Create post

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



Community stats

  • 3K

    Monthly active users

  • 1.7K

    Posts

  • 28K

    Comments