Hacker News new | ask | show | jobs
by mekazu 3578 days ago
It can be difficult to verify the quality of code in GitHub. Even well know products that work really well can be implemented with awful code. I suspect the vast majority of projects on GitHub are experimental and unfinished. Using this feature would be very unlike a system like Stack Overflow where there are strong incentives to provide good answers.

Still, if the user is aware of these pitfalls then it could be quite useful. Perhaps it could be improved if GitHub provided some incentive for developers to showcase their better work as 'known good' examples and let the community vote on the quality, similar to the Stack Overflow model.

1 comments

what do you mean difficult to verify the quality of code? you are looking at the code.
In this context, when you look at the code you are trying to learn how to use an unfamiliar API. So you can't verify that the code is using the API correctly or in the most efficient, organized, and secure manner, because you don't yet know everything the API offers.

For example, maybe the code sample has a section that formats and saves the result to a file using the standard library. From looking at that section, you have no way of knowing that the library offers a .saveToFile method that would have been better to use instead. Or if you search for "mysql" examples in PHP, you may find example usage of the hard-to-secure, deprecated mysql_real_escape_string function instead of the PDO library that is supposed to replace it.