3 ms·
> We define importance as those files which are directly or indirectly depended upon the most by other files in the codebase. I honestly would have expected th
by bjornsing 4y ago
> We define importance as those files which are directly or indirectly depended upon the most by other files in the codebase.
I honestly would have expected the opposite definition. Maybe I’m kind of old school, but in a well-architected large c-program for instance, “main.c” tends to depend (directly or indirectly) on every other compile unit, while there are no dependencies in the other direction. And I think “main.c” should be seen as “important”.
Why would this not be true for JavaScript or typescript?
- Jensson 4y agoIf you are looking for a utility function then it will likely be found in a file that is imported in many other places. So intuitively this would be a reasonable way to rank files/search results when you are looking for something to import.
- dack 4y agothey mentioned using it to add types to a javascript project. i can see why you'd start by adding types to the files that are most used first
- CapsAdmin 4y agoI agree, but seen through the lens of wanting to clean up a codebase this seems useful. It's stated in the second paragraph on github that it's specifically useful for converting javascript to typescript as well. If you have a messy large c-program with the intention of cleaning it up, would you say main.c is the most important file? I think it's an interesting idea that could work on top of this utility to give you an overview of how messy the dependency graph of a project is.
- ape4 4y agoIf lots of functions depend on main.c then you have a problem ;)
- atwood22 4y agoAnother example is interface usage. You may have a commonly used interface with only one implementation. The implementation is the important part, but almost no usage depends directly on the implementation.
- yodon 4y agoIf you are looking to introduce types into an untyped codebase, as this project talks about, then you probably don't have a lot of interfaces defined, and if you do have things in your untyped codebase that are loosely analogous to interfaces from a decoupling standpoint (such as facades and factories) then this approach would advocate those are sensible areas to focus your initial typing efforts.
- noveltyaccount 4y agoI think I'm reading this opposite from you. `main.c` depends upon everything else, but is not depended upon by anything else. A file like `datatypes.c` might be depended upon by multiple tiers of the application and be referenced by dozens of files, making it have a high pagerank.
- mike_hock 4y agoMight be useful to navigate an unknown codebase. If you know the codebase already, you should know what forms the core that everything else depends upon. The term "importance" might also be slightly misleading. What's more important, the engine or the transmission? The car needs both to drive.