18 September 2012

Stop Writing Classes

An awesome video from PyCon:

So many programmers think of problems in terms of Classes. If something is a noun, it’s a Class. For simple problems this makes excessive amounts of code, abstracted out in to various areas of the code base. Many of the examples in this video show classes with 2 methods, one of which is __init__, the other is a data structure. Why not just use the data structure? Other examples show classes which have been left unimplemented – the coder has just imagined that one day they will need that class. Most code is overcomplicated and over-engineered. The video is 20 mins with questions on the end. It’s well worth a watch!