3 ms·
Sounds a lot the style I learned from working through HTPD[1]. Define data types, then pass the data around through functions. You work through it in a dynamic
by adamddev1 3y ago
Sounds a lot the style I learned from working through HTPD[1]. Define data types, then pass the data around through functions. You work through it in a dynamic language, but you keep track of all your data types, writing them above your function definition and make sure they line up, kind of like a manual, self-imposed type-checking system.
One thing that amazed me while working through HTDP was that almost all my bugs came from not understanding the data types correctly, or messing something up with the process of manual type-checking. Once I understood the data structures I was trying to pass around and compute with, the bugs almost always melted away.
Now I program basically everything in a language with type checking (mostly in TypeScript) with thinking about data types and type definitions as the foundation. I'm amazed to see how 95% of the pain, complexity, and bugs has just melted away.
[1]: https://htdp.org https://htdp.org
- srcreigh 3y agoHTDP is used to teach first year programming at Waterloo for at least 11 years
- elevenoh4 3y agoI'd like to do more of this. but every time i use typescript in react/nextjs i end up hitting breakpoints in transpiled js code instead of the TS source, esp. in my tests/running single-files.. and i've tried so many debug configurations
- Wagthesam 3y agoFunny how school lessons are not applied in the real world. I worked at a Waterloo unicorn, and we had a single refund function that either authorized or denied a refund, with dozens of parameters in the function header
- akavi 3y agoIt speaks to waterloo’s success that i don’t know which waterloo unicorn you’re talking about. (Also worked at a waterloo unicorn. Codebase was the cleanest i’ve worked in, though perhaps excessively so, at the cost of product velocity)