120 karma · joined Aug 25, 2017 (9y ago) · 32 submissions
comment 2y ago · link · parent
comment 7y ago · link · parent
I can't tell you how many times I've seen people "make it work" and create a mess that has to be rewritten later with much greater difficulty than if even the slightest amount of forethought had been given before hand.
comment 7y ago · link · parent
comment 8y ago · link · parent
comment 8y ago · link · parent
I'm really excited about a project inspired by Elm called Yew but allows you compose components much more naturally and easily.
comment 8y ago · link · parent
comment 8y ago · link · parent
You're totally missing the point dude. The point is that C doesn't protect developers from some of the most basic mistakes and offers very little tooling compared to modern languages. It turns out that maintaining huge software projects in C is actually really hard.
comment 8y ago · link · parent
This guy does a pretty good presentation on Polymorphism in Rust vs C++: https://www.youtube.com/watch?v=VSlBhAOLtFA
comment 8y ago · link · parent
Those things have nothing to do with good or bad code and have everything to do with the language.
comment 8y ago · link · parent
I personally think it's a good thing to only allow overflows when explicitly allowed.
comment 8y ago · link · parent
comment 9y ago · link · parent
comment 9y ago · link · parent
comment 9y ago · link · parent
I've worked at places that did stuff like the author suggests without pinning versions, and it always just ends up with some unlucky person spending their weekend fixing a dumb bug cause by an upgrade.
LTS is the reason we can all sleep soundly knowing our code won't spontaneously break, so I'm extremely grateful to the hard work everyone puts into it.
comment 9y ago · link · parent
I did read Clean Code by Robert Martin. He's definitely in the "die hard TDD guru" category, but there are still useful examples to be extracted from the book.
Besides that, I mainly learned a lot of testing tricks in the wild, reading through Github projects. My learning process now-a-days is mostly:
1. Discover a really cool trick or concept I didn't know existed in a Github project. 2. Research the hell out of it. 3. Try to use it in some personal example project.
comment 9y ago · link · parent
That said, testing the input/output directly doesn't work well because now a single change the output data (adding a field to the JSON for example) will call tons of tests to fail.
I usually use or create some JSON serialization/deserialization classes and use those to generate fake data and ensure that the API returns 200 responses.
That way if I add a field to the JSON objects, my tests are unaffected and will generate the new fields in the tests.
So I may do something like this (Python-ish):
new_user = User.generate_user()
response = api.post('/users', new_user.serialize())
assert response.status_code == 200
response = api.get('/users')
users_json = json.loads(response)
users = {}
for user in users_json:
users.add(User.unserialize(user))
assert new_user in users
That way changes to the User JSON will not impact tests and I still have some basic sanity checks.Hope that helps.
comment 9y ago · link · parent
It's too high-level for a lot of low-level work, and too low-level for a lot of high-level work.
This is true in the very specific cases that you gave, but I believe that is the minority of use cases, not the majority.Even the example of writing a GC that requires tons of unsafe code, that is not a good argument for making all the code unsafe. All the unsafe GC code would be abstracted away into a module and would be more obvious to those looking at it that they will need to be watchful for undefined behavior. Now you can proceed writing the rest of the project in safe, simple Rust.
People will also mention "fearless concurrency", but guaranteeing the absence of data races is not hard
Maybe for developers that are very familiar with the race conditions of parallel code, but definitely not for most people. Even seasoned developers will make mistakes with simple multithreaded code.Also, the reasoning behind "x is easy so why do I need my language to check it for me" is questionable. The whole point is that you have a guarantee. Have you never had a compiler catch a stupid mistake before it happened and felt relieved? I doubt it. Now imagine if instead of debugging stupid data races in your parallel code you can spend that time optimizing and improving it. I fail to see how this can be viewed as negative.
Sure Rust doesn't cover 100% of use cases, but it definitely covers more than you're implying. It's low-level enough that Redox OS can be written in Rust, but high-level enough that Firefox is now outpacing other browsers and parallelizing everything with Rust.
comment 9y ago · link · parent
https://www.facebook.com/notes/facebook-engineering/under-th...
You should look into CockroachDB if you want something very easy and scalable. It's strongly consistent like a conventional RDBMS but still scales horizontally pretty easily. It's basically like Google Cloud Spanner if you've heard of that.