Don't break the sharing chain of code

share quality code
Image credits: acme
submit to reddit
 
(8 votes)

Sharing is easy. Everyday we have faster, easier and many more ways to do it. Sharing is also important. They say happiness gets bigger when it’s shared, as sorrow gets smaller. We share everyday and we feel good about it. We share our knowledge about an issue, we share advice when needed, and we share our opinion on all sorts of things.

But the best thing about sharing is when our friends also share their points of view, giving everyone a better vision of the topic and enriching each another through a new perspective.

Sharing code is similar.

Sharing code, on GitHub, for example, is critical to making changes, improvements, and updates to applications. Then, the code needs to be maintained. Making it visible to everyone ensures that changes can be made without too many difficulties.

Imagine that you find an open source application that perfectly fits your needs. You access the code, but you can't understand it because the creator didn't use a set of best practices. Or imagine that you find an application that is close to fitting your needs but you want to modify and improve it. You access the code, but it is cramped on a single 5,000 lines file. Or it has a high cyclomatic complexity and high rates of duplicated code.

What would you do? Maybe you would start writing code from scratch instead. So, how can we be sure of our code’s legibility, maintainability, and reusability? You guessed it: measuring and analyzing your code, and doing it continuously. 

I work with a tool for measuring and analyzing code called Kiuwan—there are many others out there—and among the many characteristics of quality software, it focuses on and strongly emphasizes maintainability. The process is:

  1. register
  2. upload code or download analyzer to local computer
  3. get results (risk and quality indicators, defects found, and the effort required to fix them)

Using a tool like this ensures that the sharing chain of code does not break. And, that is what open source is all about. Go forth and analyze your code!

 

""
Creative Commons License

2 Comments

Ginny Skalski's picture
Open Source Champion

Thank you for sharing this resource, Belen! I especially love how you explain the importance of sharing, both in our personal lives and in code. It's something we all know, but this is a nicely-written refresher on why it's important.

anoymous's picture

a bit late already, but...
i totally agree!
this is one of the big problems with open source projects, especially the smaller ones, with few devs, devs that are not professional developers and people that learn coding in university as a a tool, kind of on-the-go. they learn how to code by themselfs, and neglect/don't get to know the things that make the difference between a bunch of lines of code in some source files and a good software. this includes good for other devs, not just for users.

this is kind of my main are of work, since many years: cleaning up such projects, to make them practically open source, and not just theoretically.
the worst things are:
- copy&pasted code (plus a few manual changes, for making it fun ;-) )
- non-modular code
- undocumented code

there are other bad things, but these are the ones that would cost sooo much less time avoiding them in the first place, then it costs fixing them afterwards (which, as a bonus, also generates new bugs, of course).

so.. thanks for mentioning this problem! and thanks to you and all the others that work on tools that help tackling such things down! :-)

we are the home-front, supporting the troops! ;-) :P