My Post-PHP Experiences

A few months ago, my work duties changed and I've been spending most of my time on languages other than PHP, namely VB .NET and C, with occasional forays into C# .NET and Basic. In those few months, I've learned a few things about what it's like outside of the PHP ecosystem.

Good IDEs Do Exist

In the past, I've used a few IDEs, but none had enough benefits to outweigh the extra bloat. I tried Eclipse, PHPStorm and ZendStudio and ended up preferring Eclipse, before deciding I just wanted an advanced text editor and switched to vim. I couldn't see why some developers swore by IDEs the way that they did.

Visual Studio (and the Resharper plugin) has changed my thoughts on that tremendously. I love features like code completion that actually knows my whole code base (rather than just the built-in functions) and warning me about compile time errors before compilation. 

Type Hinting Helps

PHP is a weakly typed language, with only a few instances of stronger typing - such as type hints for function signatures. But even these type hints are limited only to objects. The rest of PHP is weakly typed and there is nothing that can be done about it. I spent 5 years with weak typing before spending any sigfnicant time with strong typing, and now I can't imagine going back. Strong typing makes it much easier to develop, especially in conjuction with a good IDE.

Overloading Is Very Useful

PHP completely lacks overloading, and now that I've experienced it a bit, I really like it. Overloading, combined with strong typing, is a very good way to create multiple functions that all achieve the same end result. In PHP, you can fake it through the func_get_args() method, but that obscures the possible method signatures and makes code completion difficult. 

PHP Is Designed For Bad Environments

I'm now starting to feel that the concept of a "good PHP Environment" is inherently an oxymoron, due to four design decisions on the part of PHP.

  1. Having no single entry point (and no compilation) means that an IDE can never be certain what has happened up to the current line in a file.
  2. The autoload setup makes scope hard to figure out since there is no indication in any files what has been included.
  3. The include chain can look outside of PHP (into a database, for instance) to determine what files to include. This further obscures what files have and have not been included into the current file.
  4. Weak typing and a lack of overloading makes signatures flexible, making it impossible to provide meaningful code completion on custom functions.

Both Visual Studio and MPLAB IDE X actively help me write code. When working with PHP, the best I could hope for was to find an environment that merely stayed out of my way.

Final Thoughts

Working with these new languages is a huge breath of fresh air. I didn't even realize how limited and stagnant I was until now. Of the languages I've been using, I am most enjoying C, but am most interested in exploring C#. Visual Basic .NET is very enjoyable, but I find the verbosity to be a bit tedious. In some regards, it reminds me of XML. Fortunately, Visual Studio has well designed auto completion of closing tags, so I don't notice how often the 'End' keyword litters my code.

I don't know how long I will remain enthralled with these new tools. As a long time open source fanatic, I'm a bit embarassed to say just how much I like Visual Studio. I just hope that each time I learn a new language, I find it as fascinating as I am now. It has really opened my eyes in a way I never could have imagined.