website stat

Do not reinvent the wheel!

Call it whatever you want. Do not reinvent the wheel, do code refactoring, search for examples.. but the message is the same: why do all over again if others have done it before?

This comes as an intro to what a I found while I was looking for a PHP calendar. One could do it and implement his own calendar for whatsoever reason but let’s be efficient. They have done it before, they provide great examples and it is Free Software, meaning that you may use it as ever you like.

The least I could do was to thank them and publicize a little Keith Devens work. Thanks :-)


8 Responses to “Do not reinvent the wheel!”

  1. andr3
    Published at November 23rd, 2005 at 7:36 pm

    Mario, i can understand what you’re saying… if you’re looking for a solution that already exists, don’t spend time redoing it. But, what if you want to either have a go at it or try to make something better/more close to your objectives? Coming from a guy who handcoded a CMS when there were so many good solutions out there, this might seem a bit biased, but i believe that if everyone settled for the available solutions then there wouldn’t be alternatives. And if you end up developing your own solution then you’ll end up learning something in the process. That’s always good. ;)

    It depends on the mindset.. if you’re trying to find a one-time solution to your problems or if you’re willing to dedicate a part of your time to building something. I’m sure if you ended up coding a calendar in PHP it would end up satisfying other people as well. And then, someday, someone would be making the exact same post you just did, but with your name on it. ;) Of course, don’t do it simply for recognition.

    Having said that, you’re right. Don’t reinvent the wheel, but if you do, do it well. ;) hehe

  2. Marco
    Published at November 23rd, 2005 at 8:15 pm

    Desculpa responder em português, mas cá vai, um professor que tive na universidade na cadeira de POO entre outras, que dizia que temos de ser preguiçosos quando estamos a programar, temos de reutilizar e se já existir soluções para o nosso problema que não estejam protegidas, reutiliza-las/adapta-las, mas se encontrar-mos bugs nessas soluções temos de os corrigir, e de submeter as correcções para quem desenvolveu o original. E eu sigo a mesma técnica, pelos vistos tu também.

    Disclaimer: Também produzo o meu código, não reutilizo tudo o que encontro, também tenho prazer em criar código.

  3. mlopes
    Published at November 23rd, 2005 at 9:11 pm

    andr3,

    As you said, it depends on what you’re doing. This is a small set of the whole project so my question was: why waste time? Definitely I prefer to make use of the Free/Open Software’s model so I can use and improve the software. I’ll redirect improvements to the original author. This answers to what Marco said, stating that code reusing is a nice practice. It is. That’s why there’s Refactoring (buzz word :-)

  4. Cláudio Franco
    Published at November 23rd, 2005 at 9:14 pm

    Tal como o Marco, desculpa por responder em Português.

    Também concordo com o foi dito por alto anteriormente.

    Agora e cada vez mais há uma tendência pra produzir “bibliotecas” de utilização genéria e bastante adaptavel tal como esse Calendário que mostraste.

    Tomo por ex na construção de Websites lá na empresa. Pegar numa solução como o Mambo seria completamente errado para o nosso caso. Por outro lado sentimos que o nosso rendimento subiu bastante a partir do momento em que começámos a utilizar algumas bibliotecas por aí, assim como algumas nossas (que infelizmente por questões contratuais não as podemos divulgar).

  5. David Ramalho
    Published at November 24th, 2005 at 12:57 am

    I have a love/hate/hate relationship with full-blown applications (rather, web applications ;) ) and/or frameworks , the simple fact being that they are never exactly what you need, and the things you need tend to require major core changes that you will simply never make :) . On the other hand, exactly how many of you don’t think “I can make this, so why don’t I” at least … 10 times a day ? :)

    I am more flexible on small, specific libraries, at the very least we can always make a few Adapter Objects to take the things the libraries do best, and give them our own little twist :) .

    I like the post, and I like this discuttion ;) , congrats man

  6. mlopes
    Published at November 24th, 2005 at 9:20 am

    David,

    That’s the point you see :-) The library I’ve cited is a small function that takes about 30 lines (in a pretty unorganized code) to create a very simple calendar (well, it has some nice functionalities). So it fits the task I was looking for. Why redoing it?

    On the other hand, if you need a CMS to fit your needs, like andr3 said, then you may well be considering building it from scratch if it does not fulfil your needs. But if it does, there’s no point in reinventing the wheel :-)

  7. David Ramalho
    Published at November 24th, 2005 at 3:42 pm

    It bugs me a little that the things throws HTML at us, which somewhat (but not really) reduces it’s uses .. a plug-in structure with converters would be nicer :), [pt: mas é ser picuinhas ;)] , but yes, I agree with you

  8. Personal Bytes » Blog Archive » Zend PHP Framework
    Published at December 6th, 2005 at 2:26 am

    […] Zend PHP Framework will provide a bunch of components that can be glued into your application. The idea is to avoid re-inventing the wheel (as I’ve stated before) by reusing very simple yet powerful libraries. Zend aims at the same target as .NET, Ruby on Rails, Spring, all do: make sure the framework handles most of the tasks. […]