|
|
|
|
|
by stickfigure
2724 days ago
|
|
> This isn't at all true. Well I guess we'll just have to disagree there. I spend a lot of time writing code in all of these languages. By the time you've bulletproofed your dynamic code, you've got more code than if you'd just declared a simple static Java type. I can define this... @Data
public class Thing {
final String text;
final Instant when;
}
@Path("/thing")
public class ThingResource {
@POST
public void doSomething(final Thing thing) {
// ...blah
}
}
...and stop worrying in my implementation about what was actually passed in, or how a JSON string date got turned into a real date representation. This is mostly-vanilla Java.Sure you can, with enough extra code and clever libraries, hack together a crude typing system into dynamic languages to automate much of the conversion. At the end of the day you're still declaring types, and it doesn't end up being as elegant as having the type system built into the language. |
|
No, its Java EE, which like I said, has an entire library devoted to safe marshalling[1]. Marshmallow does the same thing for you in python. Java EE including a marshalling library has nothing to do with static typing.
This is python + flask + marshmallow (2 very common web libraries)+ a 2 line helper function:
Or, like I said, use protos, where this would be something like and everything is validated.[1]: https://dennis-xlc.gitbooks.io/restful-java-with-jax-rs-2-0-...