Category Archives: Object-oriented programming

Jim Gay: Eastward Ho! A clear path through Ruby with OO

Even in an object-oriented language such as Ruby, there are many ways to write code. Some code styles are more in the spirit of OO than others. In this talk, veteran Ruby developer Jim Gay describes his theory of OO programming, in which we issue commands, rather than querying objects about their state. This leads, Gay says, to code that is easier to understand, debug, and maintain.  If you’re looking for ways to make your Ruby (or other OO) code clearer and more obviously intentioned, this code will likely give you some insights.

Jessica Kerr: Functional Principles for Object Oriented Development

Functional programming is a well-known programming technique in which we treat functions as first-class objects, and all (or many) objects as immutable. In this talk, Jessica Kerr shows how even when we’re working in an object-oriented language, functional programming techniques can help to make our code tighter, more elegant, and easier to understand — as well as more reliable.

Raymond Hettinger: Python’s Class Development Toolkit

Python is an object-oriented language, meaning that nearly everything in the language is an object. You can (and are encouraged to) create your own classes. But what are the best ways to create classes?  And what tools does Python provide for us to create classes as easily and well as possible?  In this talk, Raymond Hettinger shows us how to create Python classes, starting with the basics and working up to testing and user feedback. Even if you have written many Python classes before, you’re likely to learn something from this talk.

Avdi Grimm: Confident Code

Would you describe your code as “confident” or “timid”? That’s not a question I had really ever considered before watching this talk by Avdi Grimm, which shows how we can write code which doesn’t have to second-guess itself or its inputs. The code becomes easier to read and more maintainable. The examples all use Ruby, but can apply to many different languages, and particularly dynamic object-oriented languages.

Jack Diederich: Stop Writing Classes

Python is famous for making it easy to get into programming: The syntax is simple, the constructs readable, and the data structures rich. Python also makes it easy to create new classes and work with objects.

In some ways, though, Python makes it too easy to create and work with objects. Python, unlike some other programming languages, doesn’t require that you use classes, but makes that possible. This means that developers wills sometimes create new classes when it is unnecessary — when functions and Python’s built-in data structures more than suffice.

In this talk, Python core committer Jack Diederich describes and demonstrates many cases in which Python developers went overboard, creating and using classes when there was no good reason to do so.  Using classes made the resulting code slower and more complex than as otherwise necessary.