Posts tagged with standards

The Everybody Poops Rule

rosstuck.com

Ross Tuck makes the case that not all code is equal.

Most teams follow the Broken Window Theory, fearing even a single tradeoff starts the slide down a slippery slope. This can reduce discussion (read: dissension) in the short term but leads to arbitrary compliance or worse. ... Deciding on a level of quality isn’t like deciding on a coding standard, you can’t have an off-the-shelf-always-okay answer. Quality is the place to have nuanced discussions.

Read more [rosstuck.com]

Messing around with HTTP status codes

The HTTP specification says that status codes should be three digits integers, but what happens if they are not? April King, head of website security at Mozilla, did some fun experiments to find out.

While it is easy to create test cases for conditions that don't satisfy this requirement, it is somewhat more difficult to determine how third-party libraries will handle HTTP requests that fall outside this constraint. I looked around the internet for websites to help me test weird status codes, but most of them only let me test with the known status codes. As such, I decided to add arbitrary HTTP status codes to my naughty httpbin fork, called misbehaving.site.

What I discovered is that the various browser manufacturers have wildly different behavior with how they handle unknown HTTP status codes.

https://pokeinthe.io/2017/09/14/http-status-code-handling/

Read more

Join 9,500+ smart developers

Every month I share what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.

No spam. Unsubscribe anytime. You can also follow me on X.

PHP-FIG has a new beautiful site

One of the most important endeavors in the PHP universe is the PHP Framework Interop group. The group consists of several maintainers of big PHP projects. Their aim is to find commonalities between their projects and find ways to work together. They do this by proposing and accepting PSR's, short for PHP Standard Recommendation.

One of the most important PSR's is PSR-4 (and the now deprecated PSR-0) which describes a way to autoload classes. Thanks to this standard packages can be easily be reused in many frameworks and projects. PSR-2 is another important one. It is a coding style guide and greatly improves readabiltiy of code when working with a bunch of developers. There are several other PSR's that have been accepted.

Today PHP-FIG published their new site. It features a beautiful design by Jonathan Reinink (he's the designer of the PHP League sites, author of Glide, and creator of the PHP Package checklist). If you use PHP in any way you owe it to yourself to check it out the new site.

 

Read more