Good Python Interface

published at 24 Jan, 2017 by Szymon Lipiński tags: programming python java

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

published at 23 Jan, 2017 by Szymon Lipiński tags: programming python java

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

published at 18 Jan, 2017 by Szymon Lipiński tags: programming python java

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.