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

Determine a repository-wide policy for argument checking #235

Open
6 tasks
fsaad opened this issue Nov 18, 2017 · 1 comment
Open
6 tasks

Determine a repository-wide policy for argument checking #235

fsaad opened this issue Nov 18, 2017 · 1 comment

Comments

@fsaad
Copy link
Collaborator

fsaad commented Nov 18, 2017

CGPM is written very defensively in that methods throughout perform significant error checking on their inputs (sometimes as assert but typically by raising a ValueError.

Advantages:

  • comprehensible error messages at runtime
  • serve as good reminder of method expectations when revisiting code.
  • can easily test software behavior on unexpected input.

Disadvantages:

  • significant code complexity
  • maintenance cost
  • function call overhead can be non-trivial.

This issue is partly (but not entirely, since we check the relationships between arguments at runtime) related to python being a dynamically typed language. In practice, such problems are typically solved using some form of static analysis and program verification (e.g. predicate transform or abstract interpretation) except I wonder whether how well these tools would work for a complex set of predicates such as especially equality between data structures that are specified only at runtime.

Either way, we need to determine whether CGPM should keep these checks. If yes, it might be worth thinking of some strategies to reduce the complexity of these useful checks.

@fsaad
Copy link
Collaborator Author

fsaad commented Nov 19, 2017

After refactoring significant parts of CGPM d059525 I found the error checking code to be essential in debugging, which makes me lean toward maintaining the current status quo with some improvements that reduce error-checking duplication.

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