5 ms·
> Types, abstractions, tests, versions, state machines, immutability, formal analysis, all these are tools available to us in unfamiliar terrain. Use them to ta
by behnamoh 2y ago
> Types, abstractions, tests, versions, state machines, immutability, formal analysis, all these are tools available to us in unfamiliar terrain. Use them to taste.
How did people program in Lisp for decades? I like types and such, and have even gone so far as to write Python like it's Rust. But in the end I realized dynamic languages have an appeal for a reason, and by using types all over the place, I was not getting the benefits of a dynamic language like Python.
When context is mostly static, dynamic languages shine. Context could be, for example, the structure of the directory. If I want to read a file and I know that the file exists, throwing a bunch of type checks about file reading operation is just overkill and slows down the development.
- BigJono 2y agoThe very next dot point is agreeing with you: "The ideal quantity to use these tools is tiny, much more miniscule than any of us is trained to think". And I agree tbh. The TS community has turned me off static typing for life. It's just wall to wall bikeshedding from the least productive people I've ever had the displeasure of working with.
- trustinmenowpls 2y agoHonestly, that explains perfectly why all MS apps have gone from useable if a bit slow or buggy to just unusable buggy messes that crash constantly and make my machine feel like its running on molasses.
- nl 2y agoIt doesn't "explain" it at all (and indeed many of reject the idea that MS apps - in general - are worse. They've had a bad reputation for decades, and that isn't based on nothing).
- behnamoh 2y agoTeams + the entire Office suite are two examples of Microsoft products going downhill over time.
- miffy900 2y agoThat's true but that has absolutely nothing to do with types in programming languages; it has more to do with MS's culture of always favouring backward compatibility and never culling any features in every version.
- behnamoh 2y ago> it has more to do with MS's culture of always favouring backward compatibility and never culling any features in every version. The new Office suite are unbelievably buggy and slow not because of backward compatibility, but because of numerous useless "features" Microsoft added which made the software essentially bloatware. By the time Excel opens up on my Mac, I can open several Google Sheets and start working.
- nl 2y agoHas Teams ever been good? From the first time I used it it has always been one of the worst pieces of software I use. Office seems fine to me - not great software, but I haven't noticed any particular decline (not a heavy user, but have been using it since Word v2 in the 1990s) And in any case what does this have to do with Typescript and the (over?) use of types?
- trustinmenowpls 2y agoThe actual quality of their apps has significantly degraded over time. Many of their apps which use web-native technologies have become nearly unusable, and I strongly suspect it's exactly because they've gone down this insane road of bike shedding and constant re-inventing of the wheel instead of pursuing excellence.
- seer 2y agoHmm, rarely have I thought types were a burden, rather than help, maybe I’m weird. Maybe I spend effort in making sure my types are useful and easy to work with, but one previous TypeScript I got to a state where _all_ of my database queries were automatically typed, and all of my requests and responses too, so both input output were guaranteed to be correct bg the compiler, so any bugs or errors that were left were business logic. It was incredibly liberating - like pairing with someone who was junior but very pedantic. I ended up writing almost no unit test and only having integration level tests, cause the job of those test was mostly covered by types. And writing the code itself was such a pleasure - you get immediate feedback if your program is correct _as you type it_. The most bizarre consequence of all this to me was writing a program for almost 2 hours, hundreds of lines of code, and then executing it and having it do exactly what you wanted on the first compile. That was both scary but exciting! One can get over-constrained with types for sure, where you’re sending more time “fighting the types” rather than writing your code. But this is all just learning, once you understand how the typesystem works it all becomes easy to work with. It was the same story with tests - once I started testing everything- it wasn’t easy to adopt my code to be testable, took effort, but then I learned how to make code pure, move state to the edges, manage dependencies etc, and all of those are useful practices in their own right, regardless if you write the tests or not. Same with types - schema design and invariants, state machines, edge cases in type conversion and how to lock and manage external dependencies. Sets, unions etc - it became the way I reason about code with of without types and my code is better for it. I also assume that types would make AI generated code much better _and more reliable_ because of the additional information and structure that it provides, so I recon they are here ti stay.
- fendy3002 2y agohave you worked with java or C#? both are where types sometimes become a burden. No, you cannot just do something like this: ``` return { data, message: "OK" }; ``` you need to declare a class or struct that match the definition. There's mapper and builder everywhere. Adding / deleting 1 column from a datatype can force you to make changes in 5 places due to mapper / builder.
- 2y ago
- tmtvl 2y agoI quite like Lisp 'cause I can do silly things like: (defun sum-triplet? (list) (declare (type List list)) (and (= (length list) 3) (destructuring-bind (a b c) list (and (numberp a) (numberp b) (numberp c) (= (+ a b) c))))) (deftype Sum-Triplet () '(and List (satisfies sum-triplet?)))