Concept in Definition ABC
Miscellanea / / July 04, 2021
By Guillem Alsina González, in Nov. 2017
When something is invented and it works, why change it or do it again by running the risk to make a mistake? The reuse of code source has been a constant throughout the history of the programming, and in small doses it has a proper name: snippet.
A snippet It is a small section of computer source code that performs a certain function, and that is prepared to be inserted into larger sections of code, such as a library or a program.
Usually, they tend to cover very common and used functions, as well as simple, since the size of a snippet it should not be very large. And, above all, it must be reusable code in a very simple way.
Its reason for being is to avoid errors in commonly used functionalities that, as such, are built many times. They encompass source code that does not have enough volume to form a shared library, and they need the speed of execution that gives the form part of the main source code.
The snippets They not only refer to high-level language source code, but can also be used on the web.
The increase in benefits and power of hardware of computers, and the consequent improvements in the software and, more specifically, the web browsers that this has brought about, have led to making it possible for websites to become authentic online applications that perform a large number of functions.
These, naturally, must be programmed, developed, and may require a series of common functionalities. This is where the snippets.
A snippet it is not necessarily executable source code, but may consist of a pattern or template to document the program.
The documentation part of a program is important as it makes the task easier for each of the individual programmers working on a program. draft collective and even an individual programmer who works alone, to be able to interpret his work after some time.
Regardless of their type, snippets they should be prepared to "copy and paste" their content into larger source code.
A typical example of snippet It is the one that responds to a certain pulsation of the keyboard or to a mouse event (like moving it up, or to the left).
They're a methodology common in languages like Java, C, C ++, and other high-level languages. In the field of web page development, we can have HTML code, code for CSS files, and even JavaScript.
Being a trend started by the developers themselves as a way to facilitate the creation of applications or to share code, large development environments (IDE) have incorporated tools for their management and use.
This has been the case with NetBeans, Eclipse or Visual Studio, which allow the reuse of small sections of code throughout a structure, with just a few operations.
Photo: Fotolia - Colonga
Topics in Snippet