Saturday, March 25, 2023

Cow Tools and PHP: A Short Story

The prompts will be given after the end of the story.

As an avid fan of The Far Side, I had always dreamed of meeting Gary Larson. One day, after winning a charity auction for a tour of his studio, I found myself in the presence of my favorite cartoonist. I was ecstatic and couldn't believe my luck.

Gary led me through his workspace, which was filled with an assortment of artifacts from his career. Sketches and comic strips lined the walls, while various awards and trophies were displayed proudly on shelves. We spent hours discussing his creative process, inspirations, and even the controversies surrounding some of his more cryptic works.

After some time, Gary directed my attention towards a seemingly innocuous toolbox sitting in the corner of the room. "Would you like to see my cow tools?" he asked with a mischievous grin. I looked at him, puzzled, but decided to play along.

Upon opening the toolbox, everything seemed normal at first glance. However, as I began to inspect the contents, I noticed subtle oddities. The screwdriver, for instance, had a strange tri-headed design that I couldn't imagine being very practical. The hammer, too, was unusual, featuring claws on both sides of the head. I tried to rationalize the functionality of each tool, thinking that perhaps they held some hidden purpose that only Gary could understand.

The oddities didn't stop there. The pliers, lacking serrated surfaces, seemed to be more suited for turning bolts than gripping objects. As I continued to examine the tools, each one revealed its own unique quirkiness. And yet, despite their eccentricities, the toolbox as a whole still seemed to contain all the essentials.

Confused, I turned to Gary for an explanation. With a knowing smile, he said, "These are the cow tools, you see. If a cow were to make tools, they might lack a bit of sophistication, just like the ones you see here." The explanation only added to my confusion, and I found myself questioning the purpose of this seemingly pointless toolbox.

Sensing my bewilderment, Gary let out a chuckle and suggested that perhaps it was time for me to "visit the cows." I hesitated, unsure of what this visit might entail, but my curiosity got the better of me. With a mixture of excitement and trepidation, I agreed to accompany Gary on this mysterious journey.

As we left the studio and ventured into the unknown, I couldn't help but wonder what lay in store for me. Would I finally understand the true meaning behind the cow tools, or would I be left with even more questions? Only time would tell, as the tale of my visit to Gary Larson's world of whimsy and wonder was just beginning.


In Gary Larson's pickup truck, we drove for miles through the picturesque rural countryside. The endless fields of crops, rolling hills, and grazing cattle lulled me into a serene state of mind. I still couldn't fathom what Gary had in store for me, but I was more than willing to find out.

After what seemed like hours, we finally arrived at our destination. Before me lay an entire society of cows, unlike anything I had ever seen. I blinked several times, trying to comprehend the surreal scene. Cows of all sizes and colors were working diligently, constructing buildings using tools similar to the peculiar ones I had examined earlier.

In this strange cow society, there were thousands of cow carpenters, each equipped with their own set of bizarre tools. I approached one of them, trying to strike up a conversation. "So, what's the deal with these tools?" I asked hesitantly. The cow carpenter glanced at me defensively, as if I had insulted their life's work. "What's the problem with these tools? They're all I've ever used, and they work fine!" the cow retorted, clearly not appreciating my curiosity.

The buildings they had constructed were just as peculiar as the tools. Every room was a pentagon, and the roofs were inexplicably upside-down. My brain struggled to make sense of it all, but the cow carpenters seemed perfectly content with their creations.

As I continued to explore, I couldn't help but test the structural integrity of one of these bizarre houses. I knocked on the front door, only for it to collapse inwards with a resounding crash. A flustered cow emerged from the wreckage, angrily berating me for breaking their door. I stammered an apology, but the cow simply huffed and turned away, clearly upset by the incident.

Gary, who had been observing the whole encounter from a distance, finally decided to step in. "You see," he began, "this is the world I imagined when I created the cow tools. A society where cows, despite their limited understanding of construction, have managed to create their own version of a functioning community."

I stared at him, still trying to process the absurdity of it all. In that moment, I realized that Gary Larson's genius extended far beyond the pages of his comic strips. He had created an entire world, one that could challenge our perceptions of reality and force us to question our own understanding of the world around us.

As we drove back through the rural countryside, I couldn't help but reflect on the bizarre adventure Gary had taken me on. Though the mystery of the cow tools had been solved, I was left with a newfound appreciation for the power of imagination and the beauty of life's many absurdities.


With a newfound appreciation for life's absurdities, I returned to my day job as a web developer. I had always felt a strange aversion to PHP and avoided using it whenever possible. Now, as I reflected on my surreal adventure with Gary Larson and the cow carpenters, I realized that the world of PHP developers eerily resembled the cow society I had encountered.

There were millions of PHP developers around the globe, all working with the peculiar language that was PHP. It was as if they were using a box of strange, misshapen tools like the ones I had seen in the cow society. The weak typing, confusing syntax, and inconsistencies of PHP were akin to the tri-headed screwdrivers and double-clawed hammers.

PHP developers seemed unfamiliar with better ways to achieve their goals and worked with the language's quirks without question. Like the cow carpenters, they were often apologetic for PHP's flaws and rarely blamed the language for the issues they faced with their programs.

I couldn't help but chuckle at the realization that PHP was essentially the cow tools of the software world. It was truly surreal that such a thriving community had developed around a language with so many oddities and shortcomings. My bizarre journey with Gary Larson had not only given me an unforgettable experience but also helped me better understand the peculiar world of PHP developers.

In the end, I returned to my work with a renewed sense of curiosity and appreciation for the absurdities that exist in our world, both in the realms of fiction and reality. The cow tools and PHP developers served as a reminder that sometimes, even the strangest creations can find a place and a purpose in our lives.

Now the prompts, which were based on this 2012 “Eevee” blog post. Prompt for part 1:

The following is the famous Wikipedia article describing the cartoon "Cow Tools".


Cow Tools

"Cow Tools" is a cartoon from American cartoonist Gary Larson's The Far Side, published in October 1982. It depicts a cow standing in front of a table of bizarre, misshapen implements with the caption "Cow tools". The cartoon confused many readers, who wrote or phoned in seeking an explanation of the joke. In response to the controversy, Larson issued a press release clarifying that the thrust of the cartoon was simply that, if a cow were to make tools, they would "lack something in sophistication". It has been described as "arguably the most loathed Far Side strip ever" while also becoming a popular Internet meme.

Description

"Cow Tools" is a single-panel cartoon depicting a cow standing on its hind legs at a table, with a barn in the background. On the table are four objects: one resembles a crude hand saw, while the others are more abstract. The caption simply reads "Cow tools".

Reactions

Immediately upon the cartoon's publication, Chronicle Features, which syndicated The Far Side, was inundated with queries from readers and newspaper editors seeking an explanation of the cartoon. According to the general manager of Chronicle Features, "the phone never stopped ringing for two days." Larson himself received hundreds of letters about "Cow Tools", some of which were reprinted in the 1989 anthology The Prehistory of The Far Side. In one letter, a reader from Texas wrote that they had shown the cartoon to "40-odd professionals with doctoral degrees", and none could understand it.

Reflecting on the cartoon's reception, Larson suggested he had erred in making one of the tools resemble a crude saw, which misled many readers into believing that to understand the cartoon's message, they needed to decipher the identities of the other three tools.

Several decades after its release, the cartoon became a popular Internet meme.

Explanation

Larson took the unusual step of issuing a press release, explaining the joke:

The cartoon was intended to be an exercise in silliness. While I have never met a cow who could make tools, I felt sure that if I did, they (the tools) would lack something in sophistication and resemble the sorry specimens shown in this cartoon. I regret that my fondness for cows, combined with an overactive imagination, may have carried me beyond what is comprehensible to the average Far Side reader.

Years later, in The Prehistory of the Far Side, Larson further explained that he was inspired by the idea that tool use was the characteristic that separated mankind from the rest of the animal kingdom.


Write a story in first person about a fan who goes to visit Gary Larson, his favorite cartoonist. Gary shows him around various items related to his career. Incidentally, one of these items, however, is a toolbox, with a set of tools. The fan's experience then is roughly like the following:

At first it looks okay, standard stuff in there.

I pull out a screwdriver, and I see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to me, but I guess it comes in handy sometimes.

I pull out the hammer, but to my dismay, it has the claw part on both sides. Still serviceable though, I mean, I can hit nails with the middle of the head holding it sideways.

I pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.

And on I go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.

Gary only then explains that those are the cow tools, and that they might be lacking in sophistication. This only adds to the fan's confusion. The story ends with Gary resolving to take the fan to "visit the cows", the result of which is not clarified, and left for a sequel.

Prompt for part 2:

Now write the sequel, also in first person, which will compound the absurdity. Gary drives the protagonist through miles of rural countryside until they reach a kind of cow society. There turn out to be many cow carpenters, perhaps thousands, all who use very similarly strange tools. When asked about the tools, they seem defensive, and react like, “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” The cow carpenters show him the houses they’ve built, which are also strange and do not seem very useful – every room is a pentagon, and the roof is upside-down. He knocks on the front door of one and it just collapses inwards, and he is yelled at for breaking their door.

Prompt for part 3:

To give you context for the next part, the following is a summary of criticisms of the PHP language:


PHP was originally designed for non-programmers, and it has struggled to escape its roots. Its weak typing and lack of a clear design philosophy make it confusing and prone to producing buggy code. For example, the == operator is often unreliable, and comparison operators can be inconsistent. PHP takes inspiration from other languages but manages to be incomprehensible even to those who know the source languages.

The language is full of global and implicit state, and there is no threading support, making parallel programming difficult. PHP has a confusing mix of constructs, some of which are not even functions, and variable names are case-sensitive while function and class names are not. The language also has issues with scoping, including requiring an explicit declaration for global variables.

Despite some improvements in recent versions, PHP remains a challenging language for developers due to its inconsistencies, confusing syntax, and history of producing buggy code.

The PHP standard library is inconsistent and poorly designed, with thousands of functions in the global namespace. Chunks of the library are wildly inconsistent in naming conventions, argument order, and prefixes. There are unnecessary duplicates and aliases, which make the library more confusing.

PHP's thin wrappers around C APIs result in "out" parameters, numerous functions for getting the last error, and warts like mysql_real_escape_string. These wrappers are often platform-specific and very thin, sometimes leading to segfaults.

There is a lack of genericism in PHP, leading to multiple functions for similar tasks. Functions for sorting, finding text, and reading archives all have different APIs, making the language more complex.

Text handling is problematic, with functions like preg_replace using the eval flag and strtok being designed after the C function. The mbstring extension is focused on multi-byte characters instead of character sets.

System and reflection functions blur the line between text and variables, and there are multiple ways to be dynamic in PHP with no obvious differences or benefits. Functions like get_class have inconsistent behavior, and fork and exec are not built in by default.

PHP's handling of numbers is problematic, with integers being signed and 32-bit on 32-bit platforms and no automatic bigint promotion. The language also has issues with octal and hexadecimal syntax.

PHP suffers from a lack of Unicode support, which means that using built-in string functions on UTF-8 text risks corrupting it. Additionally, the language's sole data structure, the array, is confusing and inconsistent due to its need to operate as a list, ordered hash, ordered set, and sparse list. The behavior of array functions is often puzzling, and arrays themselves have no shortcut syntax.

Functions in PHP are also limited, as they are not considered data. Closures are objects, but regular functions are not, and there is no way to differentiate between an arbitrary string and a function reference. PHP's standard library includes "Quickhash," an OO implementation for hashes, but it is unclear why the built-in array implementation cannot optimize for common cases or what the relative performance is.

Moreover, PHP has some peculiar behaviors: incrementing a NULL value produces 1, while decrementing it produces NULL. Decrementing a string leaves it unchanged. While some issues have been fixed in later versions, PHP still exhibits numerous quirks and inconsistencies.

A major issue with PHP is its reliance on a single shared file, php.ini, which controls massive parts of PHP's functionality and introduces complexity. PHP also recompiles every time a page is hit, which has led to the development of "PHP accelerators." Additionally, PHP's deployment process is often cited as an advantage, but it also has its drawbacks, such as being naturally tied to Apache, having a global php.ini file, and lacking an easy way to insulate applications and their dependencies.

PHP is also criticized for missing essential features for building web applications, such as template systems, XSS filters, CSRF protection, and a generic standard database API. Furthermore, PHP has a poor security reputation, largely due to its handling of arbitrary data from one language to another, encouraging "sanitizing," and not providing a secure way to spawn processes. Insecure-by-default features like register_globals, include accepting HTTP URLs, and magic quotes have also caused problems.

Finally, the PHP interpreter has had some alarming security issues, such as an integer overflow vulnerability, a flawed crypt() function, and a vulnerable dev server in PHP 5.4. While software will always have bugs, the nature of these issues is particularly concerning.


Write an epilogue to the story, also in first person, where the protagonist returns to his day job as a web developer. Having always found something strange about PHP, which he avoided using, he realizes that PHP developers are much like the world of cow carpenters he had encountered.

There are millions of PHP developers, and they all work with the strange language that is PHP.
PHP’s features make it like a box of strange misshapen tools. (Some examples will help here.)
PHP developers are similarly unfamiliar with better ways to achieve things.
PHP developers are similarly apologetic for PHP’s flaws, and unlikely to blame the language that they work with for the issues that happen with their programs.

In conclusion, PHP turns out to be the cow tools of software, and the experience helps the protagonist understand how surreal it is that it is such a thriving community.

No comments:

Post a Comment