Hacker News new | past | comments | ask | show | jobs | submit login

I've frequently found that when I go back to code I've written long ago, the new languages/libraries/patterns I've learned about since could have helped me back then.

I used to be terrible at templating (presentation) many years ago. Like a lot of people I took it for granted, and considered it an afterthought compared to more "serious" work like writing backend business logic or data modelling. After hitting some frustrations writing a frontend, I started learning all I could to avoid writing those same giant html-templates rife with microlanguage, inline for loops, hugely nested conditionals, etc. I started reading up on xslt and a lot of the reasoning behind it. While anything XML is torturous to work with for a variety of reasons, a lot of the lessons I learned about writing good xslt (e.g. defining larger templates as composed of smaller ones, preferring `apply-templates` to 'map' datasets over explicitly for-looping over them) transferred to any other language. Eventually this got my interested in facebook's hacklang and its XHP syntax, which led me directly to React (jsx felt like XML that didn't scold me every time I forgot to spend 300 characters writing namespaces at the top) once it came out, and I was one of the first adopters.

Nowadays, I feel like I could probably go back to es3 and use plain functions, concatenation, and array methods and write better templates than I could using any fancy lib before, since I actually understand what I'm doing.




I can see what you mean, going to stop arguing on the internet anymore, realize its both addicting and embarrassing, any way to delete comments?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: