Hacker News new | ask | show | jobs
by tcdent 3838 days ago
I'm mildly baffled by the coding style of the main encoder class[0]; where do these conventions come from?

(All-caps three character properties, namespaced(?) arguments, spaces e v e r y w h e r e, curly bracket array access.)

Also, I didn't know `class` and `array` were case-insensitive.

[0] https://github.com/ErikvdVen/php-gif/blob/master/GIFEncoder....

2 comments

Comments say it's based on this: https://github.com/demouth/DmImage/blob/master/example/sampl...

Some of what you mentioned is already present there. Some other things are new. But they're both terrifying...

Extra details: the rewrite into gifencoder happened in 2007, so gifmerge must be older than that (maybe 4.x times). The original license forbids modifying gifmerge without author's approval - since this file doesn't mention it at all, I doubt dmimage is legal.

> But they're both terrifying...

Welcome to PHP! Truly the language which most directly represents the soul of the web - a stateless static documentation presentation system which we shoehorn application functionality into regardless of the pain!

The classic coding book 'Code Complete' recommends adding spaces after and before brackets. The idea being the increased white space improves code readability.

I used to agree, but more recently have decided it ultimately ends up making things more difficult to read by increasing the amount of scanning your eyes need to do.