diff --git a/documents/references.md b/documents/references.md index b0a939258a88fa738e1e647e5ca54b09e911b644..45617c2a046c0f823d0db5eb6c652cc573acd854 100644 --- a/documents/references.md +++ b/documents/references.md @@ -55,6 +55,20 @@ During that class, I did a "Graph Isomorphism" project. Project can be found at I tried to reference it minimally, but I definitely did reference it for "automatic naming" and "Visual Graph Display" functionality. +### Nested Classes +A problem I noticed after using this library is that some of the function call names weren't very intuitive/easy to +remember. But short of having a better way to "group" related functions, I wasn't sure how to improve upon this. + +After implementing nested classes in my "Linear Programming" solver project, I realized this issue may be addressed with +nested classes. The logic for using nested classes is fairly close to the original logic, while allowing all node and +edge functions to be grouped together in a (hopefully) more intuitive manner. + +Inspiration came from how Django handles "model query managers" with the "models.objects.<query>" syntax. + +References for how nested classes work are: +* <https://stackoverflow.com/questions/719705/what-is-the-purpose-of-pythons-inner-classes> +* <https://www.datacamp.com/community/tutorials/inner-classes-python> + ### General Class Inheritance <https://www.digitalocean.com/community/tutorials/understanding-class-inheritance-in-python-3> @@ -68,13 +82,6 @@ classes, limiting access to desired child logic. The solution was similar to <https://stackoverflow.com/a/7840956>. The syntax I needed was a bit different, but after some trial and error, the general idea worked. -### Circular Dependency Fix -The Node and Edge classes each import each other, so that they can check that they are being passed values of type -Node/Edge. Unfortunately, this appears to cause a circular dependency, which causes errors when using the standard -`from x import y` syntax. - -More about this, as well as a solution is found at <https://stackabuse.com/python-circular-imports/>. - ### Python "Private" Variables - Single VS Double Underscore <https://stackoverflow.com/questions/6930144/underscore-vs-double-underscore-with-variables-and-methods>