4 ms·
> Sure you have to write: Map<String,User> userIdMap = new HashMap<String,User>(); instead of: userIdMap = {} but in the bigger scheme of things, is tha
by smegel 11y ago
> Sure you have to write:
Map<String,User> userIdMap = new HashMap<String,User>();
instead of:
userIdMap = {}
but in the bigger scheme of things, is that so long?
More like user posts complex JSON object, which takes me seconds to parse into a Python data structures, and hours or days to figure out complex mappings into Java classes. It's often the mapping of objects to serialized forms is where a huge amount of time gets spent in statically compiled languages. And it's NOT just a once of investment - those mapping change in future and some poor soul is going to have a fun time modifying your Java app, no matter how well named your variables are.
If you are writing glue code or IO bound web servers without a high performance requirement, the difference in productivity between Python and Java is not at all trivial.
- necubi 11y agoIf you want type safety, you need to parse your JSON into a java class (although "days" is definitely an exaggeration with the right tools—I'm a fan of json-schemas and jsonschema2pojo [0]). But of course you don't get type safety in python, so it's bit of an apples and oranges comparison. If you're willing to settle for no type safety, there are untyped Java APIs like Jackson's tree API [1] that are, while definitely more verbose than Python's, similarly productive in my experience—and much, much faster. [0] http://www.jsonschema2pojo.org/ http://www.jsonschema2pojo.org/ [1] http://wiki.fasterxml.com/JacksonTreeModel http://wiki.fasterxml.com/JacksonTreeModel
- danieldisu 11y agoYeah, but when you have to change anything in that part of the code, you thank that everything is statically typed and you know what that json object contains...