Programming has become more and more just integrating one technology with another. Or is it?
This leads to the question:
Should I write it myself or reuse the work of others?
Some say you shouldn't reinvent the wheel and just reuse code as much as possible.
Well it might just not be that easy. Before running for the hills and be convinced this is all there is to it, I'd like to show you that it is in fact a complex matter.
Let's take the simple example of a database. Obviously you aren't going to write a database yourself!
Well let's see.
Here we'll use 'database' as the technology to be used. Just to have something less abstract.
So you'll need to learn how to use your database. We have SQL these days. This helps a lot. Sadly not all technologies have a unified way of doing things and you'll spend a lot of time learning a new language. As a matter a fact most technologies just have a different interface on how to use it.
Not to mention what happens if you think you know the language but are insufficiently trained. I've seen it happen for Maven once. We had a few people that knew Maven. It came to prove that actually all they knew was the syntax. There were hundreds of problems we tried to solve the wrong way. At the end the concepts were misinterpreted and it was a big mess. Months were lost trying to do it the right way. Not to mention they never actually adopted the correct way of using Maven at the end since they didn't have the time to integrate it. So they still experience the same problem. They still don't know for sure what artifacts they'll get and their build still takes half a day. While at the end the project is fairly simple.
I can have their build work properly in ant (which I know much better) in a few days. They lost months already.
So short tip is: Learn your tools properly. Without it you might just lose a lot of time. Don't skimp on training.
The next thing you'll need is a way of debugging the tool. You'll need to know why your database isn't doing what you expected.
This is where lots and lots of tools fail. If you're in luck you find a forum that will tell you what silly mistake you've made.
On the other side I've seen more forums containing 'Yeah I have that problem too' or 'Yes, fixed it!' rather than actual answers.
I've also seen solutions not fit for environments that are in production. Much like: 'Ow, just put change the configuration and restart your database and do this and that.'
Well, I can't just go around and switching databases off and on again on production environments without losing customers...
Also following the advice of someone I don't know I can trust while it can cost me or the company money? Nah.
Tip is: If your database (or tool) has no easy way of debugging it, it's worthless. You'll lose days and if you're anything like me, you'll lose your temper -- a lot!
I've also had a bad encounter with Hibernate. It was working as expected and it was fun and games until we wanted something kind of strange.
They had a problem and fixed it by hacking it away by doing the work of hibernate by using hibernate. After debugging for days -- and I was lucky to have the code -- I found a chicken vs. the egg problem.
We lost actual months to fix it. At the very end I understood that what Hibernate was doing was in a way correct but not what we needed.
Don't get me wrong, Hibernate is good tool but wasn't fit for the job.
Tip: Ask an expert if this tool is actually what you need. Can it actually do what you want?
Another aspect is that you might just not need all the features it has. Maybe you are choosing the wrong tool?
If all you want to do is some simple logging, maybe you don't need a database after all?
It's what I call feature drag. You're dragging all the features and their special cases with you. For no good reason. One might think, well then don't use that tool then? Sadly most of the time it's just that tool that is mature and remotely close to what you need.
Tip: Use the tool you need, don't use anything too complex.
Integrating the tool into your product is also a burden to carry. You'll need to install it separately, also make sure the licenses are ok!
I've seen many tools that actually need you to compile with their stuff taking yet another bunch of days and unforeseen problems.
But at the end the advantages are also clear:
1) You have a community that might be able to help you with your problem. (Not guaranteed of course)
2) You don't spend time and money writing this component & fixing its bugs.
On the other side:
If you write your own tool.
1) You (hopefully) understand your code.
2) You can debug and fix problems yourself
3) You wrote it, so you understand how it works.
4) It's exactly what you need.
(5) I like writing code :))
So to conclude:
The equation is not an easy one. You don't want to write your own database, that's for sure. But also don't go around using third party tools for anything trivial.
Honestly if you yell -- oh that's easy! Just use a third party component or you'll be reinventing the wheel -- without thinking it over, you deserve to get hit in the face with a shovel, twice. But that's just my opinion, I could be wrong.