Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Companion Cleanup Suggestion #140

Open
MegaMech opened this issue Jun 14, 2024 · 0 comments
Open

Companion Cleanup Suggestion #140

MegaMech opened this issue Jun 14, 2024 · 0 comments

Comments

@MegaMech
Copy link
Contributor

I'm going to guess this will never happen because it's a lot of work for little gain.

But ParseCurrentFileConfig could probably be split into its own file. And each node entry in it could be split into its own function.

The big main loops (ProcessFile) in Companion could have their contents split into multiple functions as well. This should lead to easier readability because readers could easier see how the control flow works. Example in pseaudo-code:

for () {
   // Lots of code here.
}

Isn't quite as clear as:

ProcessFile() {
  for() {
      SetGlobalVariables(root[":config"]);
      ParseHorizontalAssets(node);
      ParseVerticalAssets(node);
      LoadYamlFiles(files);
  }
}

LoadYamlFiles(files) {
  auto node = files.nodes()
  ParseHorizontalAssets(node);
  ParseVerticalAssets(node);
  ParseResults(currentFile)

}

But alas, this would be a time sink. But you can kinda see that it's easier to understand how the program works at a glance like this. I'd also wonder if we would lose some performance doing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant