Thursday 18 May 2017

Moving Average Ruby


Começando Ruby (compre na Amazônia) é um livro de programação Ruby destinado a recém-chegados ao idioma. It8217s escrito em um formato instrucional e caminha através de conceitos básicos de programação até a construção de aplicativos da Web, aplicativos de banco de dados, daemons de rede e aplicativos baseados em GUI. It8217s bem adequado para alguém novo para a programação, bem como desenvolvedores experientes que são apenas novos para linguagens dinâmicas. Consulte o Sumário. Onde Comprar Amazon normalmente oferece o melhor preço para Beginning Ruby. Confira em Amazon (EUA) ou Amazon. co. uk (Reino Unido). O livro está disponível em ambos os formatos de impressão e Kindle. Alternativamente, a editora, Apress, também tem o livro para venda a preço de varejo completo, bem como a versão e-bookPDF. Começando Ruby tem 27 comentários de 5 estrelas sobre a Amazon, mas outros foram recebidos em opiniões de terceiros ou por e-mail: Esta não é apenas uma introdução ao Ruby. Quase toda tecnologia que está ligada a Ruby de alguma forma é discutida .. O autor, Peter Cooper, é obviamente um desenvolvedor Ruby bem-arredondado, e seu entusiasmo para o tema brilha. E com quase o dobro do número de páginas como os outros livros analisados ​​aqui, o seu é facilmente o melhor valor dos três. 8212 Andy Hudson, Formato Linux Peter Cooper8217s Começando Ruby: Do iniciante ao profissional tem dois públicos, novatos sem experiência em programação que querem aprender Ruby como sua primeira linguagem de programação e veteranos que querem adicionar Ruby ao seu kit de ferramentas de programação. Cooper8217s resposta a este desafio é uma entrada sólida na arena limitada de Ruby tutoriais. 8212 Tim Hunter Este tem que ser o melhor livro para iniciantes de Ruby, seja para scripting ou para mover para Rails. . Facilmente um 910 em meus eyes8230nothing obtem os 10 a menos que tiver nudity8230.and que8217s não um convite Peter. 8212 Jamie van Dyke I8217ve lendo Beginning Ruby por Peter Cooper. I8217m realmente impressionado. . Um grande livro para um programador novo, ou um programador novo a Ruby. It8217s uma ótima alternativa para os outros livros de novato8217s sobre Ruby lá fora. 8212 Pat Eyler Tanto o livro de Chris Pine8217s como o guia why8217s têm seus momentos, mas na minha opinião o livro de Cooper8217s tem uma vantagem considerável em clareza e utilidade. . Além de ser um grande livro de rubi, it8217s também um dos melhores 8220tech8221 livros I8217ve já comprou. É raro ver esse nível de qualidade na escrita técnica. 8212 8220Phren0logy8221 no Amazon Eu realmente gosto Ruby Beginning. Eu estava ensinando um curso de Ruby no CCSF (City College de São Francisco) nos últimos dois anos e usei o Pickaxe como livro principal. É um livro excelente, mas é uma luta para adaptar essa bagunça nodosa em uma seqüência de lições didáticas. Próximo semestre I8217m usando seu livro (CS132A) porque eu sinto que você fez um grande trabalho de organizar o material em pedaços ensináveis. Você me salvou da agonia de escrever meu próprio livro. Bom trabalho. 8212 Douglas Putnam 8211 Professor de Ciência da Computação, CCSF Trabalhando através das seções iniciais e realmente gostei do livro até agora, sua descrição da orientação do objeto é a melhor que eu encontrei em qualquer livro. 8212 Caoimh O8217Broin A melhor e mais abrangente introdução ao Ruby I8217ve visto. . O texto não é nem seco nem caprichoso, mas uma mistura perfeita entre material de referência e hands-on tutorial. . Eu quase quero comprar uma segunda cópia de pura apreciação para Peter Cooper fornecendo um grande guia para uma grande linguagem de programação 8212 Zeff Morgan Eu acho Ruby Beginning: De Novato para Profissional é um melhor primeiro livro Ruby do que o venerável Pickaxe. .. Se você quiser aprender Ruby, Beginning Ruby é o livro para comprar. 8212 Larry Wright 2 de outubro de 2009 183 Arquivado em Sem categoria Como autor de Beginning Ruby. Eu ganho dinheiro para cada cópia vendida em formatos impressos e eletrônicos (bem como alguns rendimentos diversos cobertura I8217ll mais tarde). Não é muito dinheiro, mas isso não foi a motivação para escrever o livro. Neste post I8217m vai mostrar como tudo funciona do meu ponto de vista, incluindo números de vendas. Imagens de minhas declarações de royalties. Informações sobre meu avanço. E coisas similares horríveis. Há também uma seção no final sobre como Apressar me irritou um pouco (embora eu não me arrependa da experiência com eles 8211 eles são um bom editor em geral, embora menos desde a sua reestruturação) e por que estou feliz com você piratando meu livro se você assim (Embora isso não seja um incentivo para fazê-lo) 19 de outubro de atualização: Depois de ser bem recebido pelos leitores em Hacker News e Reddit há uma semana, esta história foi Slashdotted com um resumo impreciso em 16 de outubro 8211 no mesmo dia em que minha filha nasceu, eu redireccionei todo o tráfego para este site para uma página de doação de câncer, porque eu não conseguia refutar os comentários desagradáveis ​​e eu tinha coisas maiores em minha mente no momento. Eu sinto, no entanto, eu preciso dar algumas informações extras ao longo deste post para esclarecer os pontos que foram mal interpretados por uma minoria de leitores. Essas notas adicionadas estão em negrito e itálico. O Advance O 8220advance8221 é uma soma de dinheiro que você recebe de seu editor up-front ao escrever o livro. Ostensivamente o avanço apóia você enquanto escreve o livro, mas realmente é para garantir que você consiga terminar o livro. Para a primeira edição em 2006 eu tenho um avanço de 6000. Apress dá-lhe um terço de cada vez nestes pontos: 1) quando três capítulos são concluídos e aprovados, 2) quando dois terços do livro é concluído e 3) Quando o manuscrito estiver completo. Então o meu 6000 foi espalhado por cerca de 9 meses. Nota: Alguns não escritores cometem o erro de que um adiantamento é um tipo de bolsa ou bolsa e que, uma vez que o livro está fora, você ganha mais dinheiro por cópia vendida. A palavra 8220 avanço 8221 é bem escolhido, porque o pagamento é simplesmente royalties de antecedência. Então, se você receber um adiantamento de 1000 e ganhar 1000 em royalties no primeiro ano, você não terá dinheiro extra. Os royalties feitos uma vez que o livro está realmente vendendo 8220pay back8221 o avanço que você recebeu anteriormente. A única vantagem para você é que, se suas bombas de livros e nem mesmo vender cópias suficientes para pagar o adiantamento, você (geralmente) não precisa dar ao editor uma moeda de um centavo. Quanto eu recebo por livro O preço de varejo (PRP) de Ruby começando é 40 (dê ou tome uma moeda de um centavo) mas meu publisher, Apress, faz uma quantidade variando por o livro 8211 Eu don8217t saber por que (a actualização: I8217ve sido dito por informado Leitores que o preço líquido variando é porque diferentes varejistas e distribuidores obter melhores descontos do que outros.). Um preço líquido 8220 médio é mostrado em minhas declarações de royalties, mas isso flutua. It8217s geralmente em qualquer lugar entre 18.00-19.00. Dizem 18,50. Desta 18,50, recebo: 10 (1,85) para cada uma das primeiras 4000 cópias vendidas 12,5 (2,31) nas cópias 4001-8000 15 (2,77) nas cópias 8001-12000 17,5 (3,23) nas cópias 12001-25000 20 (3,70) Nota: Se eu promover o livro com um link de afiliado para a Amazônia e fazer 4 comissão em sua venda 26, eu posso adicionar outro dólar por venda. Apesar de vender o e-book diretamente em 27,99, o preço líquido para o e-livro chega a cerca de 18,00 no geral. Uma vez que não há custos de impressão ou cadeia de fornecimento, no entanto, você recebe o dobro dos royalties em e-books. Se suas cópias impressas estão ganhando atualmente 10 direitos, digamos, você recebe 20 nas vendas de e-book. Isso significa que na marca 10, it8217s 3,70 por e-book, 4,62 no nível 12,5, 5,54 no nível 15, e assim por diante. Figuras de vendas Como um livro introdutório para uma linguagem de programação, Beginning Ruby tem visto as vendas perenes 8211 não é um livro específico do tempo (como, infelizmente, 90 dos livros Rails). A maior explosão foi em torno de lançamento 8211 como para a maioria dos livros de tecnologia 8211, mas as vendas didn8217t cair significativamente para a primeira edição ao longo de sua vida útil. Em 2 anos (8 quartos completos), 7673 cópias em papel e 486 e-books foram vendidos. As vendas no início de 2009 impulsionou este até cerca de 8500 cópias em papel e 500 e-livros total para a primeira edição. Embora as declarações desde 2008 são tão difíceis de ler eu haven8217t tem uma figura exata. A segunda edição de Beginning Ruby foi encomendada no final de 2008 e saiu em agosto de 2009, portanto, não há números de vendas para ele ainda. Uma vez que haja, eu estarei postando novamente. Será interessante ver se a segunda edição experimenta uma explosão semelhante à primeira. Outros autores da Apress sugeriram que sim. No grande esquema das coisas, vender cerca de 9000 cópias de um livro técnico não é motivo para uma grande festa ou desespero. O livro facilmente pagou seu avanço nos dois primeiros trimestres e it8217s forneceu Apress com cerca de 170.000 na receita líquida ao longo de dois anos (dos quais cerca de 19.000 acabou comigo). Realeza Declarações Os detalhes salientes foram dadas acima, mas eu quero mostrar algumas das declarações de royalties Apress8217s. Em 2007, eles se pareciam com isso: Nota: Você pode apreciar ver John Resig8217s declaração de royalties para aproximadamente o mesmo período para Pro JavaScript Techniques. De alguma forma meu livro superou o seu, mas ele tem um avanço melhor, eu pensei que essas declarações foram muito legal. Eu não conseguia imaginar por que a reserva estava sendo calculada como era ou o que eram os direitos 8222, mas eu podia facilmente ver quantas cópias I8217d vendia em formato de impressão e e-book por trimestre e tinha uma boa história e quebra de meu Forma de pagamento. Nota: Veja a retenção de 30 em impostos na parte inferior direita Acontece se você don8217t identificar como um contribuinte dos EUA (e ter o número exigido 8211 que, infelizmente, obriga você a arquivar declarações fiscais nos EUA), o imposto dos EUA O homem ainda vai roubar 30 de seus royalties (embora estranhamente não seus avanços) para financiar todos os tipos de absurdo nefasto. Felizmente, se você estiver em um dos vários países com um tratado fiscal com os EUA pelo menos, você pode reivindicar de volta alguns ou todos os impostos retidos de seu imposto de renda local. It8217s não é fácil embora. Em 2008, a Apress implementou um novo sistema de backoffice supostamente melhor, e agora as declarações de royalties são assim: Desculpas pela qualidade de imagem Eu levei isso para o meu iPhone e Photoshopped. Esta declaração virou-se hoje e ele abrange apenas algumas vendas de e-book que ocorreram no intervalo entre a primeira e segunda edição (que é por isso que cobre apenas cerca de 150 vendas). Então, é uma das afirmações mais simples que recebi, mas ainda me sinto como um diploma em esteganografia para descobrir. Recebo o jist, mas eles fazem coisas loucas como dividir uma 12,5 royalty em uma seção para o 10 e outro para o 2,5. Então você tem 8220proporcional ebook royalty8221 seções adicionadas em. Você também obter o seu 8220reserve8221 volta depois de 18 meses e quando você adiciona aqueles em também. It8217s um desastre do trem comparou às indicações 2007-estilo. Sei que não sou o único autor de Apress a sentir assim. Se você não viu a referência a 8220reserves8221 nas declarações de royalty acima, role para cima e verifique. Essencialmente você obtém um corte de seus royalties escondidos por 18 meses (tecnicamente 82206 períodos 8221 8211, mas desde que um período é um quarto, que 8217s 18 meses), a fim de pagar por qualquer 8220returns8221 8211 livros que as livrarias enviar de volta para o editor que eles can8217t vender . Em 2007 eu acredito 8211 embora I8217m não tenho certeza 8211 que eu tinha 2200 de royalties tirado como reservas. Eu recebi então estas quantidades para trás algum dia recentemente. Curiosamente, os impostos para essas reservas foram retirados em 2007, por isso, mesmo que fosse 8220 dólares americanos, a renda não se materializou até 2009. Isso me confunde tanto quanto eu. Direitos licenciados Sobre as declarações de royalty acima, você deve ver referências a 8220Licensed Rights.8221 Meu primeiro editor me disse que estes são os pagamentos que você recebe para versões estrangeiras do seu livro, para inclusão em sistemas como O8217Reilly Safari e 8220similar.8221 I8217ve perguntou a Um par de vezes agora, mas nunca descobri o que esses montantes são especificamente para I8217m e não tem conhecimento de qualquer edições traduzidas de Beginning Ruby. (Update: Em 13 de outubro de 8211 há 6 dias 8211 alguém de Apress entrou em contato comigo para me deixar fazer perguntas sobre algumas dessas questões, mas eu haven8217t teve uma resposta ainda.) A Segunda Edição 8211 Um Novo Avanço Mas Royalties Voltar para 10 .. No final de 2008, um editor na Apress 8211 Michelle Lowman (Update: Quem, por sinal, foi um grande editor.) 8211 entrou em contato comigo sobre a escrever uma segunda edição de Beginning Ruby. Desde 2006, várias preferências de bibliotecas foram alteradas, os URLs foram alterados e houve algumas atualizações ou novas seções a serem feitas (como referências ao Ruby 1.9, novas bibliotecas, desenvolvimento de GUI e frameworks de Web alternativos). Agora, eu não estava particularmente interessado em fazer uma segunda edição por uma variedade de razões, mas o contrato Apress afirma que, se você não tiver o direito de fazê-lo sem você, alguém tem o nome de alguém batido no livro e, eu acredito , Você recebe dinheiro retirado de seus royalties para pagar vários pedaços de trabalho extra. Ter o meu livro puxado de debaixo dos meus pés didn8217t som atraente por isso me inscrevi para fazê-lo. A coisa estranha sobre fazer uma segunda edição é que it8217s realmente não tratado como um 8220second edition.8221 Em vez disso, it8217s como um livro de todos os novos. Você recebe um novo adiantamento (6500 no meu caso 8211 500 mais do que o meu primeiro, mas significativamente pior devido à taxa USD-GBP na época) e você tem que passar por todos os mesmos movimentos como com um novo livro. Sua taxa de royalties e os números de vendas são até mesmo redefinir de volta ao quadrado de um Então você está diretamente de volta para um direito de 10 depois de arranhar o seu caminho até 15 após 8000 vendas. Ick. Como o dinheiro não estava muito quente e eu estava mais interessado em vendas de impressão de qualquer maneira, eu entrei em negociações de segunda edição com a insistência de que a versão eletrônica do livro poderia ser livremente disponível Em cerveja, ao invés de fala. Afinal, as vendas de e-book8217s eram pobres 8211 a edição impressa outsold ele 17 a 1 8211 e Apress tinha feito um 7500ish pitiful sobre 2 anos dele. Como Seth Godin e, bem, centenas de outros autores, acredito que cópias eletrônicas gratuitas podem aumentar significativamente mindshare e vendas de impressão. Com um livro como Beginning Ruby. A maioria dos leitores quer um livro impresso, por isso parecia um não-brainer para manter as vendas fortes em um mercado com a crescente concorrência (de Manning, em particular). Eu não tenho nenhuma razão para acreditar que meu editor não lutou no meu canto, mas sempre que ela levou para as reuniões (onde todos os top Apress honchos decidir que livros para publicar e como), ela voltou dizendo que o top brass weren8217t afiado. Eu implorei e implorei, escrevi um par de súplicas, e me ofereci para conversar diretamente com essas pessoas para ter minhas idéias, mas nada de nada. O único compromisso que foi alcançado foi que um par de capítulos poderia ser lançado por mês, separadamente, que é tão atraente para os leitores como obter um décimo de um orgasmo. Até mesmo isso não fazia parte do meu contrato, e eu o empurrei. (Atualização: Alguns leitores têm, com razão, apontou que existem diferentes casos de negócios relativos a dar e-books, a fim de incentivar 8211 vendas de impressão e nem todos os livros são susceptíveis de satisfazer os critérios. Eu teria concordado para a minha primeira edição, Mas a minha segunda edição está entrando em uma atmosfera muito mais competitiva 8211 já não é o único livro até à data. Além disso, apesar de boas vendas e grandes comentários, o meu livro hasn8217t sido notado por uma grande swathe da comunidade Ruby mais experientes. Que recomendam livros para os outros Se o pessoal mais experiente pode 8220test8221 o livro de graça, they8217re mais propensos a recomendá-lo para os recém-chegados. Minha livro isn8217t mesmo listado na lista oficialmente aprovado ruby ​​ruby-doc. org 8211 como um aparte, Ele já foi com um comentário sarcástico ao lado dele, mas eu acredito que o mantenedor tem um rancor contra mim) Eventualmente o livro foi publicado em agosto de 2009 e eu ainda tenho que ver como ele vai vender. O que realmente virou minha tampa, porém, foi ver outros livros Apress como Dive Into Python e Pro Git recebendo o tratamento que eu queria. Você pode ler esses dois títulos incríveis on-line, na íntegra, de graça. Oferecimento de conteúdo eletrônico gratuito para promover a venda de livros impressos isn8217t um conceito alienígena para Apress tão someone8217s jogando favoritos por lá. Pirate My Book (Sim, isso é um ponto de interrogação.) (Atualização: Esta é a seção mais controversa e mais incompreendida. Eu basicamente estou dizendo duas coisas: 1 8211 se você pirata meu livro, eu acho que 8217s muito legal e 2 8211 I8217m executando uma experiência de pensamento sobre as formas em torno das restrições legais lá são Note que eu não estou dizendo 8220you deve pirata meu book8221 ou 8220please quebrar a lei e entrar em trouble8221 como alguns Slashdotters acreditam. Eu digo isto não é uma boa idéia se você Não estou ciente dos riscos. Então, não, eu não vou perseguir você e eu realmente acho que é muito bom quando vejo meu livro sendo pirateado, mas eu não posso advogar você quebrar a lei.) Minha reação a ver outros livros Apress obtendo o Livre, tratamento de versão eletrônica é: I8217m bom com você piratando meu livro (Atualização: 8220I8217m bom com you8221 NÃO significa 8220 Você deve, 8221 como alguns Slashdotters acreditam.) Agora, claro, eu can8217t participar ativamente em pirataria meu livro, It8217s ao redor Na abundância de 8220free e-book8221 locais e em RapidShare. Há mesmo links no Twitter para torrents como este. Estou feliz por você piratar meu livro, mas. Não posso ser um advogado, e não posso garantir o que a Apress faria a respeito disso, então você faria isso de suas próprias costas Então, uhm, don8217t pirata A única condição, é claro, se você gosta é que se você gosta do livro e Você acha que uma cópia impressa seria swell para possuir, por favor compre um 8211 mesmo se it8217s apenas para alguém que você sabe que quer aprender a programar (Atualização: I8217ve recebeu e-mails de leitores que passou a fazer exatamente isso.) Agora 8211 Um experimento de pensamento. De acordo com meu contrato, eu possuo os direitos autorais para todo o livro, exceto para a capa, tabela de conteúdo e os índices. O meu contrato também afirma que autorizei exclusivamente a Apress a publicar e reproduzir o meu conteúdo. Assim. Eu suspeito que se você pegou meu livro, removeu a capa, conteúdos e índices, e transformou-o em um PDF com uma capa de sua própria criação, Apress couldn8217t fazer nada sobre isso, porque tudo seria meus direitos autorais. Agora, eu não posso permitir que você faça isso, mas eu não iria persegui-lo se você fez Então, er, don8217t fazê-lo (Atualização: Sim, I8217m ciente é 8220cute8221 linguagem, mas a minha mensagem isn8217t demasiado obscurecido 8211 Eu gosto de ver meu livro pirateado Mas eu não posso exigir legalmente que você faça isso ou quebrar a lei) Conclusões Como uma maneira de tornar-se bem conhecido, ter algo incrível para o seu trabalho, ou para satisfazer uma ambição de escrever um livro e tê-lo publicado, escrevendo um livro e obtendo Ele publicado por um grande editor é uma má maneira de gastar seu tempo. Se um pouco de fama e respeito são tudo o que você quer, um livro é suficiente. Se você quiser ganhar uma renda séria de livros, você precisa bombear vários livros. É por isso que a maioria dos livros de tecnologia parece ser por autores que escreveram um único livro ou muitos livros (parece que Knuth fez essa observação uma vez). I8217d argumentam que a menos que você escreva um livro muito nicho (que é improvável que ganhe de volta o seu avanço) ou um livro que provavelmente será extremamente popular, você deve evitar os grandes editores e em vez disso encontrar um editor de médio porte que pode oferecer royalties mais atraentes. Os adiantamentos parecem atraentes, mas se a sua taxa de royalties suga, não faz diferença a menos que você acha que nunca vai ganhar de volta. Em vez disso, procure um editor como The Pragmatic Bookshelf que pode lhe oferecer 50 royalties. (Atualização: Houve um monte de FUD sobre a taxa de royalty Prags8217 que Dave contou aqui). Mesmo se I8217d vendeu apenas 2000 livros para 18 net (versus 8500 na Apress), I8217d ter feito o mesmo dinheiro O marketing que um editor Como Apress pode fornecer doesn8217t quadruplicar suas vendas, então you8217d estar à frente. Editores menores também são mais fáceis de conversar (de acordo com o que eu ouvi) e você pode negociar melhores acordos de licenciamento com eles. Eu certamente não poderia dizer que me arrependo da minha experiência Ruby inicial, no entanto. O acima é todo o material que eu aprendi por causa deste processo e há muito que você não conhece como um novato de nenhum livro. Começar mesmo um livro sob sua correia com um editor 8220regular8221 pode abrir seus olhos e ter um efeito grande em sua maneira de pensar. I8217ve também conseguiu trabalhar com algumas pessoas realmente interessantes na Apress (a maioria dos quais, infelizmente, deixou ou foi demitido no grande scaledown fizeram recentemente). O efeito de Beginning Ruby só foi positivo para mim, mesmo se ele não foi tão bem quanto eu queria. E poderia certamente ser mais mau do que recebendo verificações aleatórias com indicações de royalty indecipherable cada poucos meses October 8, 2009 183 Filed under Uncategorized Com este post eu quero manter o controle de alguns dos 8220Beginning Ruby8221 avaliações feitas em outros blogs ao longo dos anos. Sobre8217s Review 8211 8220 Ruby Início é uma excelente escolha para qualquer programador Ruby início. Em face da concorrência estabelecida, Beginning Ruby mantém a sua própria e continua a ser uma boa escolha.8221 29 opiniões sobre Amazon 8211 26 dos quais são 5 estrelas 3 são 4 estrelas. Pat Eyler8217s comentário 8211 8220Beginning Ruby é um ótimo livro para um novo programador, ou um programador novo para Ruby. É uma ótima alternativa para os outros livros de novatos em Ruby lá fora. 8221 Stephen Bartholomew8217s comentário 8211 8220Even com uma linguagem como Ruby, ensinando novatos completo como programar não é nenhuma façanha média. Peter Cooper8217s novo livro 8216Beginning Ruby8217 tenta tomar o novato completo por ser um programador competente.8221 Huw Collingbourne8217s revisão 8211 8220 Mais uma vez, então, posso recomendar este livro como uma boa introdução aos fundamentos da programação Ruby e sua seção atualizada na web Frameworks de desenvolvimento é bem-vinda.8221 Review on Slashdot 8211 8220It8217s um bom livro para alguém que quer aprender Ruby como sua primeira linguagem de programação. Poderia ser melhor. Eu gostei Cooper8217s pacientes e explicações pensativo sobre a instalação Ruby e RubyGems, como usar uma linha de comando, e que um editor de texto é para. Cooper fornece respostas a todas as perguntas típicas de Ruby-nuby, mas sua explicação de conceitos básicos é prejudicada pela ocasional confusão de referência a tópicos avançados ou mesmo irrelevantes. Para o programador experiente que aprende melhor lendo e trabalhando com exemplos este livro é uma boa escolha. Dave Thomas8217 Programação Ruby, The Pragmatic Programmer8217s Guide (a. k.a. the Pickaxe) é um concorrente difícil, mas cada livro tem uma quantidade considerável de material que não é encontrado no outro livro. Por exemplo, a referência da biblioteca núcleo Pickaxe8217s é exaustiva, mas tem apenas uma quantidade limitada do tipo de explicações tutorial que é Começando Ruby8217s strength.8221 7 de outubro de 2009 183 Arquivado em Uncategorized Let8217s Get It Started: Instalando Programação Ruby Joy: A Whistle - O Ruby Ecosystem e a Comunidade Classes, Objetos e Módulos Projetos e Bibliotecas Documentação, Tratamento de Erros, Depuração e Testes de Arquivos e Bancos de Dados Implementando o Ruby e a Orientação de Objetos Ruby8217s Building Blocks: Dados, Expressões e Controle de Fluxo Ruby Aplicações e bibliotecas Características avançadas do Ruby Atando-o juntos: desenvolvendo um aplicativo Ruby maior Frameworks de aplicativos Web: Rails, Sinatra e Ramaze Ruby e a Internet Redes, soquetes e daemons Desenvolvimento de aplicativos baseados em GUI Bibliotecas e gemas úteis de Ruby Apêndices APÊNDICE A Ruby Primer and Review for Developers APÊNDICE B Ruby Reference APÊNDICE C Uso Embora a migração de beija-flores não seja bem documentada por um grande número de registros de bandas, sabemos alguns fatos, e podemos tirar inferências lógicas sobre algumas das áreas desconhecidas. (QuotBanding significa travar um pássaro e envolver uma pequena tira numerada de alumínio em torno de uma perna. Esta é atualmente a única maneira de identificar os beija-flores individuais. As espécies são estudadas através da recolha de dados sobre um grande número de indivíduos.) Cada espécie de beija-flor tem sua própria estratégia de migração , E é incorreto pensar em quotummingbirdsquot como um único tipo de animal, todos iguais. Este artigo discutirá a migração Ruby-throated, porque é provável que mais pessoas vejam essa espécie do que todas as outras na América do Norte combinadas, e sua dinâmica é semelhante a outras espécies, embora as datas e locais variem. Uma exceção é Annas Hummingbird, que normalmente não migrar, mas pode andar para cima e downslope seguintes recursos alimentares sazonais. Os estudos de bandagem sugerem que as aves individuais podem seguir uma rota definida ano após ano, chegando frequentemente ao mesmo alimentador no mesmo dia. Nós não sabemos se qualquer pássaro individual segue a mesma rota em ambas as direções, e há algumas indicações que não. Por que migrar Como com a maioria de nossos pássaros migratórios, os beija-flores aparentemente evoluíram a suas formas atuais durante a última idade do gelo. Eles foram (e em grande parte ainda são) aves tropicais, mas como os grandes lençóis de gelo recuou da América do Norte, eles gradualmente expandiu suas gamas para explorar os recursos alimentares ricos temperado e espaço de nidificação, enchendo nichos desocupados nos EUA e no sul do Canadá evitando competição intensa Nos trópicos. Algumas espécies de aves canoras adaptaram-se completamente aos nossos climas norte-americanos variados, em parte tornando-se vegetarianos no inverno, e não migram. Mas os beija-flores são carnívoros (néctar é apenas o combustível para alimentar sua atividade flycatching), e dependem de insetos que não são abundantes em climas sub-congelados, por isso a maioria deles deve recuar de volta quothomequot para a América Central no inverno ou risco de fome. Alguns Ruby-throated permanecem ao longo da costa do golfo cada inverno em vez de continuar a América Central, talvez porque são demasiado idosos ou doentes para fazer um outro vôo do Trans-Golfo ou demasiado novo (dos ninhos muito atrasados) ter tido o tempo para crescer a gordura E forte o suficiente para migrar suas chances de sobrevivência dependem da gravidade de cada inverno particular, e muitos perecem em anos inusualmente frios. Outra pequena população inverna nos Outer Banks da Carolina do Norte. Migração para o norte A maioria dos colibris rubi-throated inverno entre o sul do México e norte do Panamá. Uma vez que os beija-flores levam vidas solitárias e nem vivem nem migram em bandos, uma ave individual pode passar o inverno em qualquer lugar nesta faixa onde o habitat é favorável, mas provavelmente retorna ao mesmo local a cada inverno. Ruby-gargantas começam a mover-se para o norte já em janeiro, e no final de fevereiro eles estão na costa norte de Yucatan, engolindo insetos e aranhas para adicionar uma espessa camada de gordura em preparação para voar para os EUA Alguns irão saia do Golfo Do México e siga a costa norte do Texas, enquanto a maioria aparentemente atravessar o Golfo, normalmente deixando ao crepúsculo para um vôo sem escalas de até 500 milhas, o que leva 18-22 horas, dependendo do tempo. Embora os beija-flores possam voar sobre a água em companhia de rebanhos misturados de outras espécies de pássaros, eles não quothitchhikequot sobre outras aves. Alguns beija-flores aterram em plataformas de petróleo offshore ou em barcos de pesca para descansar. Pássaros individuais podem fazer landfall em qualquer lugar entre o sul do Texas e Flórida central. Antes de partir, cada pássaro terá quase dobrado seu peso, de cerca de 3,25 gramas para mais de 6 gramas quando atingir a costa do Golfo dos Estados Unidos, ele pode pesar apenas 2,5 gramas. Também é possível que alguns Ruby-throats ilha-hop em todo o Caribe e entrar nos EUA através das Florida Keys. Os machos saem de Yucatán primeiro, seguido cerca de 10 dias depois pelas primeiras fêmeas. Mas a migração é espalhada por um período de três meses, o que impede que um evento catastrófico de tempo varre a espécie inteira. Isto significa que alguns pássaros chegarão a qualquer local muito cedo (os pontos no mapa de migração), mas a maior parte da população seguirá mais tarde, então você pode não ver o seu primeiro beija-flor por várias semanas. Cada indivíduo tem seu próprio mapa interno e horário, e quotyotquot aves podem chegar cedo, tarde ou em qualquer lugar dentro de um intervalo de dois meses. Uma vez na América do Norte, migração prossegue a uma taxa média de cerca de 20 milhas por dia, geralmente após a primeira floração de flores beija-flores preferem. O limite norte desta espécie coincide com o do Sapsucker amarelo-inchado se os machos mais adiantados chegam em Canadá antes que flores suficientes floresçam, raid sapsucker poços para o açúcar, assim como coma insetos travados na seiva. A migração para o norte está completa até o final de maio. Banding estudos mostram que cada pássaro tende a retornar todos os anos para o mesmo lugar que chocou, mesmo visitando os mesmos alimentadores. Veja o mapa de migração Ruby-throated para o intervalo de espécies e datas de chegada mais antigas. Migração para o Sul Ao contrário do Rufous e outros beija-flores das montanhas ocidentais, onde as noites de congelação são comuns mesmo no verão, Ruby-throats arent bem adaptado às temperaturas frias eles têm um tempo difícil abaixo dos mid-20s (F), e não entra torpor como Regularmente como seus primos ocidentais para conservar a energia. Para evitar o frio, ea escassez de alimentos quando as flores parar de florescer e insetos parar de voar, eles vão para o sul. Alguns machos adultos começam a migrar para o sul em meados de julho, mas o pico de migração para o sul para esta espécie é o final de agosto e início de setembro. Em meados de setembro, essencialmente todos os Ruby-throated em alimentadores estão migrando através de mais ao norte, e não os mesmos indivíduos vistos no verão. Isso é difícil de ver, uma vez que todos eles se parecem, mas tem sido comprovada por banding estudos. O número de aves que migram para o sul pode ser o dobro da viagem para o norte, uma vez que inclui todas as aves imaturas que nasceram durante o verão, bem como os adultos sobreviventes. Para um hummer que apenas chocou, não há memória de migrações passadas, apenas um desejo de colocar em um monte de peso (veja acima) e voar em uma determinada direção por um determinado período de tempo, então procure um bom lugar para passar o inverno. Uma vez que aprende tal rota, um pássaro pode retrace o cada ano contanto que viver. O impulso inicial é desencadeado pelo encurtamento do comprimento da luz solar quando o outono se aproxima, e não tem nada a ver com a temperatura ou a disponibilidade de comida, na verdade, os beija-flores migram para o sul no momento da maior abundância alimentar. Quando o pássaro é gordo o suficiente, ele migra. Não é necessário derrubar os alimentadores para forçar os beija-flores a sair, e no outono todos os pássaros em seu alimentador já estão migrando de qualquer maneira. Se você remover seu alimentador, os pássaros apenas alimentarão em outra parte, mas não podem se incomodar retornar a sua jarda o próximo ano. Recomendo continuar a manter os alimentadores até que o congelamento se torne um problema. Many people notice that adult males migrate earlier than females, because in the last month or so there may be no birds with red throats at feeders. However, remember that immature Ruby-throats of both sexes look much like their mothers. Young males often have a quot5 oclock shadowquot of dark throat feathers in broken streaks, and many develop one or more red gorget feathers by the time they migrate. Immature females may have much lighter streaks in their throats, but no red. There is evidence that fewer Ruby-throats cross the Gulf in fall than in spring, most instead following the Texas coast back into Mexico. Perhaps the hurricane season is a factor, and the genes of many birds with a tendency to fly over water were lost at sea during storms. We still have many more questions than answers about hummingbird migration. Until technology provides radio transmitters small enough for a 3-gram hummingbird to carry safely, banding is the best tool to collect data on individual birds. But since only a few dozen people in North America - almost all of them amateurs like me - are licensed to handle hummingbirds, progress is slow and the odds of recapturing a banded bird are very low. Hi, I8217m Leo. Im a hybrid software developer, designer, marketer and entrepreneur. I am the CEO of Ballistiq. a web software design and development company. A little more about me gtgt Ballistiq Web Development Looking for a trusted, North-American based web development team who has a great track record Ballistiq provides bespoke design and development services. Weve built sites and applications for top companies including Autodesk, NVIDIA, Gnomon School of Visual Effects, Allegorithmic, Luxion and more. Categories Ruby on Rails vs PHP 8211 The good, the bad Note 8211 this article was written in 2012. I8217ve added an addendum to update the article with latest thoughts on May 30th, 2014 at the bottom. I8217ve been developing with PHP since version 2 (a very long time ago). I had been wanting to get into Ruby on Rails and had played with it since version 1 but never had the chance to really use it in production seriously until this past year with Ballistiq. Since then, I8217m now coding 8020 Ruby on Rails and PHP, so I8217ll give my thoughts on the two. At the time of writing, the versions I8217ll be talking about are PHP 5.3PHP 5.4 and Ruby on Rails 3.2 (running on Ruby 1.9.3). The context of this post is comparing the two specifically for web development. Aren8217t you comparing apples to oranges Rails is a framework for Ruby. PHP is a language and has many frameworks. What I8217m mostly comparing is my experiences working with both ecosystems: PHP framework (there are many) vs Ruby Rails (the predominant framework). While some may get hung up over trying to compare the two and may balk at the title of the article, this is a legitimate question that many developers ask. Many developers want to know what are the benefitsshortcomings of both ecosystems and genuinely just want a clear answer. From the popularity of the article via Google, it8217s something that tens of thousands of people actually are asking. Isn8217t it just a preference Yes and no. Both the PHP and Ruby ecosystem are very powerful. In many cases, yes you can just boil it down to a preference. However, there are many strengths for both and it8217s useful to be able to compare them in a level-headed fashion. I8217m not religiously attached to one or another. I8217ve used both. My company works with both. Both are here to stay and play important roles in the global web development industry. PHP 8211 The Good Simplicity and Learning Curve What I absolutely love about PHP is its simplicity and relatively shallow learning curve. When you first get into PHP, all you need is a single HTML web page. Change the extension to. php. Throw in some ltphp code here gt inline PHP, run it on a PHP web server and off you go. It8217s really dead simple for someone totally fresh to get something usable done and deployed within a few minutes. This has been one of the strengths of PHP and why it8217s so darn popular 8212 designers and non-coders can be productive right away. This simplicity, however, comes at a cost. It is a double edged sword as it leads to a lot of sloppy, unmaintainable code. This leads people to use frameworks that force a particular coding standard. The benefit of PHP8217s simplicity and shallow learning curve is a really big thing going for it and this has business benefits too: it8217s easier to find people who know PHP. If you look around, Ruby on Rails developers are more expensive and harder to find. The good developers who really know Ruby and Rails (the L33T ) tend to be more hardcore devs. The documentation for PHP is also fantastic. I find the docs for PHP far more useful than the ones for Ruby and the Rails Guides. The user comments really help and there is a lot of example code that shows you how to solve common problems. It8217s Made For The Web One big thing about PHP is that it really is focused entirely for the web. It8217s not a general purpose programming language like Ruby (or PythonJavaCPerletc.). Many of its inbuilt functions are specific to solving web problems and this makes it a very straightforward language to program for the web. E. g. if you want to send a header to the browser, just use the header() function. An MD5 or SHA1 hash is simply md5() and sha1(). It8217s not as straightforward to do this with RubyRails as you have to load in libraries and use namespacesmodules to get to the same functions. Lot8217s of Resources PHP has a ton of resources, frameworks, applications and libraries available for it. From CMS8217 like WordPress and Drupal to frameworks like Symfony and libraries like Doctrine, PHP really has a lot of good resources available. When it comes to deploying a simple CMS, for example, I almost always default to just using WordPress instead of building a Rails app for it. I just feel that it8217s a much simpler solution. Dead Simple to Deploy Deploying PHP is dead simple. At its simplest, you just FTP the files to a web server (which we at Ballistiq never do 8211 we deploy using Git). Thing is, with PHP you don8217t have to know about or care necessarily about the web stack. Many hosting services just use a LAMP environment (Linux, Apache, MySQL, PHP), so as long as your files are in place they just run and that8217s that. Even using a framework like CodeIgniter is relatively simple as you don8217t ever need to use the command line 8212 you just copy the entire framework directory onto the server and run. That8217s it. PHP 8211 The Bad Its Evolution Led to a Lot of Bad Code This is not a direct feature flaw of PHP, but is the result of years and years of building on top of a simple scripting language that was specific to solving simple web problems. PHP was not always Object Oriented. Even when it did support OOP, for years it was not really OOP (missing important features like static methods), so programmers got around the problems through all kinds of shenanigans like using global variables or setting a local variable using a global reference pointer. E. g. Typical pre-PHP5 code These are just a couple of examples, but there are more which I won8217t go into here. It8217s unfortunate but is just one of the side effects of working with a language that has evolved rapidly. One thing that drives us crazy at Ballistiq is going into projects where we have to upgrade or maintain applications written with old PHP. This is the case with one of our largest projects where we8217re trying to upgrade a large app written in PHP4 code and it is horrific. A lot of sloppy code there that we have to work with. Better Coding Standards Lead To Really Purist Code As mentioned above, sloppy code is not an inherent feature flaw of PHP. It8217s just how people have used the language. As PHP has gotten more popular, it8217s gotten a lot of influence from enterprise developers who take a really purist approach to programming. When you go to conferences and listen to these PHP experts talking about best practices, PHP no longer becomes fun to program. You8217re almost looking at a Java program. Classes explicitly declare namespaces, importing namespaces, explicit getter and setter methods, explicit declaration of publicprivate methods, etc. The code becomes extremely verbose. Now If you want to see a framework that takes a more purist approach to things, check out Symfony. It8217s a great PHP framework that8217s ready for enterprise level usage but from a development point of view, I find it tedious. Ruby on Rails 8211 The Good Mature Framework The more I develop on Rails, the more I really appreciate and love it. I8217ve found that it enables us to create higher quality products for clients much faster, that are more maintainable. It8217s a mature and stable framework that many large companies are comfortable with introducing into their environments. Compare this with the PHP ecosystem that has many frameworks 8212 there8217s a risk of selecting a framework and finding that it8217s just not that well supported several years from now (we made this mistake). Speed and Development Joy I absolutely love working with Rails because as a development platform, it is extremely automated. So many menial tasks have been automated so that you just focus entirely on solving the business problem instead of hacking your way around a framework. Some things really going for Rails in this regard are: GeneratorsScaffolding 8211 Provide a very good starting point for developing around. Some PHP frameworks now provide scaffolding features. GemsPlugins 8211 the Rails community provides a wealth of plugins as Ruby Gems that you simply add to your project Gemfile and install. This significantly accelerates development and maintenance time as you8217re not trying to integrate disparate libraries, it8217s already done for you. Active Record ORM 8211 Of all the ORM8217s I have used (for PHP I8217ve used DataMapper DMZ, FuelKohana, Doctrine), ActiveRecord in Ruby on Rails is simply the best. It actually works and is remarkably straightforward to use. Integrated testing tools 8211 I love it that out of the gate, Rails has a testing framework that can be used. In PHP, many frameworks have only recently been trying to integrate PHPUnit, to varying degrees of success. As a programming language, Ruby is really quite an amazing language. Unlike PHP, it really is Object Oriented from the ground up. Its code is very concise and powerful. Gems (extensions) enable you to bolt on needed functionality. After coding in Ruby, I find coding in PHP (or anything else really) rather tedious. Ruby on Rails 8211 The Bad Steep Learning Curve My main beef with Ruby on Rails is that it actually has a steep learning curve. Do not believe the hype that says that it is really easy. They will show you podcasts where you build a simple blog application using scaffolding and voila Instant website. Nada poderia estar mais longe da verdade. Rails is seen to be easy because they have automated many things in the framework 8212 this does not make it easy to understand. Developing a Rails app and deploying it actually requires you to know the full stack. With PHP, you can just cobble together some inline PHP code, FTP it to a server and off you go. In Rails, you really need to know what you are doing from the web server (Apache or NginX), setting up Phusion Passenger and database engine. Then you have to deal with the asset pipeline process to prepare your app to run in Production mode. It8217s not as simple as running it in production mode 8212 you have to precompile your assets and make sure files are actually there. If they are not, Rails will simply blow up and you have to find out why by accessing the Rails logs. Compared to PHP, Rails is also unfriendly when it comes to errors. With PHP, it will spit out errors at you in development and the error messages actually make sense. Typically a page will render but the part with the error will show you which line the error occurred and the message is useful. In Rails, typically the whole app blows up. One last thing to throw in is that good Ruby on Rails developers tend to be polyglots. They are able to pick up and learn many languages. While beginners are battling to just learn Ruby, Rails people are using CoffeeScript instead of Javascript, SCSS (or LESS), and Slim or HAML. For a newcomer to Rails, part of the steep curve is not just learning Ruby and the Rails framework, but all these other languages as well Ruby is not an easy language I8217m sorry to offend some people here, but Ruby is simply not as straightforward as PHP to learn. It is by all intents an extremely powerful language. I choose to use Ruby simply because as a developer I feel it is a much better language than PHP. But from a learning perspective, it is not. Ruby has many features that are simply not straightforward for a beginner programmer to understand. One such concept are blocks, procs and lambdas, which Rails uses heavily. The classic Ruby on Rails example I will use is for creating a form: If you8217re new to Ruby, you can be forgiven for saying, 8220Wait a minute8230.what8217s f8221 Yes sir. Welcome to blocks. Here8217s a bit of an extreme example : Even as an experienced programmer, I went crosseyed when seeing the above line of code. It8217s very simple actually 8211 generate an 8 character random string. Another area is meta programming. Here8217s an example: I8217ve taught Ruby on Rails to experienced developers and this always trips them up. What exactly is hasone. hasmany and hasandbelongstomany. It looks like it8217s some kind of reserved keyword or declaration as these are not encapsulated in a method. However, in Ruby, ALL code is executed. Every line of code is executed, so hasone. hasmany and hasandbelongstomany are just methods that execute when the class is declared. Finally another thing that makes Ruby challenging for beginners is its loose syntax. Let8217s look again at the above code. It8217s not obvious (to a beginner) that hasone :address is invoking a method because the brackets are missing from the method invocation. In PHP, the syntax is stricter and this makes it simpler for beginners to know what8217s what. As a language, especially if you8217re coming in from others such as CJavaPHP, Ruby is challenging and it will bend your mind. Once you8217re up and running though, it8217s fantastic and many who have taken the leap really enjoy coding with it. Conclusion So from all of that, what do I conclude PHP is a friendlier entry point into web development than RubyRails. It8217s easier, there are more resources available and you can get results fast. Despite this, I personally enjoy working with Ruby and Rails more than PHP. For many of the reasons I8217ve described in this article, I just feel that the Ruby ecosystem offers a superior toolset for developing applications. I respect that the die-hard PHP fans won8217t feel the same way 8211 that8217s cool. My opinion has formed from working with both languages and ecosystems thoroughly in production. Since moving to Rails, I8217ve never really felt much of an urge to move back to developing with PHP and so all my new projects tend to be RubyRails. At Ballistiq. we develop in both. If a client project already has existing PHP code and we8217re developing for that, needing to integrated at the software level, we stay in PHP. If a client needs a brand new application, or we are building our own app use Rails. Addendum 8211 30 May 2014 Wow it8217s been a while since I wrote this and it continues to be a very highly ranked article on Google, which attracts a lot of traffic. Because technology advances at such a breakneck pace, I wanted to update this article with some new thoughts. PHP has come a long way since I wrote this article When I wrote this article, PHP was in a bit of a transitory phase as many folks were still using PHP 4 and trying to migrate to 5. Symfony 2 had not yet been released, and Laravel just was not a big thing. As of right now, PHP is having a bit of a renaissance. Here are some great technologies that really make PHP shine: Laravel 8211 As a framework, Laravel looks really excellent and many PHP folks have chosen it as their framework of choice. I can8217t speak for it because I haven8217t used it in production. But it does look good. Composer 8211 Composer is to PHP what RubyGems Bundler is to Ruby. It does package management that doesn8217t suck. For years the PHP community had to deal with Pear, which really didn8217t gain much traction. PHP web server 8211 For the longest time, developing with PHP on your computer meant that you had to rely on an external web server like Apache. Many devs ended up installing MAMP. As of PHP 5.4, PHP now comes with its own command line web server, and it8217s actually remarkably easy to fire up. Now, not everything works with the command line web server (I had trouble getting WordPress to boot up with it), but if you8217re developing with a framework that supports this, it8217s a much nicer and saner way of developing. Codeception 8211 One of our team members at Ballistiq gave a really nice talk about a testing framework called Codeception, and I have to say it actually looks decent, supporting things like Selenium and BDD style tests. HHVM 8211 Opensource project led by Facebook, this takes PHP and compiles it to bytecode that in turn gets translated into x64 machine code and runs really fast. This is a very interesting project that makes PHP highly performant and scalable. So PHP isn8217t going away anytime soon. Many people use it and put it to good use. However, I (and many web engineers) have moved on. As engineers, we8217ll hack in anything that we need to get the job done, however, by choice, I won8217t start a new project in PHP. Why I feel that there are more interesting solutions out there that are worth looking at. Why I still love Rails as a framework and Ruby as a language As I mentioned back in 2012, I really enjoyed working with Ruby and Rails. Despite it8217s steep learning curve, after a while I hit a groove and now the applications that we are delivering are so good that I can8217t imagine going back. Here8217s some of the things going for RubyRails that I feel really make it such a strong choice: Gems 8211 When I started coding in Ruby, Gems confused me more than they helped because there was too much 8216magic8217. Once I learned that you could (and should) just read the source code for gems, everything made so much more sense. Due to the pluggable nature of gems and the community8217s standards, gems can give your application a tremendous amount of functionality very quickly. Some gems that I cannot live without: Devise (authentication 8211 handles user logins, social sign on, forget password workflows and so much more), Paperclip (file uploads 8211 even handles uploading to S3, image croppingresampling), Simple Form makes forms incredibly simple to standardize and render on websites. Mountable Engines 8211 We did a mammoth project for a Fortune 500 company where after building the initial application, it was so successful that other departments wanted the same application, but with slightly different functionality and different UI. Rather than copypasting the application and having to support several codebases, we were able to extract most of the core functionality into a Rails mountable engine, and literally have one codebase but several websites. The client was absolutely thrilled with this and it was a huge win for us. Scaling 8211 Rails has a stigma of being unable to scale and they are referring to Twitter dumping Rails. We have not found any scaling issues with Rails and we have applications that run with millions of pageviews and hundreds of thousands of users each month. The fact is, majority of you will never have the scaling problems that Twitter had. And8230in fact, we found it easier to scale with Rails than with PHP. How First of all, Rails supports caching out of the box. You8217re able to do view fragment caching within your application code and use Redis as a cache store. That is a far simpler solution than trying to use Varnish which caches everything that goes through it and leaving logged-in users without caching. Using built-in Rails caching enabled us to scale easily. Secondly, Rails Capistrano Chef makes it very simple to scale to multiple server environments very quickly. Our typical Amazon AWS infrastructure includes Elastic Load Balancer, several application server instances a redissearch server, backed by an RDS database instance. We set up server provisioning with Chef, enabling us to provision a new ready-to-run instance in minutes. Simultaneous deployment complete with data migrations can be done with Capistrano from the command line. Literally, I type in cap production deploy:migrations and everything is magically deployed to all our application servers. Users don8217t see any downtime as we have Phusion Passenger Enterprise and rolling restarts. Background jobs 8211 PHP was designed as a hypertext pre-processor which means that it executes only when there is a web request. Compared with Ruby which runs a process. In Rails, you can easily set up background jobs using Sidekiq or Resque. This also adds to Rails8217 ability to scale easily. In our applications, we move a lot of stuff that can slow down requests like emailing users into background jobs. Now, PHP can do background jobs using Gearman but that8217s not standardized 8211 you have to install the PECL extension. In RubyRails, background jobs are a non-issue. You just do it. Rails is BORING 8211 Rails is now at version 4.x. It8217s a mature framework. It8217s boring now. The cool kids are touting NodeJS these days. Rails is boring because it8217s robust and stable. We8217ve developed apps in Rails now for some of the world8217s largest companies and people in their IT departments don8217t bat an eyelid. It8217s known that it8217s a good choice to build your (robust, enterprise-ready, scalable, performant) application on. Other technologies that I think are shaping the web AngularJS 8211 We introduced AngularJS into our client projects earlier this year for two Fortune 500 companies and it was a huge win. AngularJS enables you to build single-page applications that run in Javascript. Most of your front-end logic goes into AngularJS, and your backend simply because an API that serves JSON. Doing this, we were able to build highly performant applications. The user experience is very good with this approach because pages load extremely quickly as the browser does not have to do a full roundtrip request. NodeJS 8211 I started developing in NodeJS a few months ago and it blew my mind. What NodeJS is very good for is building networked applications. E. g. if you8217re building a real-time chat application, you can use NodeJS for that. Due to the maturity of Rails, I don8217t think we8217re moving off that anytime soon for building large applications, but to add real-time components, I would use NodeJS SocketIO . So what should you do Web development is becoming incredibly complex. The days of a single developer being able to ship a full application from start to finish are becoming more difficult. Even front-end can no longer be handled by a single hybrid designerdeveloper who can hack CSS HTML markup. If you are just starting out, I still recommend that you start with PHP. You will get results much faster, and this will fuel your growth and knowledge. Jumping into RubyRails as your first language might leave you really frustrated trying to get results 8211 remember, with Rails, you have to know the full stack so it8217s not just the language and framework you8217re challenged with. Once you8217re comfortable with building bespoke applications in PHP, you can then whet your appetite and start using other technologies like RubyRails and even NodeJSExpress, and you8217ll appreciate what these technologies offer. Many of the concepts you will learn from PHP in frameworks like Symfony amp Laravel will carry over to other languages and frameworks. Another reason why I recommend PHP as a great starting point is that it8217s very useful to know so that you can hack on things like WordPress themes and plugins. WordPress is so widely used today in business (especially marketing departments) and it8217s great to have software polyglots who can work with many different tools and platforms. The thing that you have to realize is that the Web is not about what language you choose to develop with 8212 it8217s about the standards and what it takes to get information in and out of the web browser. It doesn8217t matter what is on the server, as long as it spits out HTML and the right JSON data 8211 you can use C for all anyone cares. That8217s why there are so many web technologies from PHP to Ruby to Python to to Java and gosh Perl is still used (I met a guy that wrote a Shopify App entirely in Perl). So there you go. Keep on hacking You can do anything in PHP that you can in Rails and visa versa. That8217s enough for me to stick with PHP. As far as Rails being faster to deploy, I really doubt it. There is not much time that can be saved in PHP vs. another language with the existing frameworks I already use (unless of course, we build AI to start programming code). Nice article. I totally agree because I8217ve had the same experience coming from a PHP background over to RoR. I8217m just glad I8217m not the only one that thinks learning Rails is difficult. I8217m still trying to get my head around Coffeescript. I would like to offer some advice to readers, a really good way to learn Ruby and Rails is by doing the FREE SaaS course from Edx (edx. orgcourseuc-berkeleycs-169-1xsoftware-service993 ). Not only will you be learning solid Ruby on Rails, but you will learn good engineering aspects and end up with a certificate from Berkeley University as well Other than that, I can recommend the Ruby on Rails Tutorial 2ed by Michael Hartl. and Head First Rails (O8217 Reilly). Remember, the more you give RoR a chance, the more you8217ll love it. Great write up. Im more of a javascript guy who occasionally uses php for the server side. Since node came, started to use javasript on the server side too. A lot of the cool tools that I use like Jekyll, Sass and compass are written in Ruby, so I always got tempted to learn ruby. I have observed a lot of my colleagues moving to Ruby or Python because they feel that being a php programmer just doesn8217t get the same respect. Great, balanced article Leo, thank you for not hyping one or the other and remaining objective about your experience. Deployment complexity of RoR concerns me, while I like the other aspects. Nice article. Im both PHP and Ruby on Rails programmer. I choose Rails because unlike PHP there8217s too many to study depending on your needs. A lot of framework and cms. While Ruby, rails is all you need. you can do scale apps. Really helpful article, Leo. I8217ve been dipping my toes into web development for the last six months and have been working mainly with PHP, however Ruby on Rails is next on my list of languages. As an experienced web developer, would you suggest I continue with PHP and move on to Rails after I get some experience Or jump right into Rails Hi Michael. I think it is valuable to know both. Definitely in the current climate a knowledge of Rails will get you a job very quickly as there is more demand and less competition. If you are completely new to web development, I think PHP is a better starting point because you will get results faster, which will spur you on to continue in web development. I can8217t stress enough how small successes build on each other. You can build a good, custom MVC application quickly using something like CakePHP or CodeIgniter. When you do move to Rails, I8217d advise not to learn Rails first. Learn Ruby first and try using a framework like Sinatra to start with. My reasoning is that Rails has too much 8220automagic8221 which makes it very difficult to understand what is happening under the hood. If you don8217t understand what Rails is doing under the hood, and you don8217t know how to look in Rails source code and figure it out, debugging your applications can be very long and frustrating, especially for a beginner. Thanks for the helpful response Leo I definitely agree that learning the Ruby is super important before jumping into Rails. There8217s definitely a lot to learn for me still but I8217m super excited and motivated by each little success. Cheers Couldn8217t agree more. As a newer Ruby and RoR dev, it was instrumental that I learned Ruby first. While RoR is Ruby at its core, it handles a lot of the rudimentary tasks for you8230 hence, Rails 8220Magic8221. If you don8217t have a decent grasp on how to use Ruby without a web framework, what8217s going on under the hood will absolutely frustrate you, especially when it comes to debugging or even understanding what the right toolmethod is for the job. Great article, Leo I, like most others, appreciate the fair and balanced representation of both languages and their respective frameworks. or chars (8216a8217..8217z8217).toa Array. new(8).join First language I ever learned was Turbo Pascal. Then Java. First web programming language I learned was PHP. Very informative. I8217m new to programming and am looking at both PHP and Ruby as server-side languages (I8217ll decide which one to go with once I8217m in to it a bit more). I agree that PHP is easier to pick up 8216off the bat8217 but it is very hard to find good quality tutorials or guidance out there. It8217s ridiculous really seeing as it8217s been around for so long. On the other hand Ruby does have a steep learning curve (though learning PHP in tandem seems to have helped me understand it) but the resources for learning that are out there are both easier to find and a whole heap better. Code school, for example (check it out if you8217re new to development) is a fantastic resource8230 but doesn8217t even touch PHP. I see Ruby as the SS language of the future. I am working on Ruby on rails. Using Ruby on rails to build rock solid code thus quality websites that will be easy to maintain afterwards. Ruby on Rails is also well known for its coding convention, Agile practices and security strength. But it is valuable to know both Nice article. I8217ve been getting into web dev with Rails over the past few months and it8217s nice to see that I8217m not alone in my belief that it simply isn8217t very intuitive. The comparison is indeed like apples and oranges, but it is useful when considering which area to focus on studying. I8217m currently picking up industry experience with Rails, but am hesitant to commit to going the full mile in that area because the curve is so steep, and I don8217t know if I want to be a Rails dev. Good article. I feel exactly the same way. After gt10 years php and Java I learned to like ruby. And the peace of mind that rails gives me in a stressful project. Blindly knowing where to put new code even after 12 hours of coding at 4 in the morning. But I really hate the complexity you mentioned concerning the infrastructure setup. Some people enjoy that 8211 I don8217t. Live is too short for such stupid tasks. I always wonder why can8217t the RubyRails folks manage to create a setup routine that8217s as as easy as php Why do I have to fight with Ruby version gem version mac OSX version inconsistencies for 2 days before rails server will run the first time Grmpffff8230. Actually, you don8217t have to 8220fight with8221 versions. 8211 Ruby versions: Generally managed by rbenvrvm et al. (rbenv is officially recommended by Rails 8211 rubyonrails. orgdownload ). If your native Ruby satisfies the Ruby version required by the project at hand (e. g. 1.9.3 for Rails 4, 1.8.7 for Rails 3.2) then you are good and you don8217t need those tools. But if you are doing client work, or even experiments (e. g. your main project is Rails 3, you are experimenting onplanning on switching to Rails 4) you8217ll need multiple Ruby versions running simultaneously in the same machine. You can use Vagrant et al. but that can8217t beat having it in your base OS. Rbenvrvmetc makes this possible only with a few lines of commands. You can say that one can just use the latest possible Ruby, but it doesn8217t always work like that (compatibility problems etc). Now try that with PHP. There are PHP version switching tools but they were nowhere near maturefull-fledgedeasy-to-use as rbenvrvm last time I checked. 8211 Gem versions: Seriously Show me a single languageframework with a packagedependency manager that doesn8217t involve version numbers (e. g. PHP8217s composer, Python8217s PIP, Closure8217s Leiningen, Java8217s Maven) Ever heard of DLL Hell 8211 Mac OSX: I8217m an Ubuntu user but I8217d be surprised if you can8217t get anything related to RubyRails working in MacOSX, seeing that most Rails developers are using Macs. 8211 You need to to install rbnevrvm on a machine only once. After that, you can install any version of Rubies and Gems in a matter of minutes. And with Heroku, you can see your thing in interwebs in seconds. And you have proven deployment tools like Capistrano which works for any empty Linux box. Yeah, PHP shared hosting is really ubiquitous (in most of which you still can8217t reliablysecurely run modern PHP frameworks), but here the scopes are really different. 8230from a long time PHP user who is busy switching to Laravel 4 and Rails 4 at the same time in production projects for the last 1-2 months. I8217m just finishing up a big L4 project and about to get started with ROR myself. hi leonard I am from India this article is very useful I want some suggestions on building a big eCommerce website. I have a good experience of making website in asp, asp Ajax and sql server 2008. Now I am thinking about moving from Microsoft (because of cost). Please help me choose between php(plain),php with mvc framework, django (not rails because of steep learning curve and updating the website after the host has updated the version).I have no experience on any of the above three. and I will develop alone and I want to cost to be on lower side. Any help would be useful Thanks for this article. As a programmer who8217s been out of the loop for a while (no pun), I had suddenly been preached to about RoR by kids who had never been across other languages. as if RoR was the be all and end all. Your article clarifies all the pros and cons very objectively. Much appreciated. As a would-be programmer starting out and slightly overwhelmed with all the languages and pressure with choosing one: really interesting article. Thanks Thanks for this Article. I8217m using PHP (Laravel framework) for development and Codeception for automate testing. Should I try RoR I8217ve heard that RoR have testing amp deployment tool which help us saving time a lot. Do you have any recommends for me. Thank you in advance We can not compare a programming language with a framework for a programming language. If you don8217t get this then you must start to learn again. A very well considered, helpful and well written article. Thank you Leo. Just read your article. I started my developing 8216career8217 in ASP webforms, which was quite easy and then switch to MVC with scaffolding, razor, nuget, entity framework, jquery, etc. It seems to me that Microsoft8217s stack is well-build and although I found it hard to learn MVC, it all fits together. Maybe they have 8216stolen8217 all good ideas from other frameworks and languages but they combined them very well and build a great IDE. So why does no one use it these days I read a lot of articles about what framework and language is the best, but they never compare it to ASP. Is it 8216just8217 because it8217s Microsoft The best article i8217ve ever read about ruby n php. Thanks for this Meanwhile, in Morocco: Hi. I loved your blog and it helped me a lot. Thank you so much I wanted to ask you one thing My first Rails app is a mobile app that will start with almost 1 million users (from another app my company is buying) and also a web application, like Facebook that you use in the browser and on your iPhone. I don8217t know how many nodes I can start with and I can8217t find a lot of information online. We have one server (16 GB RAM) I am using to test load balancer, database replication I can create as many VPS in the server as it fits in this server. I don8217t know if 16 GB will be enough for 1 million users but I created 6 nodes for staging (and learn): 8211 one with Nginx for load balancing (512MB) 8211 two with Unicorn for the Rails application (1GB each) 8211 two for MySQL (one master, one slave, but I still have to learn how to make Rails read from slave and write in the master, 2GB each) 8211 one for files (512MB shared via NFS with the load balancers and apps, where paperclip will write). The database will have a lot of writes. What architecture configuration you recommend Am I too wrong I used small RAM because I will use more for production but I don8217t know if 6 nodes is enough or if 16 GB will be enough. Can you help me Thank you 1 million users who are logged in, or 1 million users per month who are mostly just browsing the site Also, is the Rails application going to just be for an API or will it actually deliver the pages It also depends on the memory footprint of your application, if it is large or not. 1. 16GB is not likely enough for 1 million users if it is a reasonably sized application, and for that number of users I wouldn8217t put everything on a single server anyway. I8217d load balance across 2x 16GB (or 32GB) servers, quad cores minimum and scale from there. Remember, Ruby applications tend to bloat with lots of gems that you load in. The typical way to scale is to get as much memory as possible and run as many concurrent processes as you can in memory. 2. I would not use Unicorn. It is flaky and consumes a lot of memory. For that kind of scale, I would use Passenger Enterprise. If you want to be cheap and not pay for the Passenger license (which is worth it), you can use Puma. 4. Cache, cache, cache. Have one server just for Redis and cache the hell out of your application: guides. rubyonrails. orgcachingwithrails. html 5. Move slow processes into Sidekiq for background processing. Muito obrigado. It is 1 million users registered but usually 20,000 to 300,000 concurrent connections. And it8217s HTML and JSON, depends of the extension. We want to grow, of course, so need to be ready to more. I thought Unicorn was the best. I was using memcached but I will try Redis. Thank you very much again. It was hard to find something online explaining how much memory and how many servers in the load balancer and things like this. Just think about this: if Facebook was done in PHP, which is probably the most robust and used web application in the planet, you don8217t need to be a very smart person to realize php is far from being a bad programming language. in fact, PHP in the next 5 years will become the definitive best web programming language on top of every other one by far. Why Because its syntax is more human readable. The only reason why RoR is so trendy, is because it did very cool stuff a few years ago not available in php. But php is getting better day by day, frameworks like laravest are getting tremendous attention, and even bringing back old php users who are dropping RoR and coming back like prodigal sons. Yes, RoR deserves the credit of pioneering MVC and many other things, but it lacks the beauty and simplicity of C syntax, which will reign forever and ever. There8217s a lot of hype regarding RoR, most people try RoR just because they want to feel trendy and cool, one of the reasons most hipsters use it. Don8217t be a victim of the phenomenon. PHP is not a trendy thing, PHP, without all the noise and propaganda, still dominates the web. Juan David Pasts Rivera Another alternative is Meteor, which is great, is a framework on top of node js, is the one I like the most from all that I have tried: derbyjs, deployd, sails, express, from what I remember. Even when it8217s not comparable with Angular, Meteor supersedes it since you have 2 way data binding and backend logic at the same time and written in JavaScript, also you don8217t have to learn ng attributes. PHP has Facebook as a great representative, but its syntax is not as simple as you can get with Meteor and preprocessing packages. Anyway, scaling is always another whole story, it8217s a huge work which can be done in all languagesframeworks, I am not sure in which of them is easier though. If that8217s so then why does nobody choose to write apps in COBOL or BASIC anymore Why would you choose CoffeeScript over Javascript Why has Apple created Swift when people can just as well use Objective-C Why does it take a non-speaker on average twice as long to learn Russian compared to Italian To say it8217s all about preferences and claim that somehow all languages are equal is pretty naive. I like Php spent a lot of time learning it built most projects in Php and will continue doing so. The only reason I8217m learning ROR now is because I get tons of job offers some remote. I look at it this way freelance jobs I8217m using Php. Contract long term company jobs ROR I guess. I8217m currently in between angularjs now because at my company we wanted to try this out with Ruby as the backend. So imagine the steep learning curve I8217m going through for both of these languages Ruby and AngularJS at the same time.

No comments:

Post a Comment