Tuesday, October 15, 2013

[ MSWL - Development Tools ]

Benefits of using git

git is a distributed source control management system initially designed and developed by Linus Torvalds in 2005, distributed under GNU GPLv2 license. Among the main goals of this project was to support:
  • Distributed revision control system workflow, synchronizing code by exchanging patches from peer to peer
  • Strong safeguards against corruption, either accidental or malicious
  • Low latency of patches going into repositories, focused on speed
As Linus mentioned, there is a complete manual and tutorials asociated to this tool in the main website (http://git-scm.com/) that shows many of its features and how to use it, but there is a great Tech Talk given by Torvalds at Google in 2007 in which he emphasizes the following specific benefits:
  • Reliable: the system guarantees that the code putted into it, comes out exactly the same at any other time, preventing disc corruption or malicious intent. Get your own branch, doing a great work or a mediocre work, is not relevant, it's your own copy. A good backup way, cloning from trusted sources.
  • High performance: allows to track around 22,000 files in 5 seconds top.
  • Distributed: no single place of storage, be able to do everything from any location without access to the server, off-line work.
  • Disseminated: globally adopted by various systems and infrastructures.
Another important element is the repercussion this project is adopting in different areas of society, since its creation git is increasingly been used even in projects not related to computer science, due to we now live in the information age and require efficient systems to manage it.

Source: https://git.wiki.kernel.org/index.php/LinusTalk200705Transcript

Monday, October 7, 2013

[ MSWL - Development Tools ]

Python: The importance of Docstrings

A docstring is a literal string description or definition of a module, function, class, or method in the Python code. It becomes the __doc__ attribute of that object.

A docstring corresponds to something like the following:

  def function(a, b):
      """function(a, b) -> list"""

Or even something more comprehensive like this:

  def complex(real=0.0, imag=0.0):
      """Form a complex number.

      Keyword arguments:
      real -- the real part (default 0.0)
      imag -- the imaginary part (default 0.0)

On the other hand, unlike the usual comments, a docstring facilitate the task of consulting the description of a module, function, class, or method from the Python interpreter, without requiring access to the source code to understand its operation, facilitating its usage.

All of this is a technical matter, but the real deal about it is to make the code readable and understandable with the intention of attract as many contributors as possible.

If the code of a project is not well documented, commented or described, there is no one who would want to use it or much less contribute to it. So if you're taking the time to code something transcendental or productive, then try to incorporate docstrings in the process, as this will allow a better diffusion of the project, or at least later will allow you to better understand what you did in the past. It is a good practice for you and for everybody in the programing world.

Source: http://www.python.org/dev/peps/pep-0257/