Worn out memories

Every word you emit It unravels and re-spins It knits and knots itself Slowly clothing me It builds in layers Textural and toned Always more comforting Than continuing alone I see the sound transform…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




5 Rules for selecting the right source code

However, even after finding the right code — trusting and using it is a whole different problem. To help understand which code you can actually use, I gathered 5 parameters which can be helpful to consider. Making the right decision should factor these parameters (among others), as well as the nature of the task itself. Here are the 5 keys you can consider for choosing the right code.

If our peers are to quickly and easily understand our source code, it must be readable.

Readable code means much more than only good comments and documentation. It means the code itself should be readable to you. Different parameters for readability can be good naming conventions for identifiers, good spacing, clear readable logic, well-understood scopes and more. The bottom line is, the code should be readable to you. When you choose a piece of code, even one that works, but you don’t fully understand how it works — you’re basically bringing in a maintenance time-bomb into your code base.

Debugging, modifying, updating and maintaining code you can’t read is something you should strongly avoid. The best way to avoid it will be never letting it in the first place when possible.

We want the code we pick to be “alive”. Meaning, we want to know bugs, issues and updates are being handled and this code will be actively maintained by the developers who wrote it. A nice example for an activity indicator can be GitHub’s open issues, pull requests and Pulse Indicator. Package managers provide information relevant for maintenance such as the number of dependencies and dependent projects, but still, struggle to present a trustworthy metric in this field.

Choosing code that works is probably our first priority. Tests are a great way of knowing if the code I use actually does what it’s supposed to do. The tests description also present different use cases and edge cases which help us know how this code will behave in different situations. Using tested components makes for more maintainable software as a whole, saving time and trouble when trying to change stuff before rolling to production.

Popularity is something we trust. Public opinion is good for making decisions which help our survival. If we see everyone eating a certain fruit off a tree, we know it probably won’t kill us. If we see everyone running from the bushes, a hungry tiger might soon follow. To some extent, the same goes for choosing code in 2017.

Around Programming forums, we can use different indications such as a “V” marking the correct answers, the number of upvoted and vocal user vocal opinions. These are excellent and reassuring features for increasing the probability the code works fine. When it comes to GitHub, we can rely on stars, collaborators and other social metrics to get a trust-worthiness feeling. When looking for packages, a good indicator would be the number of downloads for this package.

For GitHub repositories and packages, things are a bit trickier. Usually, the readme and docs files presented on GitHub or NPM will provide a general indication as to the quality of documentation. Documentation for Bit components is parsed from within the code itself and so it shows the actual description for the atomic component, and can also include usage examples and a specified signature including arguments and returns for different functions and behavior for React components and others. Either way, choosing documented code is a good decision whenever possible.

For GitHub repositories and packages, things are a bit trickier. Usually, the readme and docs files presented on GitHub or NPM will provide a general indication as to the quality of documentation. Documentation for Bit components is parsed from within the code itself and so it shows the actual description for the atomic component, and can also include usage examples and a specified signature including arguments and returns for different functions and behavior for React components and others. Either way, choosing documented code is a good decision whenever possible.

At the end of the day, the human memory is limited and there is really not much point in reinventing the wheel every time. However, when finding and using a piece of open source code the above indicators can help make sure your application remains secure, maintainable, working and in good health.

Add a comment

Related posts:

The INTELlectuals

Develop an inclusive education app that leverages advanced technologies and AI to enhance accessibility and learning experiences for students with diverse abilities. To achieve this, our app’s…

Lessons on Flying from the Forum on Internet Freedom in Africa

By citing these words in his opening message, Dr. Wairagala Wakabi, the Executive Director of the Collaboration on International ICT Policy in East and Southern Africa (CIPESA), captured both the…

Days of mumps and Trumps

When Curmudgeon was a kid, he caught the mumps. This was not a surprise because all kids caught the mumps. Catching the mumps was a rite of passage, along with catching the measles (both German and…