Python vs PHP

One of the reasons I thought I'd start this blog is because I'm using the Your Voice in House project to teach myself a few new tricks. As I'm sure any developer will tell you, having a little project is the best way to learn.

I've been coding since the early 2000s. Self taught, my primary programming language has always been PHP although I added Javascript to my tool-belt early on in the piece (when jQuery was a tiny baby and there was much deliberation about whether it was worth adding that much overhead to your site). When I first started using PHP it was version 4 and I remember feeling a little put out when I had to get my head around this Object Oriented stuff they introduced in 5. How far I have come.

PHP has plenty of detractors and there is no doubt, like every programming language, it has its short comings. But I'm not a PHP naysayer and I don't want this post to get into the 'is PHP even worthy of being called a programming language' debate. Most anti-PHP sentiment is out of date these days anyway. The language has come a very long way - particularly in the last 5 years or so.

For me, particularly as someone learning to program 10 or 12 years ago, the greatest thing about PHP was the LAMP stack. It just makes everything easy. You put a file in a directory on the web root and when you navigate to that file, that file is run and you get something on the screen - including error messages. In addition, even the most basic hosting will already have a MySQL database and PHP just plugs right in there as well with a minimum of fuss. That is ideal when you're just learning and don't want to have to get your head around hosting environments before you get into the code.

The other fantastic thing about PHP is that it has a huge - and largely friendly - user base which means help is never far away and for the most part the documentation is excellent. I still visit just about every day.

But if you've been over to Github, you'll notice that I'm primarily building this site in Python.

I've been playing around with Python for a few years now and thought I may as well use it for this project so I can get to know it a bit better. I'm still picking it up and just need to spend a decent amount of time with it to get to know it a bit better.

Python is fantastic. It's very powerful, syntactically very pretty and it's also much more of a general purpose language than PHP is. I know you can use PHP for more than just building websites but it just feels at home on a website. Python on the other hand is happy anywhere and I find myself using it more and more to automate processes on my laptop amongst other things.

Plus it makes a whole bunch of other things easier. I love the BeautifulSoup library that make scraping a website - which will be important for the YVIH site - so much easier. For the most part PHP is lacking that sort of thing. I know composer is changing that but I feel like that's still a long way off what Python has to offer in that respect.

I don't know if Python will ever be my primary language and I'm nervous about taking that step in may senses. I'm not yet game to use it for a freelance job and I do wonder if it will ever be my primary language at work.

Whatever the case, this blog will be focusing on Python (and some Javascript). Hopefully I'll be able to share a few tips as I learn as well.