Thorsten Rinne - Refactoring * Thorsten codes since 1999 (PHP 3) * short Questionround about Companies and their Coding Behaviour * Code ages * Cost per Change Request are rising * dont refactor before a important release * you don't know how long refactoring takes * don't refactor with a lot of Junior Developers, they need Expirience * don't do it parallel to new features / development tasks * use coding standard, define your own or use pear or zend * avoid spaghetti code * speeds up maintainability * improves productivity * fix your API specs * Listenpunkt * what to do when refactoring * stay calm * use extreme Programming with shared pc's (one senior, one junior) * write Tests !! * don't let refactor the Devs their own Code (CodeBlindness) * don't let Junior Devs refactor alone * Unit Testing * only with Testing you could check if you broke anything * Problem: most old Code is untestable * PartTime Solution: Selenium * Solution: * Change the internal Structure without changing the external Behaviour * Discipline: Work 8 Hours, don't do Overtime, it's hard Work * Restructuring ? * Don't change Behaviour * Forms of Refactoring * Renaming, Extraction, Changing Signatures * name Variables relating to the Content * Pull up/Pull down, don't use duplicate Methods, extract and outsource them * put Method you need for Child Functions to the Parent Class (Superclass) * Tips & Tricks * use PHPDOCS, use PHPDOCS, use PHPDOCS * never use automated Refactoring * don't do refactoring for fun (don't let classes become to abstract) * write Unittest! WRITE UNITTESTS! * phpcpd PHP Copy&Paste Detection (Sebastian Bergmann) http://github.com/sebastianbergmann [[http://github.com/sebastianbergmann/phpcpd/tree/master|PHP CopyPaste Detection]] * Discussion about Testing and Refactoring and the Importance of Teaching the Youth