4 ms·
Is there a web framework / ecosystem built on a statically-typed, non-JVM language that comes close to the feature set of either Django/Rails? After spending t
by _huayra_ 6y ago
Is there a web framework / ecosystem built on a statically-typed, non-JVM language that comes close to the feature set of either Django/Rails?
After spending too much time chasing down dynamic-typing related bugs in both of those frameworks, I find myself missing a lot of their feature set when I look at other frameworks. However, I'm tired of doing "defensive programming" in Python to essentially statically assert argument types and unit test things that a statically-typed language would disallow by construction.
This stuff in Rust, Go, and even Nim [0] look interesting, but the consensus seems to be the value proposition of Rails or Django is still hard to beat unfortunately.
[0] https://nim-lang.org/ https://nim-lang.org/
- asplake 6y agoCan I add "ML-typed" to your spec? That's what would finally make me jump from Python/Flask
- izzle49 6y agojust curious why non jvm?
- _huayra_ 6y agoI haven't used the JVM in a long time, but judging by the web framework benchmarks I've checked out this morning e.g. [0], it seems like there are many Go frameworks that beat those on the JVM. I agree with other commenters on this thread that in general such benchmarks may not mean a lot when compute is so cheap and the autoscaling infrastructure is awesome, but I often work on embedded platforms or other resource constrained devices where adding the JVM is a nonstarter (not that Django or Rails is an option either in those cases). [0] https://github.com/the-benchmarker/web-frameworks https://github.com/the-benchmarker/web-frameworks
- apta 6y agoNote that those benchmarks use a non-standard golang HTTP library (fasthttp I believe), which even according to it's author makes certain compromises and can be tricky to deal with, and can fail in edge cases (I'd avoid it for production). Whereas the Java versions are much more standard and safer to use. Secondly, something seems off if a php framework is getting top place, unless it's doing some AOT compilation.
- TrueDuality 6y agoThe biggest one first: Operationally maintaining the JVM is a nightmare. It can be fast, but that isn't guaranteed and its not trivial to find out why, and easy for developers to mess up. It uses significantly more memory than anything else which will be your largest cost driver when running large services, compute is cheap, RAM is not. Security is probably the next biggest one. Vulnerabilities in the JVM are a problem but you'll have that in most software (given maybe only Flash beats the JVM in the history of boths existence) but the defaults for running a lot of things like groovy aren't secure (there is a debug port you can directly manipulate the memory of the running process without authentication). Commonly people use these debug ports in production, not just leave the defaults but actively choose to let them run. This is a very common pattern in Java based services usually caused by my first point. I am not aware of any other language or framework that offers remote memory access as a feature. Then there are the dependencies and package ecosystem. I believe the "built on the JVM" languages like Kotlin have gotten a lot better at this, but as soon as you start tapping into the pure Java "enterprise grade" libraries you're most likely bringing in way more than you bargained for both in terms of complexity, maintainability, and security. A lot of those libraries are simply poorly built.
- apta 6y ago> Operationally maintaining the JVM is a nightmare The JVM gives you practically every knob you need to achieve maximal performance for your workload. I don't know of any other environment that does that. Secondly, with new GCs like ZGC and Shenandoah, the number of knobs to tune (at least with respect to the GC) has decreased dramatically to only a couple. > Security is probably the next biggest one. Vulnerabilities in the JVM are a problem but you'll have that in most software This is a non-issue for backend systems. Barely anyone uses Java for browser-side rendering anymore.
- nobleach 6y ago> The JVM gives you practically every knob you need to achieve maximal performance While this is true, finding folks that deeply understand how those knobs work, (and what the potential pitfalls are of twisting each knob might be) is not as easy as finding a Java/Kotlin/Scala/Clojure/JRuby developer. The out-of-the-box JVM experience can take one quite a long way. It's that last mile to real performance that can be the nightmare.
- crenwick 6y agoC# or maybe Node with typescript.
- _huayra_ 6y agoIs C# usable from Mono? I've kinda shyed away from C# due to not running Windows myself (and running it on the platforms at work is impossible), but I haven't had the time to try it with Mono.
- brixon 6y agoI would personally avoid Mono, but I would use .NET Core. Core is not built for Windows alone. https://stackoverflow.com/questions/37738106/net-core-vs-mono https://stackoverflow.com/questions/37738106/net-core-vs-mon...
- UK-Al05 6y agoYou are incredibly out of date. No one uses mono any more. It's .net core. The official version which works on multiple platforms.
- gwbas1c 6y agoJust last night I debugged some C# on Mac via Visual Studio for Mac. The debugger actually worked! I must admit that I've been tinkering with this debugger for about 11 years. (Used to be MonoDevelop, then Xamarain Studio.) It used to be very unstable. Now it's usable. YMMV
- apta 6y ago.NET Core has been running on multiple platforms for several years now, and many companies use it. I believe Bing itself is hosted on it as well. It's free and open source. They've been doing great work with performance.
- lincolnq 6y agoWe use Mypy to type check python, and I really like that system. Catches a lot of errors. Not as many as a full static typing system, but still a lot, and you can always drop back into dynamic typing when you want.
- _huayra_ 6y agoWow thanks! Does it just insert these checks automatically (`assert type(my_param) == int`)? I remember being so disappointed when I saw PEP484 and realizing that it didn't enforce anything.
- jononor 6y agomypy is only a static checker, there are no runtime-checks inserted. You run it as a command-line tool and it will fail the build if the types do not resolve, like a compiler or linting tool. For runtime-checking based on PEP484 type hints, one can complement this with a library like Pydantic/Enforce.py/typeguard/typesentry. Enforcement of the types is typically opt-in per function call, often by adding a decorator.
- fuy 6y agoasp.net core comes to mind
- htns 6y agoThere's Crystal: https://crystal-lang.org/ https://crystal-lang.org/