Why @@ is the best attribute syntax for PHP

Analogous to docblock annotations, attributes make it possible to apply metadata to a class, function, or property with a native syntax and reflection API. The original <<Attr>> syntax accepted for PHP 8.0 had several shortcomings which were addressed by changing the syntax to @@Attr. Now there is a new proposal to borrow Rust’s #[Attr] syntax instead. In this post I examine the main arguments for this change and why I still believe the @@ syntax is best.

PolyCast: a library for safe type conversion in PHP

On March 16, 2015, something amazing happened in the world of PHP. The long-awaited, hotly debated Scalar Type Declarations RFC was accepted for PHP 7! Finally, it will be possible to declare scalar types (int, float, bool, and string) for function parameters and return values: The need for safe type casts By default, scalar types… Continue reading PolyCast: a library for safe type conversion in PHP

High performance linked list sorting in JavaScript

In my previous post, I described a schema and set of associated queries to persist and and update arbitrarily ordered items in a SQL database (using a linked list). This approach can scale to very large lists, without degrading performance when adding or rearranging items. But having stored a list, how can it be reproduced… Continue reading High performance linked list sorting in JavaScript

Interstellar starships: feasible or fiction?

As the Klingon ship bears down on the Starship Enterprise, preparing to fire a barrage of photon torpedoes, Captain Picard shouts “Maximum warp!” and the Enterprise leaps away towards another star system, faster than the speed of light. Is this scene from Star Trek purely science fiction, or is there truth to the concept of interstellar starships? Despite the significant scientific progress that has been made in this area, energy requirements, high costs, and the problem of time still present enormous challenges to the vision of interstellar travel as portrayed in Star Trek and other films.

Google, ethics, and Internet censorship

I originally wrote this post last September as a research paper for my Business Ethics course at Rasmussen College. I decided to post it on my blog now since I still feel strongly about the issues of censorship and online privacy, especially in light of recent leaks about the NSA’s top-secret surveillance programs. What if… Continue reading Google, ethics, and Internet censorship

Psychology in Interactive Web Design

This post is based on a research paper I authored earlier this month as part of my General Psychology course at Rasmussen College. Have you ever been struggling with a website or application that is difficult or confusing to use, and thought, “This could be so much easier if it were designed differently”? You may… Continue reading Psychology in Interactive Web Design

Responsive Captcha: A small PHP library for preventing spam

If you’re reading this, you probably already know what a CAPTCHA is. The most common form consists of an image with warped or obscured characters which must be entered into a text field. While these image-based CAPTCHAs tend to be effective at stopping spam, they are also poorly accessible, often slow, and require a third-party… Continue reading Responsive Captcha: A small PHP library for preventing spam