Why am I reinventing things?

I've written test framework (very small (it's probably too much to call it framework)), DI (dependency injection) implementation (very pure and that fits only my own requirements), database migrations tool. Why did I do that?

That's easy: because I didn't have what I needed. And I'd like not to write all those stuff if I had a good solutions.

Testing framework

I started working on test framework when I got an issue to implement functionality with strong restrictions. I just couldn't trust myself - I should recheck all my code. I honestly tried PHPUnit firstly. But it didn't work out.

All the time when I try PHPUnit it gives me a pain: once I could not install the whole package properly, then there was missing some important file - it always was difficult to use PHPUnit. (And I still do not understand how people can use such difficult product.) I just had no choice: I had to write very simple checkings for my code but I could not do that with PHPUnit because PHPUnit refused to work. What I wrote is very stupid simple couple of classes and executing file that have the basic method to make assertions.

Actually when people need tests they need a simple tool to make assertions of their code. So, tests should be integrated into project with as few efforts as possible. And they should just work.


The same story with DI. It's cool (and true way) to use DI. Once I should work on project where wasn't DI but I already was used to Symfony-way. And I decided to add DI into project. I tried two or three different implementation. But finally stopped with Symfony's, although it wasn't neigher easiest one nor most compact one. But it just worked (with really few efforts). Now on my own project (php project without frameworks) I implemented DI to have simple way to access my little services and not to have additional dependency in my composer.json.

That's the other reason why people reinventing something - because it adjusts dependencies list. Dependencies are ok, but it's ok when you can control them. Yes I could take Symfony DI again but I didn't want to have another one Symfony component in project because of thing that I could implement in more easy way.

Database migration tool

Database migrations tool was written because I couldn't find the package I was looking for. I used it once but forgot its name. I like its simplicity and I just tried to reproduce it.

I like when the tools I use are as stupid as possible. That makes them the same as you because you know what they consist of. They are not *something* magic anymore.

My solutions are not the best but they are the best for my needs.


I think reinventing is good. At least because it makes you think about things you use. It helps to understand your tools better - just because after reinventing them you understand things deeper.

By the way, Linus Torvalds started Linux just because he didn't have what he needed. It explains why people will keep doing this. Reinventing moves us forward.