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.

10 Boas Práticas de Programação

7,312 views

Published on

Published in: Technology
  • (Unlimited)....ACCESS WEBSITE Over for All Ebooks ................ accessibility Books Library allowing access to top content, including thousands of title from favorite author, plus the ability to read or download a huge selection of books for your pc or smartphone within minutes ......................................................................................................................... DOWNLOAD FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M }
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

10 Boas Práticas de Programação

  1. 1. Um espaço aberto para dialogar, compartilhar conhecimentos e experiências.
  2. 2. 10 Boas Práticas de ProgramaçãoCarlos Eduardo A. Schults@carlosschultscarlos.schults@gmail.com
  3. 3. 0. Indentação Correta#função originaldef f( x ) # indentação com tab de 4 espaços Math.log( x ) - x + 2End#função modificadadef g( x ) Math::E**( x - 2 )end
  4. 4. 1. Nomes consistentes<?php $n = array( 10, 10, 10, 10 ); $sn = 0; $q = count( $notas ); for ( $contadorDoFor = 0; $contadorDoFor < $q; $contadorDoFor++ ) { $sn += $n[$contadorDoFor]; } $m = $sn / $q; // ------------------------------------------------------------------------ $notas = array( 10, 10, 10, 10 ); $somaNotas = 0; $qtdElementos = count( $notas ); for ( $i = 0; $i < $qtdElementos; $i++ ) { $somaNotas += $notas[$i]; } $media = $somaNotas / $qtdElementos;?>
  5. 5. 2. Comentar é bom...<?php // função para calcular o fatorial de um número function fatorial( $numero ) { // fatorial de 0, por definição, é 1 if ( 0 == $numero ) { return 1; } /** * fatorial de um número é o próprio número, multiplicado pelo fatorial * do número anterior */ return $numero * fatorial( $numero - 1 ); }?>
  6. 6. 3. ...mas não exagere :P# se valor da variável idade for maior ou igual a 18if idade >= 18 # atribui Vai trabalhar vagabundo à variável idade mensagem = Vai trabalhar vagabundoelse # se idade for menor que 18 # atribui Vai estudar vagabundo à variável idade mensagem = Vai estudar vagabundoend# imprime na tela a variável mensagemputs mensagem
  7. 7. 4. Siga um padrão de codificação
  8. 8. 5. Não Se Repita (DRY)
  9. 9. 6. Você não vai precisar disso (YAGNI) You Arent Gonna Need It
  10. 10. 7. Evite Muitos Níveis de Indentação
  11. 11. 7. Evite Muitos Níveis de Indentação
  12. 12. 8. Evite Linhas Muito Longas
  13. 13. 8. Evite Linhas Muito LongasProcure limitar em 80 (ou no máximo 100) caracteres
  14. 14. 8. Evite Linhas Muito LongasProcure limitar em 80 (ou no máximo 100) caracteres
  15. 15. 9. Evite Funções Que Contam Em Testes de Laço
  16. 16. “ Sempre programe como se o cara que vaiacabar dando manutenção no seu códigofosse um psicopata violento que sabe ondevocê mora.”Martin Golding
  17. 17. http://blog.thiagobelem.net/php-as-10-melhores-praticas-pra-um-iniciante/http://blog.thiagobelem.net/melhores-praticas-para-deixar-seu-codigo-legivel/http://net.tutsplus.com/tutorials/php/why-youre-a-bad-php-programmer/http://net.tutsplus.com/tutorials/html-css-techniques/top-15-best-practices-for-writing-super-readable-code/http://net.tutsplus.com/tutorials/php/30-php-best-practices-for-beginners/http://pt.wikipedia.org/wiki/Dont_repeat_yourselfhttp://pt.wikipedia.org/wiki/YAGNI

×