Tag Archives: wxpython

Porque eu reescrevi o Quivi do zero

Joel Spolsky, programador conhecido, disse em seu blog:

(…) Eles [da Netscape] fizeram isso tomando a pior decisão estratégica que uma compania de software pode fazer:

Eles decidiram reescrever o código do zero.

Em concordo, a princípio. Muitos projetos anunciam que foram “reescritos do zero” como se isso fosse algo maravilhoso, e na maioria das vezes, é só um sinal que a nova versão provavelmente tem mais bugs que a anterior.

Mas peraí, eu acabei de reescrever o Quivi (um visualizador de imagens e leitor de HQ’s / mangás) do zero! Por quê, então?

Bom, pensei que seria necessário me justificar. Essas são as razões:

  • É um projeto pequeno. Reescrevê-lo com certeza não é tão difícil quanto reescrever um navegador!
  • Eu não aguentava mais C++ (a linguagem de programação que eu utilizava). Claro, isso não é exatamente culpa do C++. Ele tem seus usos — a ferramente certa para o trabalho certo, e tudo o mais. Mas para escrever um programa de desktop? É canhão para matar formiga. Se você consegue (e gosta!) de fazer isso, eu admiro você. Mas eu não tinha mais motivação para trabalhar no Quivi.
  • Eu adoro Python (a linguagem de programação que eu uso agora), e claro,
    não sou o único. Programar é divertido em Python, tanto que eu tive a motivação de reescrever tudo, para começo de conversa! E claro, agora vai ser muito mais fácil para eu continuar trabalhando no Quivi.
  • Eu podia mudar de bibilioteca de interface. O SmartWin é uma boa bibilioteca, e use templates de formas interessantes; enquanto eu programava o Quivi eu acabei participando do desenvolvimento do SmartWin também. Mas ele tem os seus bugs, e justamente porque ele usa templates extensivamente, compilar um programa que o utilize é lento demais. Eu mudei para o wxPython, que é uma biblioteca de interface muito madura — e multi plataforma ainda por cima.

Claro, existem algumas desvantagens com a mudança. O pacote inteiro é muito maior devido às dependências (o instalador foi de 900K para 5MB!). E o programa é um pouco mais lento, principalmente na inicialização, e usa mais memória (9MB para 30MB com nenhum imagem aberta). Mas eu acredito que foi um bom compromisso.

Reescrever do zero deve ser estudado com cuidado, e neste caso, acredito que foi uma boa idéia. O Quivi é um hobby, e acho que o ponto principal é me divertir escrevendo ele, e atender às necessidades dos usuários. Espero que eu consiga fazer os dois com esta nova versão (que será lançada em breve).

Why I rewrote Quivi from scratch

Joel Spolsky, popular software engineering, said in this blog:

(…) They [Netscape] did it by making the single worst strategic mistake that any software company can make:

They decided to rewrite the code from scratch.

I agree, mostly. Many projects market that they’ve been “rewritten from scratch” as if it was something marvelous, and most of time, it’s just a sign that the new version probably has more bugs than the previous. But, wait, I just rewrote Quivi (a image viewer and comic / manga reader) from scratch! Well, why?

Well, I thought I really had to justify this. So here are the reasons:

  • It is a small project. Rewriting it certainly isn’t as hard as rewriting a browser!
  • I couldn’t stand C++ anymore (the programming language I used before). Of course, this isn’t C++ fault per se. It has its uses — the right tool for the right job, and so on. But to write an desktop application? It’s overkill. If you manage to pull it of, hey, kudos to you. But I had no motivation to work on it anymore.
  • I love Python (the programming language I use now), and of course, I’m not the only one. Programming is fun in Python, so much that had the motivation to rewrite Quivi from scratch in the first place! And of course, it will be much more easier for me to keep working on Quivi.
  • I could change GUI libraries. SmartWin is a nice library, and uses templates in very interesting ways; when programming Quivi I ended up involved with its development too. But it has its bugs, and because it uses templates extensively, it’s awful slow to compile an application that uses it. I’ve changed to wxPython, which is a very mature GUI library – and cross platform to boot.

Of course, there are some downsides with the change. The whole software package is much bigger due to the dependencies (the installer jumped from 900K to 5MB!). And the program is a little bit slower, mainly when starting up, and uses more memory (9MB to 30MB with no images loaded). But I think it was a good enough trade-off.

Rewriting from scratch must be considered carefully, and in this case, I think it was a good idea. Quivi is a hobby project, and I guess the main point of it is to have fun writing it, and to make users happy. I hope I can do both with this new version (which will be released soon).