4 ms·
Having worked at two unicorn-ish startups that were founded and grew up on Python stacks I specifically want to work on a statically typed backend for my next j
by bosswipe 5y ago
Having worked at two unicorn-ish startups that were founded and grew up on Python stacks I specifically want to work on a statically typed backend for my next job. I'm tired of the mishmash that is a large mature Python codebase.
- defnmacro 5y agoDoesn't type hinting in 3.5 solve this, assuming one was to use it?
- da39a3ee 5y agoNo. The python type-checking experience is OK but nowhere near as good as Typescript, let alone a real statically-typed language such as Rust or Java.
- blacktriangle 5y agoI'm in a similar boat coming from a Rails mishmash and looking at our next product, particularly debating JS vs Kotlin. While the upsides of static typing are pretty clear, here's my problem. All our app really does is receive a JSON request, read some data from a database, do some computation (this is the step where static would be nice), write some data to a database, and then respond with more JSON. So the inputs and outputs of the system are collections of heterogeneous maps that static typing systems don't handle well. So if I want those nice static guarantees in my code, I need to write layers of ORM and serializer code to get data in and out of my system. I'm not sure the static benefits are worth the advantages of not having to maintain this additional layer of data transformation.
- bosswipe 5y agoYep, this is where you can end up with tons of mapping boilerplate and potential bugs. I tend to reach for code-generation tools, schema based protocols like Protocol Buffers, and prefer code simplicity over performance concerns. The hope is that the price you pay for building around strict consistent data models across all your systems will pay off in maintainability and fewer bugs.
- sharms 5y agoI have used Kotlin and KTOR and it seems to do well, are your data types unknown prior to runtime?
- kcartlidge 5y agoGiven that you're coming from Rails you may be pleasantly surprised by DotNet Core 5 (C#). In addition to the static typing, by choosing an MVC project with an Entity Framework (EF) backend you get something similar to active record, with full-stack views where your database can be connected to your frontend if you like, scaffolding, migrations, seeding, relationships with navigational properties defined in your models, routing by discovery/convention, validation by model attributes, strongly-typed views, out-of-the-box client-side validation based on the same attributes, and server hot reload ('dotnet watch'). Through generic types and EF you don't need to write ORM or serialiser/mapping stuff, and at the same time you gain self-contained releases (no framework installations needed on the server) and a very performant stack with great language features. Core may come from Microsoft, but it's free, open source, cross-platform, fast, and supported (plus Visual Studio has a free community edition). It's seen as an enterprise thing, but is a fantastic option for small projects too.
- blacktriangle 5y agoInteresting...how well do these features work with F#, that's a language I've heard excellent things about.
- kcartlidge 5y agoI must admit that despite using C# since around 2001 I've never done more than glance at F#, so can't answer from the language perspective. However as all the DotNet languages use the same DotNet Core framework (which despite the name is not necessary on the deploy servers) they use the same libraries and modules. So whilst I don't know how seamlessly they integrate into the F# code, they should certainly be available.
- spamizbad 5y agoOur unicorn ended up rewriting our legacy Python 2.7 stuff in Python 3 with mypy for static typing and Black for code formatting.
- adsharma 5y ago> But even if we don't get the full benefits of static typing (more useful IDEs, better performance, eliminating certain classes of errors, etc.), at least we mostly don't have to deal with the insane errors that you get with implicit type coercion in JavaScript. I find vscode + pyright useful for static typing. My only complaint is that pylance is closed source. Better performance - transpile to a statically typed language. Forces you to stick to a small/sane subset of python.