资讯专栏INFORMATION COLUMN

5 ways to find code online

_ipo / 948人阅读

5 Ways to find code online

In 2015 google and the university of Nebraska published a research titled “How developers search for code: A case study”. This research was conducted on real google developers, while they were working on their everyday tasks.

The results points out a pain well known to every developer. The average developer sets out on 6 different code searching sessions every single day. Those sessions, which on average consists of no less than 12 different queries submitted, include a variety of search goals. The most common search is embarking on a quest for a specific API, library information or a functional example, representing over a third (33.5%) of the cases.

So, how do developers search for code? They go online.
Chances are people wrote the code you are looking for, or perhaps they built something which resembles what you are looking for. Much of this knowledge exists online as a part of the Open-Source initiative, and is located in open source projects hosts such as GitHub.
The problem is, 98% of that code becomes obsolete and is never being used within 12 months of the day it was written. Instead, developers often wonder to online forums such as Stack Overflow in hope that someone asked the question the are facing before, and that someone provided a good answer.

However, chances are the answer or example they need already exists within the open source. For several reasons, most developers fail to use the full potential of the open source code which could be tapped online, if only they had the tools to do it.

We listed 5 free and useful tools to boost coding ability by finding quality open source code online, and putting it to work.

GitHub is a Web-based Git repository hosting service. It offers all of the distributed revision control and source code management needed to collaborate and build projects together. Valuated at over 2 Billion $, GitHub has become the host of the largest data pool of open source projects known to man, holding over 2 Million active repositories.

However, finding code on GitHub itself is significantly restricting since the built-in search is lacking the ability to effectively find small pieces of code, and in mosts cases even finding an entire project requires preliminary knowledge as to the project’s name, owners or environment. Even after a relevant library is located, it may only be consumed as an entire library. This restriction renders searching for code within GitHub somewhat cumbersome and therefor is often used as a last result.

General search engines such as Google and Bing are perhaps the most common platform used by developers to search for code. Google or Bing is where people search for songs, purchasing items and services, restaurants and information and their algorithms can be trusted to come up with useful results.

We trust Google with everything else in our life, why not with our work? Well, because Google, Bing and every other search engine simply does not understand code. Google understands natural languages in an incomparable manner, and is able to understand with an impressive degree of certainty what it is you are looking for. Although code is a natural language just like any other, Google and Bing simply can not understand code. What they can understand is what people say about this code. The result is that Google or Bing are useful for finding relevant discussions and articles regarding the words you type in, and will often lead to people who encountered similar problem and hopefully found a way to solve them. However, this is anything but a precise and effective pin-point solution to the problem. More than anything, Google and Bing will not tap into the billions of lines of open source code hanging around GitHub and similar code sharing platforms. Not an optimal solution, although often useful to find commonly discussed issues.

Stack Overflow is a well known and widely used forum populated with millions of developers worldwide. Being the host of many online inquiries and discussions about code, SOF is a popular destination to end up in when submitting a code search in Google or Bing. SOF allows every developer to write down what he is looking for in plain english, and hopefully being answered by a developer dedicating the time to help. According to the 2014 Stack Overflow survey released recently, developers spend an average of 7 hours a week writing open source code. Answering questions in the forum often consumes additional time in order to make this knowledge accessible, in case someone is explicitly looking for it. Although an impressive amount of FAQ’s have been accumulated, providing answers for many common code searching sessions, the concept of direct interaction between developers in a simple online forum still reiles on a human mediation between a piece of code being written and another person being able to find it. Simply put, someone in the forum will have to give it to you. This solution is not a bad one, and allows more complex topics like “why is my code failing?” to be properly answered. However, this solution does not provide the ability to directly find and use pieces of open source code which might be useful for the person looking for them.
www.stackoverflow.com

Package management systems like NPM are an efficient way to find and consume whole open source projects. The main advantage is the ability to not only find and use a specific library, but also to apply a sophisticated system to manage and maintain it. The main appeal of this option is the ability to manage and maintain libraries a person decided to use, while being able to complete the process of locating, implementing and managing entire code packages. The major downside for this service is inevitably the fact that it only enables the implementation and management of entire libraries, often consisting of hundreds or thousands of lines of code. While useful for small projects or well known and widely used libraries, such management systems do not provide a solution for a developer searching for a piece of code or a library to do something specific without being aware of a specific project and what it’s called.
www.npm.com

CoCycles is a functional code search engine. The reality in which billions of useful and helpful lines of open source code are practically inaccessible as autonomous units had generated some early prior attempts to create a search engine for code. Those attempts included sited like OpenHub, GrepCode and similar others, which are known to few and are rarely ever used. The main reason for the scarce use of those sites was that they performed a textual search on code bases, and indicating different places within the code or it’s documentation where the flat text being typed by the user. This often results in useless results of little value, if any.
CoCycles is an entirely different breed altogether, since it treats code as a natural language.
CoCycles actually reads code, and understand what it does. This means CoCycles will not only search for the words you type in to appear in the code, but would look for the actual functionality of the code you describe. The results are impressive, as a developer is able to instantly find and use quality open source code based on what the code does. CoCycles also provides the original documentation for the exact piece of code, as well as real usage examples and metadata on the project it was taken from and additional information regarding the code itself (such as open source license, open source popularity and more). This is undoubtedly the most direct step being taken so far to making open source code accessible and useful by functionality and in every piece size needed. The major downside is that the complex technology (which includes elaborated NLP algorithms and advanced machine learning) is challenging and hus so far CoCycles were only able to apply their search engine to Javascript. however, coCycles announced that during 2016 more languages will be available, as well as further search features.

https://www.cocycles.com

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/79100.html

相关文章

  • 从单体系统到微服务的正确打开方式

    摘要:从单体系统到微服务的正确打开方式原文标题原文链接注每一段译文后跟作者原文,原文中可能包含着作者所提到的内容的跳转超链接。从一整块单体系统迁移到微服务生态系统简直是一段史诗般的旅程。 从单体系统到微服务的正确打开方式 原文标题:How to break a Monolith into Microservices原文链接:https://martinfowler.com/arti...注:...

    tunny 评论0 收藏0
  • 从单体系统到微服务的正确打开方式

    摘要:从单体系统到微服务的正确打开方式原文标题原文链接注每一段译文后跟作者原文,原文中可能包含着作者所提到的内容的跳转超链接。从一整块单体系统迁移到微服务生态系统简直是一段史诗般的旅程。 从单体系统到微服务的正确打开方式 原文标题:How to break a Monolith into Microservices原文链接:https://martinfowler.com/arti...注:...

    n7then 评论0 收藏0
  • 《JavaScript Web应用开发》作者Nicolas:恰巧,爱好变职业(图灵访谈)

    摘要:本文仅用于学习和交流目的,不得用于商业目的。今年,我们依然会组织。随着语言的发展,这种情况将不再适用。本系列主要讨论如何获得这些高度模块化的应用程序。这一系列内的后续图书会讨论测试及部署等内容。更多精彩,加入图灵访谈微信 本文仅用于学习和交流目的,不得用于商业目的。非商业转载请注明作译者、出处,并保留本文的原始链接:http://www.ituring.com.cn/art... 访谈...

    wawor4827 评论0 收藏0
  • docker-compose: scale and link

    摘要:更多文章访问的小博客 Learned how to use docker compose to create a scalable web app with nginx. Month ago, I built my apps with docker and used Nginx outside the docker as a reverse proxy server. Now I ha...

    CoreDump 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<