Pātuhitia tēnei: Automatic restructuring of object-oriented programs