Profile cover photo
Profile photo
Erik Mattheis
Cook, programmer
Cook, programmer

Erik's posts

Post has attachment
I had pho with beef. Yum!

Post has attachment
Hey, +Annette Price - is it possible to change our marital status on here?

Post has attachment
The first blog post I've made in 21 months!

Every time I have a coding problem that takes more than a few minutes to solve I have the thought, "Wow, I should have been able to find someone with a blog or on Stack Overflow who has written about the exact same problem I have..."

Obviously, there have been too many people like me, not sharing their solutions. Maybe I am testing out a 2017 resolution - "share more solutions".

Anyway, this is pretty specific and although I expect you to be thrilled I made a blog post, you will likely not find the post interesting unless you are hosting with Amazon, have your app behind an Elastic Load Balancer, your app in running on Apache and you want to forward all insecure requests to their secure counterpart.

It's dinnertime on Friday and I've done about 1/3 of the billable work I would have liked to and I really hate PHP. It is because I believe the language is horrible more than I believe I don't have the patience or forgiveness to work with it without getting angry.

So I googled "Why does PHP suck?" in hopes to do some cathartic reading and get back to solving problems but instead it made me aware of new shortcomings and inconsistencies I had previously been blissfully unaware of.

I had no idea you could, of you want, have a variable and function with the same name.

PHP isn't my main things, I just know how to use it enough to do things with it. My impression of PHP programmers is that many of them write messy, inconsistent code because they either are poor programmers or like that their code is difficult to follow. I realize now that many probably write bad code because the language they are writing in sets the bar so low for what is acceptable.

When looking at code that mixes conventions - for example, sometimes converts a whitespace to an underscore but sometimes omits it, sometimes names a function action_object and sometimes object2_action2 but the language itself does this:


The only ways to remember if PHP wants you to write parse_url or url_parse are to memorize it or guess. That is a waste of brain cycles.

Boy do I hate PHP.

Post has attachment

Post has attachment

Post has attachment

Post has attachment

Over the last several years, I've been more frequently seeing code where the boolean value comes first in a comparison - if (true === pizzaStatus()).

Who would write it like that? Do these people want me to recognize just how thoroughly they understand that if A equals B, B equals A?

This infuriates me as it seems to be a perfect example of willfully ignoring conventions that make code easier to read. 

When writing code that will be read by another programmer, you want to allow the programmer to spend all their effort into understanding what the code DOES. This means it's equally important for the reader to spend no effort understanding what the code SAYS.

True is pizza status.

In English, the subject comes before the object when making a statement - "Pizza status is true!" not "True is pizza status". The meaning of the second formulation is clear but it takes half a second to understand it. Working with code requiring you to think for half a second about what it SAYS every few lines is much more exhausting than working with code that reads effortlessly.

So, today, I saw someone say (false === strpos( $content, $chr)) and I had a conniption. I scanned the page to find the name of the author I was furious with to find it was an Arab name.

Arabic reads right to left. Oh. Hebrew too. Chinese too, I think. Other languages. Hmm.

Most of the time I see the "backwards" order it's on StackOverflow or some such thing - not in a book or article that has passed through an editorial review or maybe even been proofread by the author.

When one is writing for an English reading audience, one should still use accepted conventions but I hope it will irritate me less when I see this transgression knowing that in many cases it arises out of the writer's trouble writing in an unfamiliar language rather than trying to be cute.

Can't believe how many years it took to get around to googling how to exclude folders from every SublimeText file search. "folder_exclude_patterns": [".git", ".hg", "CVS", "node_mudules"],
Wait while more posts are being loaded