Learn the principles and practices of Clean Code Development. This is the second session in the Clean Code Development track. Go on with the next level and dig into Clean Code.
an abstraction-level • if/switch/for • getProperty() • publish() • Keep one method on one level • Improves readability and understandability Freitag, 2. August 13
reason to change a class • Responsibility is • Parsing HTML/XML • Generating a data transfer object • Wrapping external libraries • Bad Example: Building HTML, pushing it via FTP and sending a mail in one class • Design and divide your code by domains (what a unit is responsible for) Freitag, 2. August 13
are Borg • Commit on naming and comments • Process of max. 5 minutes int length; int len; int l; int lengthMM; int laenge; function Price() function getPrice() Function getGrossPrice() Freitag, 2. August 13
• Enclose your work within a context • Trace what you‘ve done and use issue/ticket no. in your SCM commit message • SCM history tells hints at a context Freitag, 2. August 13
rename 512545 2012-01-02 13:37:00 lots of changes after a lot of time 512545 2012-01-02 13:37:00 Committing fixes in the dark, seriously, who killed my power!? 9533 2012-05-23 16:45:51 That last commit message about silly mistakes pales in comparision to this one 9363 2012-05-15 15:11:51 Minor updates 9131 2012-05-09 16:01:53 totally more readable 9131 2012-05-09 16:01:53 QuickFix. Freitag, 2. August 13
Tests: Test your production Code • Integration Test: Test with partial/full integration of databases, remote systems • Depend on environment • Be careful on QA/production systems • Repetitive task: Why doing it manually, automate it! Freitag, 2. August 13
not being inspected • Prevent bugs • Cross check: Does your peer share the same opinion • Pass/Gather knowledge • Code-/Condept-Reviews • Pair Programming Freitag, 2. August 13