3 ms·
>> backend web development >> thread-safety In 2021 what web development stack is making you write threaded code? >> correctness that matters The compilers
by CraigJPerry 5y ago
>> backend web development
>> thread-safety
In 2021 what web development stack is making you write threaded code?
>> correctness that matters
The compilers guarantee end at the edge of your processes address space. You still have the same big problems as everyone else:
1. Are you building the right thing?
2. Does everyone understand the domain adequately to do their job?
3. …
101. Do i have a race condition
Except you have a self-inflicted problem - you’re slower than a dev team working in a traditional language (java, go, python, …) and you can’t easily hire talent.
- gpm 5y ago> In 2021 what web development stack is making you write threaded code? Go? I've had thread related bugs in go related to serving our UI. Generally any reasonably efficient stack where you need to pull on more than 1 CPUs worth of resources to quickly serve a request. And most stacks where you need to make multiple requests to other services simultaneously to quickly serve the original request.
- steveklabnik 5y agoMy very first production Rails app involved a C extension to do some heavy processing. Not all web applications are a thin UI over a database table (not that there’s anything wrong with that, mind you…) The framework might not make you but that doesn’t mean your code won’t need such things.
- vips7L 5y agoIsn't that just self inflicted though? You probably wouldn't have had to write C/threaded code if you chose a faster runtime like C#/Java/Go/Kotlin/Scala instead of ruby.
- steveklabnik 5y agoAt the time, Go/Kotlin didn't exist, Scala wasn't established, C# was Windows only, and Java and the JVM more generally were a thing that everyone was running to Ruby and Rails from for lots of reasons. Probably wouldn't have gotten the thing out the door if I had to do it in Java.
- zozbot234 5y ago> In 2021 what web development stack is making you write threaded code? Go uses "green" (user-level) threads.
- cjg 5y ago>> you’re slower than a dev team working in a traditional language (java, go, python, …) If anything my experience is that it's quite productive to work in Rust. For example, compared to Python (which you mention) we catch bugs earlier (with the compiler) rather than later (system test) and so development is faster. Shift left. It's particularly important for races because they are some of the most difficult bugs to find and fix.
- staticassertion 5y ago> Except you have a self-inflicted problem - you’re slower than a dev team working in a traditional language (java, go, python, …) and you can’t easily hire talent. I'm radically more productive with Rust vs Python (having been using both for >5 years). Our codebase is split between the two and I'm working to move virtually all Python code to Rust because it's become such a burden. * IDE experience is considerably worse in Python due to lack of types (we use type hints aggressively, but that only helps so much and not at all for 3rd party libs). * Working with JSON is considerably worse in Python in my experience. * Package management and building is considerably worse in Python. It's still difficult to manage a many-package project and get what Rust provides by default, like workspaces, cryptographic lockfiles, etc. * Error handling and other patterns in Rust make it far easier to write in a robust way or otherwise correct in the future. Rust is far more resilient to errors during refactoring - I'm very afraid to touch some of our Python code, by contrast. * Mypy is nowhere near as good as rustc. Mypy errors are traditional "expected blah got blah", or sometimes "expected List[T] got List[<nothing>]" and other unhelpful errors. Rust errors are almost always expressive and helpful - often telling you exactly how to fix your code (to an insane extent - like using a heuristic to tell you where you probably forgot a curly brace). Mypy is impossible to use with the strictest settings. Lack of recursive types makes working with JSON blobs impossible, makes it impossible to do circular generics (you can't do what Rust does with From/Into as far as I know because of this). And then there's shit like circular imports being a runtime error, and other little papercuts in the language that are just littered everywhere. I actually really like Python a lot, despite all of this, but I'll never choose it for web services again. And hiring hasn't been a problem at all at my company, nor was it at Dropbox where I worked previously