According to the Zen of Python, complex is better than complicated, but it requires the code to be flat, and flat code means less nodes to visit during parsing. It also means that the code should be plain, without too much nested statements, well structured and small. Cyclomatic Complexity is a metric that allows you to know how many execution paths, or nodes are visited during the program execution. I was searching a program or module that allows me to know the Cyclomatic Complexity of my Python programs, even if have pylint, pychecker, pep8 and pyflakes to check my code, a well organized project, that is strict on its governance, maintains a well structured Continuous Integration tools with this kind of analysis enabled.
web developer & system programmer
coder . cl
ramblings and rants on software development...
cyclomatic complexity in python
by Daniel Molina Wegener on 2011.07.31posted in: development, programming, python, tips
λ day meet-up
by Daniel Molina Wegener on 2011.07.24posted in: development, haskell, programming, projects, python, tips
The past July 19, I’ve made a talk on the Dynamic Languages meet-up explaining some basics of functional programming. The presentation has two parts, the theoretical one, with the proper presentation and the second one with code examples. For the code examples I’ve used Lisp, Haskell and Python, with homologous functions, each one implemented on each used language, to ensure that are concepts were handled.
considerations in code review
by Daniel Molina Wegener on 2011.07.06posted in: development, java, programming, python, tips
Once we have created code, we can evaluate how it was done. We can use various tools to check our creation among other activities. To do standard checks, we can use style checkers, static checkers, unit testing suites and the most important one, the human code review.
concurrency in redis and memcache
by Daniel Molina Wegener on 2011.06.19posted in: development, programming, projects, python, tips
I have compared redis and memcache with a lighweight test. Now I have compared both key/value stores with a harder test, using 100 threads, and observing the speed between the parallel writes and parallel reads in both engines. I’ve used the Python binding, since I need to apply one of those key/value storage to certain Python application that I am currently developing. Certainly both have advantages between each other, but still I am preferring Redis over Memcached, because seems that Redis can manage more constant times between both operations, and seems to have a lighweight routine to make concurrent writes.
minimal design patterns in django
by Daniel Molina Wegener on 2011.06.11posted in: development, programming, python, tips
Using design patterns to encapsulate application logic is very cool, only when you do not over-architect your application. Any excessive usage of design patterns and architectural patterns can lead you to oversized applications. Applying design patterns correctly can allow you to get a well defined architecture and a well designed application. You must remember that Django do not uses the MVC pattern, instead — as they development team describes it — Django is MTV: “Model, Template and View”. So, I will try to explain an implementation of the PAC architectural pattern driven under Django to allow you to implement scalable Django applications.



