Search code examples
c++algorithmpath-finding

How To Share Code W/ Other Devs? (And naming)


tl;dr I have code I think others would find useful but don't know how to package it up for others to include in their projects and easily modify.

I'm new to C++ and created an algorithm to solve paths efficiently (enough) for a bot. The algorithm creates the longest path possible within a set of points ("Nodes") with the two limitations being that the Nodes are single-visit only and that the next Node hopped to must be within X distance of the current Node.

After having "finished" the bot (learning exercise) I decided that it would make sense to remove the pathfinding algorithm from the bot and package it up as a more generic and understandable snippet to host on GitHub for others to use.

I'm having an oddly difficult time finding information on how to best construct my "library" - probably because it's really obvious if I were more familiar with C++. I don't want it to be like OpenCV where it's a DLL and my only other example is a .hpp JSON library + the information in the Google Style Guide.

I'm not certain as to whether distributing my code as a Header (with overview + usage documentation) and CPP (with more specific comments) file will result in what I want - which is the JSON .hpp workflow - I simply had to download the file, #include JSON.hpp, and then I was able to call its methods.


<-< PS. How does one name such an algorithm? I'm using a namespace as per the Google recommendations but at the moment that would result in a REALLY long name for devs that aren't #using my namespace.

Google's Styleguide is for a large project - not a single distributed file - so perhaps I should name the GitHub / "official name" something descriptive but give the namespace / project "SVNL" ?

Single Visit Node Linker

Single Visit Node Pathing for Maximum Nodes Traveled Within Distance Between Individual Nodes

Visit Maximizing Node Linker Within Distance Between Individual Nodes


Solution

  • There is no standard way to distribute C++ code, but the easiest way to distribute a small library like yours is to wrap it in a short namespace and post it to GitHub/GitLab/BitBucket/etc.

    I would make sure to include a readme explaining what the project is, how to use it, and how to build it. Bonus points for writing a build script and including it in the repository.