question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cleaner function names

See original GitHub issue

There are some common functions that I think could have better names. I’m not a huge fan of shortening commonly-used names when slightly longer names would bring a lot more clarity. Pandas does stuff like pd.read_clipboard, for instance, rather than read_clip.

Here is a short, non-comprehensive list of functions that I think could be improved with name changes (though I can go through and expand if we decide this is worth doing):

  • utils.to_laplace > to_laplacian
  • utils.get_lcc > largest_connected_component (debatable, maybe largest_cc? maybe just lcc would be fine here)
  • utils.get_multigraph_union_lcc and utils.get_multigraph_intersect_lcc > multigraph_lcc with a keyword argument for union vs intersect
  • utils.cartprod > cartesian_product

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
rajpratyushcommented, Jan 25, 2021

Hi All, I would like to work on this issue if this is still open.

1reaction
bdpedigocommented, Jan 26, 2021

With regard to the actual changes that need to be made, all of the functions that @loftusa mentioned are in this file: https://github.com/microsoft/graspologic/blob/dev/graspologic/utils/utils.py. @loftusa any other functions that you think should be changed?

You will need to change:

  • the name of the function in the function signature
  • the name of the function wherever else it appears in the library
  • the name of the function in the corresponding documentation
  • the name of the function in any tutorials, if applicable (I don’t think any of these functions get called in the tutorials but I could be wrong). The tutorials live here

I would recommend trying to use some sort of IDE with a variable naming tool (VS code, for instance) because many of those tools can change a function name throughout the entire library for you. If not, then something like find and replace, but again, would have to make sure to check other files in the library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clean code 101 — Meaningful names and functions - Medium
Classes and objects should have noun or noun phrase names like Customer, WikiPage, Account, and AddressParser. Avoid words like Manager, ...
Read more >
Clean code tips - names and functions - Code4IT
Clean code tips - names and functions · 1: Use consistent names · 2: Keep simple, small functions with meaningful names · 3:...
Read more >
clean_names: Cleans names of an object (usually a data.frame).
clean_names: Cleans names of an object (usually a data.frame). In janitor: Simple Tools for Examining and Cleaning Dirty Data · Description.
Read more >
Clean Code: Naming | Baeldung on Computer Science
In this tutorial, we're going to take a look into naming. Naming is a crucial and daily task for developers in any programming...
Read more >
Method and function names - Clean Coding Practices - LinkedIn
[Instructor] Let's look at the rules for crafting cleanly named functions and methods. This file contains a bunch of example method names in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found