Clean Code Urice 2k9

522 views
475 views

Published on

A lecture about the art of making code clean, primarily sourced by Robert C. Martin's Clean Code and more or less a short fly through said book.

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
522
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Clean Code Urice 2k9

    1. 1. Clean Code urice
    2. 2. • dobri programerji ne obstajajo! • flamewars appreciated
    3. 3. Clean == pedantry? • do_something vs. doSomething • foo[‘bar’] vs. foo[ ‘bar’ ] vs. foo [ ‘bar’ ] • if something { do_it } vs. if something { if something do_it() vs. } { do_it() }
    4. 4. Kaj je ‘clean’? • elegantnost • berljivost • DRY+KISS+obvious
    5. 5. Zakaj? • slaba koda vedno bo • coding == reading •b
    6. 6. • Poimenovanje entitet • Izraznost funkcij • One lang per doc • Formatting • Objects || data • Errors
    7. 7. 1. Poimenovanje • izrazen naravni jezik • domensko izrazoslovje • searchable!
    8. 8. 1. Poimenovanje - avoid • hungarian notation (phnUsr) • type ‘hinting’ (UserList) • mental mapping • puns/jokes/stupid-stuff (HolyHandGrenade)
    9. 9. 2. Funkcije • almost functional programming • single responsibility principle • samo! en abstrakcijski nivo
    10. 10. 2. Funkcije • malo argumentov • brez flag argumentov! • brez stranskih ucinkov
    11. 11. 3. Komentarji • One Language Per Document! • the good • the bad • the ugly
    12. 12. 3. Komentarji - bad • don’t mumble • neuporabni komentarji • obvezni komentarji • javadoc v privat kodi • position markers
    13. 13. 3. Komentarji - good • API javadoc • razlaga namena • warnings • TODO
    14. 14. 3. Komentarji - ugly
    15. 15. 4. Formatting • not the pedantry! • vertical formatting • horizontal formatting
    16. 16. 4. Formatting - vertical • newspaper analogy • breezy • vertical density/distance • top -> bottom
    17. 17. 4. Formatting - horizontal • short lines • alignment je samo za assembler • indentation
    18. 18. 4. Formatting - fin
    19. 19. 5. Objects || data • abstract everything • disguise internals • brez seterjev in geterjev • law of Demeter
    20. 20. 5. Data transfer objects • brez metod • vse je public • work-around kjer ni named arguments • cudne podatke abstrahiramo v znan objekt
    21. 21. 6. Error handling • napaka je dogodek, ne stanje -> exceptions • ne vracajmo null vrednosti • errorje pohandlamo kjer jih lahko, ostali nivoji naj se z njimi ne ukvarjajo

    ×