Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Programming != Writing Code

6,859 views

Published on

Palestra para o V Meetup do GDG Maceió em 07/02/2015 no CESMAC

Published in: Engineering, Software, Internet
  • Hey guys! Who wants to chat with me? More photos with me here 👉 http://www.bit.ly/katekoxx
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Nice !! Download 100 % Free Ebooks, PPts, Study Notes, Novels, etc @ https://www.ThesisScientist.com
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hi there! Essay Help For Students | Discount 10% for your first order! - Check our website! https://vk.cc/80SakO
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • nice, find more latest PPTs on www.ThesisScientist.com.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Programming != Writing Code

  1. 1. 1 P R O G R A M M I N G = ! W R I T I N G C O D E
  2. 2. • A L L S L I D E S A R E I N E N G L I S H • T Y P O S M AY O C C U R Y O U D O N ’ T K N O W E N G L I S H ? 2
  3. 3. 3
  4. 4. • S O F T WA R E E N G I N E E R • W E B A N D M O B I L E • R U B Y / P H P / O B J E C T I V E C / S W I F T • 1 1 Y E A R S O F E X P E R I E N C E • Q U I M B I K , I N C / U S A G U S TA V O C U N H A 4
  5. 5. •I N F R A S T R U C T U R E ? •S U P P O RT ? •W O R K S ? •P R O G R A M M I N G ? 5
  6. 6. P R O C E S S W R I T I N G T E S T I N G M A I N T E N A N I N G [ W I K I P E D I A ] D E F I N E : P R O G R A M ? 6
  7. 7. • ~ 300 Programming Languages - Wikipedia • Learn all of them? NO! • Make mistakes is common and acceptable • Which language should I learn? Does the language really matters?!?!?!?! F* NO!!!!!! 7
  8. 8. P R O G R A M M I N G I S E A S Y 8 I D O T H I S O N A D A I LY B A S I S I N E V E R M A K E M I S TA K E S ! R E A L LY ?
  9. 9. H T T P : / / I . I M G U R . C O M / B T J Z E D W. J P G9
  10. 10. 10 H T T P : / / I . I M G U R . C O M / L Z B I E . J P G
  11. 11. 11 H T T P : / / PA S T E B I N . C O M / P T RY 5 G 2 A Construtor + 40 parâmetros
  12. 12. PA S T I E . O R G / PA S T E S / 8 2 7 2 3 8 6 H T T P S : / / G I S T. G I T H U B . C O M / A N O N Y M O U S / A A 4 6 E 8 D B 0 9 8 D C B D 3 B 4 2 8 12
  13. 13. 13 C O D E S M E L L
  14. 14. 14
  15. 15. C O D E S M E L L ( … ) I S A S U R FA C E I N D I C A T I O N T H A T U S U A L LY C O R R E S P O N D S T O A D E E P E R P R O B L E M I N T H E S Y S T E M ( … ) K E N T B E C K 15
  16. 16. C O D E S M E L L • Duplicate Code • Long Method • Large Class • Long Parameter List • + 10 more symptoms 16
  17. 17. D U P L I C AT E C O D E C O D E S M E L L 17 Most common problem Solution • Same class, different methods • Extract code to new method • Different classes • Sibling classes • Move code to parent class • If code is similar, but not equal, break into methods that has same code and methods with different information • Unrelated classes • Check design
  18. 18. L O N G M E T H O D C O D E S M E L L 18 Hard to understand, easy to solve Solution • Break the methods into smaller methods (subroutines) • Big method will become a method caller • Easier to maintain Problems • Hard to read • Usually loses it’s main purpose
  19. 19. L A R G E C L A S S C O D E S M E L L 19 Also known as Ninja Class Solution • Break the attributes into components (like address) • Usually, attributes with same prefix/suffix is likely to become a component • Reduces duplicate code Problems • Loses it’s purpose • Does more then one thing • Duplicate code (often) • Has many object-cadidates inside it
  20. 20. L O N G PA R A M E T E R L I S T C O D E S M E L L 20 Change one of them and you will be in trouble Solution • Remove any parameters that can be retrieved from objects already sent Problems • On Procedural Programming, you had to send every detail a function needed • On Object Oriented Programming, you can send enough to get what the method needs
  21. 21. H T T P : / / W W W. A M A Z O N . C O M / G P / P R O D U C T / 0 2 0 1 4 8 5 6 7 2 21 F O R F U R T H E R I N F O R M AT I O N
  22. 22. I N R U B Y… Gems • flog - Flog shows you the most torturous code you wrote. The more painful the code, the higher the score. • flay - Flay analyzes ruby code for structural similarities. Differences in literal values, names, whitespace, and programming style are all ignored. • reek - is a tool that examines Ruby classes, modules and methods and reports any Code Smells it finds • brakeman - is a static analysis tool which checks Ruby on Rails applications for security vulnerabilities. 22
  23. 23. H T T P : / / W W W. S L I D E S H A R E . N E T / M A R T I N T S C H / R E FA C T O R I N G - C O D E - S M E L L 23
  24. 24. T W O M O R E T H I N G S …T W O M O R E T H I N G S … 24
  25. 25. 25 18 de abril Colégio Contato alagoasdevday.com.br
  26. 26. 26
  27. 27. Q U E S T I O N S ? 27
  28. 28. T H A N K Y O U ! 28 Gustavo Cunha gmmcal.com.br [twitter|github|facebook].com/gmmcal +GustavoCunha

×