====== Clean code, TDD, refactoring ====== ===== Čistý kód (clean code) ===== * [[https://refactoring.guru/refactoring/what-is-refactoring|Clean Code]] * [[https://www.youtube.com/watch?v=7EmboKQH8lM&t=1042s|Uncle Bob: Clean Code Lecture series]] Založeno na knize Clean Code. Krátké úryvky níže. * [[https://www.youtube.com/watch?v=F9owUy1g_YE|What is Clean Code?]] (a [[https://www.youtube.com/watch?v=RAr4-MD10pQ|delší a rychlejší verze]] s příkladem refactoringu) * [[https://www.youtube.com/watch?v=0vbntUt1CiU|How long should a variable name be?]] * [[https://www.youtube.com/watch?v=rXjf8eiGsSI|How small should a function be?]] * [[https://www.youtube.com/watch?v=tx77E9Ko2-U|What is the purpose of a comment?]] * [[https://www.youtube.com/watch?v=dS5sI5gtUas|How many arguments should a function have?]] * [[https://www.youtube.com/watch?v=2Q9GRPxqCAk|Why boolean arguments should be avoided?]] * [[https://www.youtube.com/watch?v=2IotTzClOAQ|What's the problem with switch statements?]] * Ne každý souhlasí se všemi názory Uncle Boba, viz např. tato [[https://qntm.org/clean|kritika knihy Clean Code]] a komentáře pod ní. ===== TDD ===== * [[https://www.youtube.com/watch?v=HtxHH4vLCHs|TDD is double-entry accounting]] * [[https://www.youtube.com/watch?v=4SIpyrko-x4|Why you should write tests first]] * [[https://www.youtube.com/watch?v=hFRq2vONviM|Is TDD Slow?]] * [[https://www.youtube.com/watch?v=rdLO7pSVrMY|TDD of a stack]] ===== Refactoring ===== * [[https://refactoring.guru/refactoring|Refactoring]] * [[https://refactoring.guru/refactoring/smells|Code smells]] * [[https://www.youtube.com/watch?v=naYIFpHDp_s|Martin Fowler: How to refactor code the right way?]] * Webová stránky knihy [[https://martinfowler.com/books/refactoring.html|Refactoring: Improving the Design of Existing Code]] Martina Fowlera (kde si můžete stáhnout [[https://www.thoughtworks.com/content/dam/thoughtworks/documents/books/bk_Refactoring2-free-chapter_en.pdf|první kapitolu]] s příkladem refactoringu části kódu, který pro divadelní společnost tiskne účet pro jednotlivé klienty.