Moving from C# to PHP/WordPress (Part 1: The Tools)

computer languages

A couple of years ago my new boss said to our team. “Hey team. I like WordPress. I want to switch our sites to WordPress. Look into it for me.”

At the time we used a combination of home grown CMS built on the .Net platform and Composite C1, an open source CMS I chose based on .Net. We’d been considering different options for new a new CMS as we’d been having problems with Composite C1 and product data coming in from internal systems. Oh, and they used to use XSLT as the template engine on the back end. Oh the pain! XSLT templates are essentially what happens when XML and a W3C standards compiler decide to have a baby. To be fair they switched over to the Razor engine, which is a really expressive syntax to write. And I actually loved learning XSLT as it gave an interesting perspective on pure functional programming, but I’ll leave that discussion for another day.

XSLT templates are what happens when XML and a W3C standards compiler have sex.

We had been dabbling with other platforms like DotNetNuke, Orchard CMS and maybe even switching to another platform like Ruby on Rails, but I had not had many good things to say about the limited exposure to PHP that I had.

But, ever the optimist, I looked into it and a few days later replied with something like: “Okay, we can do it. but… I need a new Computer. I’ll need a MacBook Pro. Most webdevs doing PHP use Macs.”

macbookOkay, fine. I wanted a new shiny computer. But hey, some tools are exclusively Mac (or
were). Oh, and my Lenovo T410 was getting long in the tooth and didn’t hold a charge. Don’t judge me.

I got my new machine.

And so it begins…

And so began my journey. New computer MacBook, new language PHP, new CMS WordPress, a new OS. New everything.

Coming from a C# background, moving from an elegant strongly-typed powerful language like C# to a mish-mash feels-like-its-cobbled-together language like PHP was both frustrating and liberating. And the hardest part wasn’t even the syntax. It was tools. Before I go one, bear in mind that these are my opinions based on my experiences. It’s perfectly valid to have your own opinions, and if you feel differently, please let me know so I can ignore them. ( Alas, I jest )

One tool to rule them all

In C# and .Net you really didn’t need to search for your tools. There was pretty much exactly ONE choice of IDE ( Visual Studio ) and you just needed to learn the ins and outs of working with it. That came with some considerable Pros (and some cons). First of all, .Net C# tutorials were focused. Less time is focused on syntax and multiple ways to do something or set something up and more time is spent on design patterns. I think this is a strength of the .Net platform. You spend less time troubleshooting tools that don’t play nice with each other and more time learning code patterns.

But .Net strengths can be its weakness

Although it’s true that you typically spend less time getting tools to work properly, there is one side-effect of this. You can easily get lazy. You can rely more on the tool than the knowledge of what you need to know. I’ll get into that in a later post, but if you want a preview, just look up “ViewState and ASP.Net Webforms engine” in your search engine of choice. Although not a popular tool any more, it was the anti-web platform. They tried to  abstract the web and it didn’t turn out well.

Support the troops!

With .Net you know you’re going to get lots of support and well-written tutorials and good documentation. After all a massive company pays people to do these things. They need to train an army of corporate developers to stay within the gated community of the .Net world.

Say what you will, Microsoft supports their developers
Say what you will about them, but Microsoft supports their developers

Sure, there were always outliers pushing the boundaries of what Visual Studio can do. There are those who use C# outside of Visual Studio as well… but the majority stay in the Microsoft stable and use the Microsoft tools. It’s like meeting that rare iOS developer who develops iPhone apps on a Linux box and just uses XCode to compile the project. When you meet that person you either think they’re a serious h4xx0r who deserves your respect, or you think… awww that’s quaint.

Anyhow, there aren’t many that leave the confines of Visual Studio. But Visual Studio is actually a really nice IDE that does a lot for you, so it’s all good. I hear a rumor that some illustrators don’t use Adobe Illustrator as well.

PHP has no tools…

Let me qualify that. PHP doesn’t have any go-to tool ecosystem, IDE or build systems. All the vertical integration is gone. You have to find all your tools and there’s no PHP section at your local Home Depot to help you out! There isn’t one massive IDE that everyone uses and people are VERY opinionated their tools.

The closest thing you can get to a universal tool for PHP is ‘a keyboard’.

Let’s compare that to other big languages. Java has IDEs like NetBeans or Eclipse, Microsoft has Visual Studio, Apple devs use XCode. But developer who write in PHP… and even WordPress developers (an opinionated CMS) has no universally accepted set of tools. The closest thing you can get to a universal tool for PHP is ‘a keyboard’. Developers use everything from PHPStorm to Dreamweaver to NotePad to SublimeText to vi. Yes, people use vim as a PHP IDE. As crazy as that sounds.

I choose YOU, Pikachu! No wait…

For a new developer ( with an ENTP personality ) the sea of choices that PHP gives you can be debilitating. As such, I’d just recommend finding a blog that you like, and use what they use. Ask them, they’re usually pretty friendly. I followed Chris Coyier of at the time, so I use SublimeText… though I miss debugging tools and for my more complex projects I’m thinking of something more full-featured like PHPStorm.

Making a PHP build system work can be like putting LEGO blocks together, except some of them are MegaBlocks… and some of them are Jenga blocks

As such, PHP can be extremely frustrating, especially when had the power in a single IDE to do ALL the things for you. If you want to auto-deploy a site, push to source control, compile your SCSS, use SVGs in your code, check your code for errors, FTP your files, and debug… you can do that.

In PHP, you may have to use a different tool for EACH of those processes, and the first step is figuring out what tools are out there!

LEGO solved the Jenga problem. With LEGO.
LEGO solved the Jenga problem. With LEGO.

Sure, there task runners like Grunt and Gulp and Yeoman and bower and homebrew and… ( too many choices!!! ) that help, but which one do you choose? When do you use them? And WHY is it returning this ESOTERIC error that’s only function that’s only purpose is to tell me it didn’t work and that I should read the log, which is… hey, where’s the log? Making a PHP build system work can be like putting LEGO blocks together, except some of them are MegaBlocks, some of them are Duplo blocks and some of them are Jenga blocks. It can be frustrating.

But it is also very liberating. It forces you to learn the command line tools and you feel like a wizard when you’re spitting things onto the command and have the ability to understand what the error means (or more often, what it doesn’t mean).  Sure, sometimes choosing a tool can be a frustrating experience and sometimes it feels like a huge timesuck going down a path to learn that this other tool is what you REALLY should have used, but it teaches you valuable problem solving skills.

But it wasn’t just tools I found frustratingly liberating™, but it was also that syntax. PHP is weird, immature, playful and welcoming. I’ll reserve my next post for talking about PHP’s syntax.

Leave a Reply

Your email address will not be published. Required fields are marked *