DEV Community

loading...

Discussion on: Organizing MVU Projects

Collapse
kspeakman profile image
Kasey Speakman Author • Edited

Thanks for your response. :)

I agree that types mostly aren't helpful for avoiding bugs. They can be if you design types which cannot have invalid values. I do this when it is convenient, but usually this is not worth the effort for me. Because to do so, the type effectively becomes an OO object with behavior bound to private data. And maintaining it in the future means maintaining that facade's overhead. I like FP because I prefer being able to compose data separately from behavior, and keeping both of them relatively simple, so I do not do this that often.

While messing with Clojure, I recently rediscovered why I DO like types. It's because I have ADHD and a small working memory. Sometimes I had to swap back and forth between the file generating the data and the file consuming the data multiple times before retaining enough to write the consuming code. By using types and tooling assistance, I can have auto-completion of valid properties or can lookup the specifics of the data provided to me on the other end. And even without ADHD, types can be helpful for the same reason as programs get large, because the working memory required is too big for most humans. Types definitely have undesirable maintenance overhead, but for me it is worth paying. Maybe not for everyone.

Collapse
brucou profile image
brucou

How interesting. I'd rather not know if I have ADHD but I do have a short-term memory and I am almost never programming more than 2 hours in a row anyways. I solved the get-back-in-the-flow issues with writing docs first and filling the code in the middle -- and leaving a test failing here and there. I am almost more of a writer than a coder but then after leaving notes to myself for a few years, I find it easy to write any kind of technical article. Tooling helps for sure, and I love the types that I don;t have to write. I get the benefits without the trouble :-)

Thread Thread
kspeakman profile image
Kasey Speakman Author • Edited

For me I was literally not remembering the property names and types I just looked at or typed into one file and needed to now consume in another. (I remembered them, but not precisely -- spelling/capitalization/exact term etc.) Maybe all these years of types have trained my behavior that I don't have to. 😂