__init__.py - what in the world is it for?

It’s very common when looking into python code, to see some inti.py files around. Most of the times you will see them empty, many times you will se imports or more generic stuff and sometimes a bunch of code in there. If you for example check some django code, say models, you’ll see more than you would initially expect. So, what exactly is init.py for? Let’s check the docs: The init....

March 19, 2014

A small help to get you into Continuous Integration

The more I use CI(Continuous Integration), the more I like it. Sure it can be a “pain” in the beginning, but the gains are enormous. You can easily start getting results in a short period of time and improve your software development process. If your team is not using CI, that’s no excuse for you. I’m here to help! You can easily set up, on your local machine, a VM(Virtual Machine) and run Jenkins inside....

February 27, 2014

Code review

First of all, what is Code Review? Let’s borrow from Wikipedia: Code review is systematic examination (often known as peer review) of computer source code. It is intended to find and fix mistakes overlooked in the initial development phase, improving both the overall quality of software and the developers' skills. This definition gives a good idea of what Code Review is. In my opinion there’s more to it than only that....

February 4, 2014

Quicksort

Quicksort is a popular sorting algorithm. That being the case makes sense that we see how to implement it right? Let’s go then. This algorithm basis itself on divide-and-conquer. For our purposes what that means is that, at each step we will use a pivot and divide our list into two sublists: one with lower values and one with equal or bigger values. Then we sort each sublist. The stopping condition of our algorithm will be when we reach the empty list....

January 28, 2014

Test your code with unit tests

You have a piece of code and you want/need to test it. Let’s get on with it! We will use a previous post as the code to test (you can find it here: Design Patterns: Factory Method) and will make use of Python’s unit testing framework (unittest) to build our tests. Let’s not get ahead of ourselves. First, a common testing practice: to test their code many developers write some function that makes use of it and check if it works properly....

January 16, 2014