A few ideas on code review

After watching a talk about code review1, from the last EuroPython, I got some ideas that I'd like to summarise.

The first one is a point I made on my talk about clean code in Python, about running style checks (PEP-8, for example), automatically as part of the CI. This has several rationales, the first one being that it's the sort of thing machines should do, and not humans. Having software engineers reviewing the tabs, spacing, and such, is just a wasted effort (not to mention, wasted money). As I mentioned on the conclusions during my talk, we should focus on the readability of the code in terms of the logic, by asking ourselves things like "does this code make sense?", rather than "is the space before the comma correct?". Remember, code is for humans, not machines, it's a means of communication with the development team.

Read more...

__wrapped__ in Python decorators

This is another of the new interesting things that Python 3 has. Time ago, it was somehow tricky to work with decorated functions, because the decorator replaced the original object, and its behaviour became hard to reach.

So, for example, we all know that the following sentence:

@decorator
def function():
    pass

It’s actually syntax sugar for:

def function():
    pass

function = decorator(function)

So, if for some reason, we need to work both with the original and decorated functions, we required tricks such as different names, something like:

Read more...

Running PostgreSQL in memory with docker

Introduction

Interacting with a database, can be a regular task of a developer, and for that we would like to ensure that we are developing and testing in situations close to a real implementation; therefore, using the same database as in production can help detecting issues early.

However, setting up an entire database server for development, can be cumbersome. Hopefully nowadays, modern operating systems like Linux have great tools and features that we could take advantage of.

Read more...

2016 in review

A review of the events that took place this year, related to software engineering and architecture.

The conferences, talks, and events

These are some of the events I participated in:

  • (2 Apr 2016) PROTOSEC 20161: A technical conference about networking, protocols, security, and related topics.
  • (July 2016) EuroPython 2016: I attended several talks, trainings, workshops, and presented a talk.
  • (10 Sep 2016) Python Córdoba meetup2: interesting meetup where I presented my talk at EuroPython and attended the sprints afterwards.
  • (14 Sep 2016) ArqConf Meetup ¿Cómo es trabajar distribuido globalmente? Caso Open Stack3: Hosted in the Red Hat's offices in Buenos Aires, this talk was a very interesting one, on which I learned about the collaborative way of working of the Open Stack team, around the globe.
  • (17 Nov 2016) Python Barcelona meetup.
  • (9 Dec 2016) Barcelona Spark meetup4
  • (22 Dec 2016) Python Barcelona December meetup5: I presented my talk about clean code in Python (yes, again :-), and there were two other interesting talks. Mine was the first one of the evening. The second talk, was about zc.buildout, an interesting tool for managing packages and environments in Python, which I first heard of at PyconAr (Python Argentina group) 2012. The third and last talk, presented a project named aiocache6: a cache system implemented in asyncio, that supports multiple back-ends. The talk walked us through the code, its architecture, and some use cases with demos.

Code wise

I started with a small contribution to the coala project7, and during the EuroPython sprints I contributed to aiohttp with a pull request.

Read more...

Python Barcelona November meetup notes

Last Thursday November 17, 2016, there was a Python meetup in Barcelona1, with a set of interesting talks.

The first one was hosted by two representatives of the government of Catalunya, and Barcelona city, and they presented the technical challenges they are facing, and the new stack proposed for oncoming projects. In this regard, it was interesting to see how they have lots of legacy applications written in J2EE, with Java frameworks, that are outdated, difficult to maintain, and they mentioned the idea of migrating them to new, more modern technologies. In this sense, there are already projects in progress, and they chose Python + Django for the migration and re-implementation of the legacy systems.

Read more...

Oncoming events of Python and Architecture in September

The next Saturday 10 of September, I will be presenting my talk "Clean Code in Python", as presented in the previous EuroPython 2016, at a local Python event in Córdoba, Argentina12.

The following week, I will be attending a local architecture meetup (arqconf), on which a talk3 about OpenStack will be hosted, explaining how they work in a distributed fashion.

I look forward to enjoying both events!

Read more...

Returning data in PostgreSQL

In order to get the best performance from our database engine, most of the times, we have to take advantage of its exclusive features. This has the disadvantage of getting farther away from standard, ANSI code, and in the case of RDBM engines, this also means, most of the ORMs will not work.

Besides that, it could sometimes be worth exploring what we can gain by adapting to the engine.

Read more...

My talk @ EuroPython 2016

I had the great experience of presenting at EuroPython 2016. My talk entitled "Clean code in Python", was about good development practices, down to low-level design (with code examples), for Python. The idea of the talk, was to present the "pythonic" approach for writing code, and how do general concepts of clean code apply to Python.

These examples might be useful for beginners, developers experienced in other languages coming to Python, and people using Python for scientific applications. The examples could also be helpful for senior developers, because they remind real situations that might appear in pull requests, while doing a code review.

Read more...

EuroPython 2016 remarks

Last week, EuroPython 2016 finished, and it was an amazing conference I had the pleasure to attend. Here is my review of those days.

The conference

I arrived on Saturday noon at Bilbao, Spain, the day before the conference, so I had some time to know the city, see the venues, etc. The next day, on Sunday, was for two separate workshops: Django girls and Beginner's day. I attended the beginner's day as a coach, and helped a group of intermediate developers with several exercises aimed at explaining some Python concepts, such as: context managers, decorators, magic methods, generators, etc. It was really curious that some of these topics were those I was going to cover on my talk on Wednesday, so I felt really glad about that. I took an oath (very funny BTW) for becoming a beginner's mentor, and so I did (it was really good actually). I had a great time helping other developers, exchanging ideas and experiences during lunch, solving problems, and getting a first glimpse on what the conference was going to be like.

Read more...

Upcoming talk at EuroPython 2016

I am glad to inform that I will be speaking at EuroPython 2016 conference.

My submission about clean code in Python was accepted, so in the next edition of EuroPython 2016, in Bilbao, Spain, I will talk about clean code principles for Python. Here is the abstract:

https://ep2016.europython.eu/conference/talks/clean-code-in-python

The full list of talks is available at:

https://ep2016.europython.eu/en/events/sessions/

If you are interested, subscribe to the EuroPython blog and Youtube channel. I will include more details in a separate post.

Read more...