Derik Badman's Journal

2019-12-04 08:12

I occasionally read books for work related purposes, mostly related to web design (frontend, rather than the backend server side). I just finished Heydon Pickering's Inclusive Components which is based on his website of the same name. Oddly, I bought an ebook copy direct from his site and then like a week later an edition was announced from Smashing, which further solidifies my opinion that they make many of the best web design books. I've read a few of Pickering's books now, focused on accessibility and inclusive design. This one is quite good. It's divided up into different components like "Toggle Buttons", "Tabbed Interfaces", "Modal Dialogs", etc. And then in each he works through examples of each dealing with html, css, js (when necessary), accessibility, responsive design, progressive enhancement, etc. The content is solid, information, and entertaining, and while it is focused on a set of specific components, the advice and skills learned are generally applicable to other contexts.

Longer ago, but I never mentioned it, I also finished up Matthias Noback's Style Guide for Object Design which I got from his website and now also has been picked up a publisher, so it's now available here as Object Design Style Guide. This is specifically about php and was also quite excellent. His style guide bears a lot of similarities to how we handle our php at my job, so it was familiar and relevant. It's a book I feel like I could revisit, reread, and learn more. One thing he recommends that I don't do heavily in my code is throwing exceptions for invalid property values. I end up doing a lot of checking a variable (Is the id > 0? Does the input for this email address field look like a real email?) and then returning an error response. Or if the code fails to find a requested object it returns null and then if the object var is null, an error response is returned. Noback throws different types of Exceptions in his class instead. I can see how, for instance just throwing some kind of "InvalidInputException" which a message like "Email address is invalid" would allow my routing code to just catch that type of exception and send a response with the appropriate http status code and message. That way my individual controllers would not need to account for all the various invalid inputs as specific if blocks.

Walking down to the bakery for morning coffee yesterday there was a big black puddle on the macadam reflecting the trees and sky above like a mirror. Something about looking down into puddles and seeing myself and the world reflected always interested me, a natural mirror, flawed and dim. Yesterday I wondered at fantasy stories that use that idea. Surely, someone has done a dark mirror world (probably a fey world) entered by jumping into a puddle. Which makes me think of the mirror world in the various Star Trek series.