I disclaim thee, o’ liability

Abstract Classes and Factory Design Pattern in Python


Abstract Classes are one of the most useful and important concepts in Object Oriented Programming. I’ll attempt to illustrate their usefulness, and their usage in Python 2.7 with the following (seemingly contrived) example:

Let us say, you want/have to implement posting updates on Facebook using Python. Your code might look something like this:

1# Attempt 0: Bad code.
2
3def facebook_share_init(*args, **kwargs):
4    # Initialize OAuth with facebook
5    # ...
6
7def share_on_facebook(*args, **kwargs):
8    # Post to Facebook
9    # ...

It works and everyone is happy. Then one day, you decide to support posting tweets in your application. You add the following:

…
Read more ⟶

New Year Resolutions and Nostalgia


I was going through this link today when I could not help but feel an overwhelming sense of sadness and incompleteness.

I will be graduating in May, 2013 from the Indian Institute of Technology, Varanasi. The best 4 years of my life already behind me. As I was going through this list, I found a lot of things I wish I could have done, many others I wish I had done in a better fashion and many still that I have to do.

…
Read more ⟶