DEV Community

Ross-Li
Ross-Li

Posted on

Don't "Trust" GitHub Code Just Because It's Got Lots Of Stars

I was reviewing data structures and algorithms for interview prep. So I went on GitHub and find this organization TheAlgorithms and its repo collecting data structures and algorithms in many different languages. It was a treasure for sure, but I also find some code that looks really terrible to even a amateur like me: bad function naming, confusing class organization and some other heavy code smells. Although it was some good material for a foundation to modify with and it could be regarded as some OK refactoring practices, it was a bit annoying to refactor the code that was kinda supposed to be polished.

The message of this story is that you should not take code from GitHub as good, finished, polished code, especially when the code is from (below are my hypothesis):

  1. "Hot" repos that got a lot of stars, not necessarily because it is widely used but because it is a "resource collection" and people just "wishlist" it by starring (e.g. the "awesome" series of repos).
  2. Non-production code base or code base for educational purposes

Top comments (7)

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

"Stars" on GitHub are a bookmarking feature, nothing more. They should never be taken as an indicator of 'quality'. I've starred more than one project to use as examples of bad code and anti-patterns. I also often star things to look at later - which I may or may not do.

Collapse
 
rossli profile image
Ross-Li

Indeed. However I have seen some (promotional) blogs in which the authors wrote things like "repo with 10K stars on GitHub", which can be misleading beginners to believe that the number of stars represents its credibility and quality of its code. I guess it's just like "likes" in social medias: a post with a lot of likes doesn't mean it's a post of great importance or meaning.

Collapse
 
moopet profile image
Ben Sinclair • Edited

Extending this - regardless of what stars represent to us, popularity should not be taken as an indicator of quality.

There's a language issue (which I have had a post in draft about for years now) which comes from distinctions like Netscape using "bookmarks" and Internet Explorer using "favorites" and the world conflating the two.

Thread Thread
 
jonrandy profile image
Jon Randy 🎖️

popularity should not be taken as an indicator of quality.

Very true, just look at Windows [ducks]

Collapse
 
thaisavieira profile image
Thaísa Vieira

Great point, @rossli! While studying DSA I also find some kind of popular repos onGitHub with a lot of problemns. If you can note such things I belive you're going to the right path.

Collapse
 
rossli profile image
Ross-Li

Thanks for the reply! By "DSA" do you mean "data structures and algorithms"?

Collapse
 
thaisavieira profile image
Thaísa Vieira

Exactly! I like to exercise data structures and algorithms with freeCodeCamp and HackerRank