Is PHP 8 Going the Way of ActionScript 3 (OOP Soup)?

Posted by Paul on July 23, 2021

Many years ago Macromedia Flash (and then Adobe Flash) was all the rage in web development with talented developers able to produce some truly amazing things with it including 3D Augmented Reality using your webcam, 2D and 3D games, and even full blown web applications even before the Adobe Flex framework came along.

But Flash is dead, and even now there isn't really anything like it. Sure, developers can do some pretty cool things with JavaScript, perhaps using libraries like JQuery, but the fact remains that you just don't see the Rich Internet Applications, games, 3D etc. etc. that you used to, and the Internet is a poorer place for it.

For example, you will never see in JavaScript and HTML5 anything like this brilliant, classic Flash animation built entirely in Flash, and all about Flash: or indeed much of the content on the classic site, Newgrounds which allowed anyone to upload their Flash creations. Many of these were incredibly creative and well-made, due mostly to the fact that Flash allowed designers to produce animated and interactive content by dragging-and-dropping with minimal amounts of the simple ActionScript 2 language added to "frames" or "movie clips".

Why did Flash die?

There were a few reasons and a detailed analysis could easily take a whole article (you can read my thoughts here as it was happening!), but I believe there were at least these reasons:

  1. It was blocked by the Apple iPhone due to spurious security and performance concerns. In reality I suspect Steve Jobs wanted to block the possibility of Flash apps that were outside his app store.
  2. It was never great for SEO, with most of the content inside a Flash Movie being invisible to search engines.
  3. The Flash designer/developer community was split in two by the move from ActionScript 2 (AS2) to ActionScript 3 (AS3).

What does this have to do with PHP?

The last point above is what brings me on to recent changes in PHP, which really make me hope it's not going the way Flash did, for its own sake.

So to recap, Flash was an amazing tool aimed mostly at designers who were able to create buttons, animations, and interactivity, mostly through the point-and-click interface, but also but adding little bits of code to their creations.

This code was pretty simple, it wasn't a language like Java or C++. For example, to create a link you just had to add:


Partly to improve performance, and partly to make Flash in to more of a "proper" application development tool, Adobe worked on a new version of ActionScript which did everything in an "Object Oriented" way, which is what proper languages like Java and C++ use. And that made sense for building complex applications ... but a lot of Flash designers weren't hardcore programmers - they were designers! They had Creative Arts degrees, or they were self-taught, they didn't have Computer Science degrees.

After this update, instead of one very simple line of code, you'd need at least a couple of lines of code - which doesn't sound so bad - but those lines of code required you to understand Object Oriented Programming (OOP) to some degree, and a lot of Flash designers (who liked simplicity and minimalism) decided that was just too much. For example instead of "getURL" you would now need to instantiate a strongly-typed URLRequest object and pass that to the a method with some other parameters:

var request:URLRequest = new URLRequest("");
navigateToURL(request, "_blank");

That may not appear too much more complicated but it's certainly a lot harder to remember than "getURL" which meant to do something so simple, Flash designers would often have to consult the docs. There's a great article about the above here:

And this is just the simple example of creating a link - everything about working with Flash increased in complexity by at least this much, and often way more.

So is this happening to PHP?

Hopefully not, and even if it did, PHP developers are indeed developers rather than designers so it probably wouldn't make them turn away from it in droves.

But it would be rather annoying if PHP became more verbose and required this sort of extra Object Oriented complexity all over the place.

I mean don't get me wrong, Object Oriented Programming is a fantastic thing in certain situations and I even wrote Adobe Flex examples of all the OOP Design Patterns in the seminal book on the topic, but sometimes you just want to write a very simple procedural script that gets something done quickly and simply without layers of abstraction.

So here's the recent change I came across in PHP 7.4 that reminded me so much of some of these AS2 to AS3 changes:

Previously if you wanted to do something like output a number with a currency sign, and you wanted to do it properly, you could have a bit of code that uses money_format() like this:

setlocale(LC_MONETARY, 'en_GB');
money_format('%.2n', 100);

Which would output a nice "£100".

From PHP 8, the above won't work at all, and any code that uses it will need to be re-written first instantiate a NumberFormatter Object and then call a method on it with the relevant parameters:

$fmt = new NumberFormatter( 'en_GB', NumberFormatter::CURRENCY );
echo $fmt->formatCurrency(100, "GBP");

Again, it doesn't look terrible but all those extra long words and symbols will make it more difficult to remember for PHP developers. Whether this is a trend we're going to see a lot more of in PHP I don't know, but it's certainly something to watch out for.

What do you think about this? Is it a better way to do things? Or just a pain? Please let us know in the comments!

blog comments powered by Disqus