Humourous Programming

Associate
Joined
2 Nov 2005
Posts
931
Location
Leicester
Been teaching code (see other thread) and came up with an idea. If I make the code rather silly, they might learn better. First stab at "Humorous Programming":

Example of class "Aggregation" in Python:
Code:
class Bang:
    def __init__(self):
        print "Boom!"

class Wheel:
    fell_off = True

class Car:
    wheels = [Wheel(), Wheel(), Wheel(), Wheel()]
    rusty = True
    chitty_chitty = [Bang(), Bang()]

Contributions in other languages welcome :)
 
Back
Top Bottom