I fantasise about Scala when having my everyday sex with PHP
Disclaimer: while this is my very first post in English and on Hacker News, please bear with me as you’ll probably feel the same dissonance in your head and your heart at the end of this confession article.
So, the best thing about having sex is fantasizing about someone else, says YouTube blogger Emily Hartridge in her video watched almost a one million times, youtu.be/PX2Isu1eVJ0 . Undoubtedly, having sex on a daily basis is good for our physical health, but what if your loved is 4 hours away from you, but you still want to be healthy both physically and mentally?
We, coders, spend more than 8 hours a day scrutinizing our laptop’s screens, we touch our keyboard with one of the most sensitive parts of our bodies a thousand times a day — it is no surprise we want at least some comfort, peace and pleasure to accompany this activity; an exciting gotcha or a mind-blowing breathtaking task is not a daily bolt of adrenalin available for every regular programmer. In fact, there are so many boring tasks, deadlines, asks and issues that don’t require all our potential and ingenuity, that we end up reading about new languages, frameworks, and hacks to still the hunger for new emotions and satisfaction from what we do. But… we just read about this and that, and then keep using our established and proven method to deliver great results and fast.
When I was a child, my excitement begun when I learned Pascal. The smooth transition to Delphi was just natural, and by that time I had started to earn some income by freelancing. When black days started for Delphi, I had to learn, again, statically typed, C# and continued to work remotely while having a complete satisfaction from my coding.
Nevertheless, a convincing and growing increase in PHP market on freelance websites like RentACoder did reverse the direction of my learning one day, and, well, I switched from beautiful, statically typed, compiled and less error prone Delphi and C# to an imperfect but extremely simple PHP. From that day on and up to now, during the whole ~6 years, I have been having not so luxurious sex with PHP and … dreaming about Scala and C# almost every single day.
Still, what is important is that I am not the one who takes great pains over every next project made in PHP. I love its simplicity, availability, and, most importantly, the market — big, huge, really enormous in the whole Earth. Tons of pros and cons of using PHP vs other languages can be easily googled, so I am nowhere near touching this aged holy war. What I would really like to talk about instead is that feeling that has come to my life since my decision to give way to simplicity in coding.
While evolving all my PHP skills and earning enough money to keep me and my wife entertained and satiated, I keep reading about and playing with Scala, one of the latest trends in statically typed languages. I love its academic exemplarity, I took a course at Coursera, I read the whole book of its originator, Martin Odersky, I tried to do a few simple projects with using Akka and Play frameworks, and I follow some interesting tweet threads from the Typesafe team. I read Scala documentation time to time to ignite my expectations from PHP, and I even tried to find a Scala job one day and a Scala project at oDesk. But every time I try to use Scala, I have that strange feeling: yes, this is definitely beautiful, but I am just not going to use it because I have a simpler tool. I feel locked with PHP, but that’s a kind of locking that one does on their own just to make their lives easier and enjoy more of it.
I have even caught myself prototyping a simple idea in Scala, but then doing it in plain old simple PHP eventually. Of course, I’m far away from big corporate projects that require huge infrastructure and plenty of modules and inner projects all joined together in a big system, in whicn a case Java and Scala developers could benefit a lot from their selected language for coding. But I just can’t help it. I got a new job recently, and it is again PHP. The project is making money, the clients are happy (what else do you need from a project), and so am I — I am glad I still remain committed to simplicity… while fantasizing about ideality.
Sometimes I just don’t think about this dilemma while I read another impressive article about how a statically typed language elegantly solves some particular problem. But then comes this feeling again and again and I realize I should not be alone interpreting own job in such a way. Am I happy with what I do? Definitely. Do I still dream about that day when ideality meets simplicity? Absolutely. But I’m not into changing to another language any time soon, yet I am aggressively and eagerly contemplating “the other world”.
And what makes me believe I am going the right way is things that appear time to time and demonstrate that the same elegant approach can be achieved with a simpler approach. React.js is one good example of bringing functional stateless programming into good old JavaScript and even HTML! That same elegance that makes Scala and some other languages so efficient in some high demanding problems. I had a chance to learn Ember a bit while learning Discourse forums engine, and I even was planning to use it in my own projects. But as soon as I tried it once, I decided it was the last time. Ember concepts just didn’t fit well into my head, so I ended up not using it. On my new job, however, I had to do some GUI and I was allowed to try whatever framework I like, and I decided to give React.js a try. Not only was it extremely pleasant, but it allowed me to make a bugs-free complex component in just one day, which was clear to read, stateless and easy to control from outside. As a result, this experience proved to me that there will always be two sides — two completely different worlds that express themselves into a dilemma and notable dissonance.
No matter if you live in one world or in the other, or even you are trying to stay in both of them simultaneously, I am sure there were times when you asked yourself the same question and you felt fantasising about one technology while being satisfied by and using another. If the answer to this is yes, please share your story and express what you are going to do about this if you do.