Virtualenv Tutorial Part 3

After writing the Part 1 and the new Part 2 of the Virtualenv Tutorial, I have created a simple video showing how to install the Virtualenv Wrapper on a fresh Ubuntu installation and how to create the first virtual environments.

Why I Created DBRows

Some time ago I was using the Records library. When I searched for some comments, I noticed only good reviews. The main goal of this library to simplify things. It’s a proxy to the SqlAlchemy library.

The only thing I was no impressed with was the library interface.

After some time of using it, I got the feeling that the interface is not good enough. It looked rather like some random ad hoc bunch of functions put into classes.

So I have decided to implement my own version. Mainly to find out if it is possible to create the kind of interface I described here.

That’s why the DBRows Project has been born.

Good Python Interface

In the previous blog post I wrote about changing interfaces using a Java class as an example.

The public interface of the final implementation was:

constructor:

    (int, int)

methods:
 
    getWidth() -> int
    getHeight() -> int
    getArea() -> int
    setWidth(int)
    setHeight(int) 

There were no public fields, all were accessible with the setters and getters.

There was also a C# example with the properties. This way I had the public interface like:

constructor:

    (int, int)

fields:

    int width
    int height

Because of the properties those fields were also writable.

Good Naming Things Is Hard

Naming things is hard.

Usually when we are going to have a brand new kid, naming her/him takes a couple of months. The endless discussions, the sleepless nights, all the lists of possible combinations of letters (just assume only letters for now). And all the effort just to achieve something that would sound nice to us. And only to us, as usually the grandparents of that brand new family member will not be happy with our choice.

The normal baby delivery date is quite far in the future, so usually we have lots of time to think about the name and the possible problems the kid will have when naming like Donald Trump Otieno or like this:

delete from users

The Importance of Good Interfaces

A Short Introduction To A Good Interface

When you are using a class, a function, or a library, you have use its interface. Interface is the set of public knobs and switches which you can use. Usually the interface for most of the libraries, functions, and classes has one common feature: it irritates programmers.