The more code I write in dynamically typed languages, the more I believe that static typing is a must. Generally speaking, I noticed that I'm shifting more and more away from "stop annoying me and let me do what I want, I know better!" part of the PL/API design spectrum, and towards "better safe than sorry". Static typing, runtime checks, data schemas, design by contract, fail fast etc. Yes, it's overhead, but it's p…
Dynamic languages: you are the compiler. You save time now to pay it later.
Ask HN: What made you change your mind about a programming language/paradigm?
271–280 of 401 posts
Re: Ask HN: What made you change your mind about a programming language/paradigm?
#272I didn't like python at first. The mentality of "hardware is cheap, there's no need to be that fast" drove me away from it full speed. However, I was short on time for something, and I gave it a try, then I actually liked it a lot. It's very practical and fast enough for most cases. The string processing capabilities has blown me away, however it didn't change my love for higher performance, compiled languages. Now I…
Re: Ask HN: What made you change your mind about a programming language/paradigm?
#273Testing. Unit testing to me seemed akin to drinking 8 glasses of water every day. A lot of people talk about how important it is for your health, but it really tends to get in the way, and it doesn't seem to really be necessary. Too frequently, code would change and mocks would need to change with it, removing a good chunk of the benefit of having the code under test. Then I started writing integration testing while…
If a unit test fails when the code under test hasn't functionally changed then it means that your unit tests are flaky.
Re: Ask HN: What made you change your mind about a programming language/paradigm?
#274I didn't notice this until I started learning Pharo and F#. Both of them were just so incredibly clean, and so much simpler. I never have to think about how to do anything in those languages too hard, since there's one good way of doing it, and if you're doing it in another way, you'll run into so many ugly bits of code that you instantly see that it isn't working.
Re: Ask HN: What made you change your mind about a programming language/paradigm?
#275Besides that, spending months fixing issues that pop up in production but should have been caught at compile time has turned me off from dynamically typed languages in favor of static typing.
Re: Ask HN: What made you change your mind about a programming language/paradigm?
#276Testing. Unit testing to me seemed akin to drinking 8 glasses of water every day. A lot of people talk about how important it is for your health, but it really tends to get in the way, and it doesn't seem to really be necessary. Too frequently, code would change and mocks would need to change with it, removing a good chunk of the benefit of having the code under test. Then I started writing integration testing while…
The integration tests that you are describing behave much like I would expect unit tests to behave. Give an input, assert the results (return value or state change). The example of optimizations breaking the unit test could be either a poor test (If the function doesn't need to call that intermediate with that data, why is it being tested?). Oftentimes the spy is added to the test because there is unnecessary tight c…
Re: Ask HN: What made you change your mind about a programming language/paradigm?
#277Earlier quoted context omitted.
I will probably be the lone voice here defending mock testing but probably not for the reasons you'd expect. Does mock testing end up being brittle? Yes. Do you have to refactor the tests immediately after making small changes? Yes. Is there a cost to this? Yes. Mock based testing however is the only thing I've ever encountered that forces me to think very, very clearly about what my code is doing. It makes me inspec…
What's stopping you from thinking clearly about the code while/after you write it? As I'm writing this sentence I'm thinking clearly about it and I'll probably reread it after I hit save. There's no reason you can't do the same w/ code.
Re: Ask HN: What made you change your mind about a programming language/paradigm?
#278I didn't like python at first. The mentality of "hardware is cheap, there's no need to be that fast" drove me away from it full speed. However, I was short on time for something, and I gave it a try, then I actually liked it a lot. It's very practical and fast enough for most cases. The string processing capabilities has blown me away, however it didn't change my love for higher performance, compiled languages. Now I…
TBH Java used to be a lot worse than it is now :)
Re: Ask HN: What made you change your mind about a programming language/paradigm?
#279Labview. I hated graphical programming. I don’t even know why. Then I worked on this fairly complex real-time system with FPGAs and lasers and whatnot with several people. Works first time. How does it work? Obvious. Encapsulation is obvious from the diagram. Comments barely needed. Need to make a change deep in the code that breaks an interface? Everything you need to change turns red. If something doesn’t look good…