Recently I come to a dead end with one of my projects. I felt it doesn't bring value to me, to people that use it, and to neither to the open-source community. I felt sour about it for the last 3 months, confused about what to do next.
When I created this project in 2016, it worked well. It worked well, and it brought me value. I enjoyed it, and it was exactly what I needed. I was also frustrated by the previous tool I used - Sculpin - that didn't work for PHP 7. Statie was a pet project for me, to code website in Markdown and PHP and publish it on the Internet via GitHub Pages for free.
The 0 $ was partial motivation, but I was astonished much more by the miracle of deploying the PHP app into HTML and CSS. In times of MVC frameworks build on Request and Response, it took me many days to shift my mind.
I had my first talk about Statie abroad, in Berlin I think, and I enjoyed it. Why? It was my first talk in English, and I was so scared about the feedback and people will understand my poor English (at least what I thought about it).
I wrote a few posts about it and also used it for our community website Pehapkari.cz - proudly of a piece of art at that time. I mean, anyone could edit the website on GitHub, and it was deployed to production after merging the pull-request in a matter of 5 minutes. How long does it take to projects, you know?
Also, it didn't got much popularity:
The first signs are very subtle. Few of my PHP friends used Jekyll or Sculpin around 2017, then switched to projects not written in PHP - like Hugo or Gatsby. I didn't think much of it.
Statie generated code from PHP. When you change the code, it runs full PHP command and regenerates the whole website, even if you change only one post. To make this fast, we used Javascript. Write code in PHP and use Javascript to run PHP to generated HTML and CSS... it started like scratching behind the ear with middle toes of both of your legs.
Our Pehapkari.cz community grew further than we first imagined. In Spring 2019, we started to need more than just a static website. We needed forms, cron jobs, and emails.
How can we make it happen? Symfony, DigitalOcean, and Docker came as a way to go. We switched from Statie to Symfony. I was surprised how easy it was. It might seem right, but it was a bad sign for Statie.
The next sign came in the Autumn of 2019. Statie dropped Latte support, as it was buggy and didn't work well with JavaScript rebuild. What was Statie? A Symfony Kernel? Static Site Generator?
A few months later, I felt like I'm running in circles. Something was wrong, but I didn't know what it was.
What you know you can't explain, but you feel it. You've felt it your entire life,
that there's something wrong with the world.You don't know what it is, but it's there,<br> like a splinter in your mind, driving you mad
What now? One of the few things that help me in complicated situations with coding is Occam's razor.
I paused and asked myself a few questions.
What main purpose of Statie?
How do I use it?
Why was it so easy to switch to Symfony?
What is it similar too?
How is it unique to anything else on the market?
A unique selling point is a term from a business. If investors want to get an idea about startup value, they ask CEOs what their product exceptional compared to the competition is. It can be convenient in coding as well. e.g., how does your private MVC differ from Symfony MVC? In only 5 %? Then it's obvious it would save you huge costs to switch to Symfony. Occam's razor in practice.
Saying that the last question bugged me the most: How is it unique to anything else on the market?
Well, it's like Symfony, but it generates static website. So I made a Symfony application that generates a static website? Isn't that what Symfony does anyway? When we visit a controller, it shows HTML and CSS after all, right? It's just not cached... but is it though?
I tried a simple demo a week ago. When I render Symfony controller to string... I got a bitter-sweet surprise: it's HTML.
Then I realized a simple truth: I wrote a Symfony clone all along.
You would say, "why change something that works"?
Sometimes, a new opportunity is waiting behind the corner. But to allow an opportunity to come, we have to make space for it first. If we'd stick with old phones or GSM, we block ourselves from using smartphones with an instant internet connection.
Remember not to have high expectations. The next thing doesn't have to be as impressive as it often seems. It's like with relationships with man or woman, a new friend, a new job or a new country you move in. If we let go of something that doesn't work for us, we can't expect the next thing to solve all our problems.
There are no solutions. There are only trade-offs.
It will be only better and that's good enough because that how we learn and grow – 1 % at a time.
I realized I made the project that worked before, but doesn't anymore. And that's the lesson for open-source I want to see in the world. I don't want to spread bad habits amongst programmers who read my code when I already know it's wrong. I feel it's my personal responsibility to correct mistakes of past, moreover when the code teaches programmers.
If something doesn't work and we feel there might be a better way,
we should pursue it, even though we don't know the outcome yet.
What works today doesn't have to work in the future. And probably won't. New PHP framework may appear in 2020, and it will be so good that we'll all migrate to it in 2022. It would not be the first time.
Before all this really happened and I made sense to it, we have to test the assumption:
Talking about Occam's razor... this is how Statie 20-lines implementation looks like in normal Symfony app 😱
— Tomas Votruba (@VotrubaT) March 10, 2020
Time to let go? pic.twitter.com/1Fxk31wWaf
If you don't know, test it, try it. Your feelings might be right, your feelings might be wrong, but only real test in real life will tell.
In a few hours, I got a working generator and deploy on friendsofphp.org. It worked!
So I made a slightly bigger experiment on my blog website with over 230 posts.
I got stuck with a route with an argument - a blog post detail - but after a few fixes, it worked too!
Since that moment, I knew, Statie needs to be deprecated. To spread the miss-information, I had to deprecate 8 posts about Statie on my blog.
Also, before we burn bridges, there should be a path to follow. And that is Symfony Static Dumper with only 550 lines of code (compared to Statie with over 4500 lines). A package that you plugin in Symfony app and works the same way Statie does. I'll write about in the next post, which will focus only on migration.
If you haven't heard, the song is a blast!
Happy coding and stay healthy!
Do you learn from my contents or use open-souce packages like Rector every day?
Consider supporting it on GitHub Sponsors.
I'd really appreciate it!