2 ms·
Just to add some context, here are the tests which I didn't write, but would in Python/Flask usually: - Proper behaviour if I don't pass a parameter. Not neede
by viraptor 11y ago
Just to add some context, here are the tests which I didn't write, but would in Python/Flask usually:
- Proper behaviour if I don't pass a parameter. Not needed, because it's an explicit `Option<>` which I have to handle.
- Is results list constructed properly / what's the None-vs-empty behaviour. Not needed, `Vec<>` is verified at type level and None is not possible.
- What happens if various database functions don't find a result. Not needed, because type signatures force either a returned `Entity` (if it's not there, it's an implementation bug: panic + 500), or `Option<Entity>` which again needs to be explicitly handled.
But these are only unit tests. If it was a critical app, I'd still write functional / logic tests to make sure the right data goes all the way to the database and back in known scenarios. Types can't guarantee that.
One kind of tests I'm tempted to write is for templates rendering properly, because handlebars-iron takes parameters as Json - all type guarantees go out of the window there. But it may be the same amount of effort to migrate to some type-safe templating like Maud.
- s_kilk 11y agoI've had a similar experience writing web-apps in Scala. The Option type alone handles so many cases which would otherwise require unit-tests in Python or another unityped language.
- Cyph0n 11y agoI'm a Python/Flask dev who has knowledge of the basics of Scala. Which web framework and ORM would you recommend to develop a (potentially) non-trivial web app?
- neverminder 11y agoIf you want to use Scala, Play Framework 2.4 + Slick 3.0 would be the deadliest combination in my opinion.
- s_kilk 11y agoSecond, I'd certainly recommend play framework.