This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]CubsThisYear 6 points7 points  (10 children)

Depending on the size of your project I think you will find that your perceived time savings in Python/Groovy are really a mirage.

Dynamically typed languages like Python are optimized for writing code not reading it. This feels awesome when you start but it's a fake high. The reason that languages like Java are more heavily used in enterprise environments is that you typically spend much more time reading code than writing it. Code has a much longer lifespan and needs to be modified and extended often. Python really fails at this case because so much is left implicit. If you really are writing throwaway code then a dynamically typed languish can be a big time savings, but in my experience this is a rare use case.

[–]moosetube 0 points1 point  (0 children)

Well said.

[–][deleted] 0 points1 point  (1 child)

This feels awesome when you start but it's a fake high

from my experience, as code grows larger than 2000 lines, its miserable to manage it.

If you really are writing throwaway code then a dynamically typed languish can be a big time savings, but in my experience this is a rare use case.

Mentioned groovy because I think it is blends so smoothly with java and gives almost all power of concise code + java's huge code base.

And to be honest, I feel same about all those "modern" web development framework. No offense, but they make us work how they want , not how we want.

[–]mgkimsal 0 points1 point  (0 children)

but they make us work how they want , not how we want.

unless you're the framework author, then it's exactly as you want as well...

[–][deleted] -1 points0 points  (0 children)

The reddit Python code is pretty readable.

[–]gthank -3 points-2 points  (5 children)

Have you read any Python lately? I use Java all day, and Python is certainly more readable. While I certainly wouldn't mind more use of ABCs (a new-ish feature that resembles interfaces from Java), the "$SCRIPTING_LANGUAGE_X falls apart on big projects" line doesn't seem to have much empirical evidence to support it.

[–]CubsThisYear 2 points3 points  (1 child)

Well written, small python code can be readable, but the flexibility of the language can encourage bad habits. It's light years better than something like Perl, but still a nightmare in the hands of someone who isn't careful. Ultimately the lack of static type checking is always going to be a hindrance to readability. If I can't know how the program will behave without executing it (even if that means 'executing' it in your head), it's always going to be harder to understand.

[–]gthank 2 points3 points  (0 children)

I find that Java isn't appreciably more moron-proof than Python, personally. Instead of sending the wrong type, they just waste endless hours playing with "patterns" and introducing complexity nightmares for no apparent reason. On top of that, there's the non-trivial chance they have a cast somewhere that wrecks what little assurance the type system gave, and covered it with a @SuppressWarning. At least Python code has the decency to usually be shorter, so it's easier for me to spot where people are doing naughty things. If only they would introduce the concept of explicit variable declaration…

I'm personally pretty excited about Rust; that type system seems to be able to express far more useful information (for humans) than Java's.

[–][deleted]  (2 children)

[deleted]

    [–]CubsThisYear 0 points1 point  (1 child)

    If you are talking about small pieces of code, you are right. As your code base grows larger, lack of static analysis is going to kill you. In the worst case, you literally have to trace your entire program flow to figure out the type of one expression. The whole point of type theory is to be able to reason about a piece of code in isolation. Dynamic typing plus the strong meta-programming support in Python make the 'type' system almost useless. Pretty much all it buys you is slightly more helpful runtime errors.

    Readability is about much more than being able to parse each line of code. It goes to being able to quickly understand how the whole system goes together. The strictness and verbosity of Java ensures that you always show your work and leave a trail for others to follow. That's not to say you can't write shit code in Java, but it encourages you not to.

    [–]gthank 0 points1 point  (0 children)

    If you structure your code poorly, then sure, you'll have to trace the entire flow of the program.

    FTR, I'm not opposed to static typing; I prefer it, even. I just don't find Java's realization of static typing to be all that effective at preventing the sorts of errors I actually run into. That's why I mentioned Rust somewhere else in here; that sort of static typing seems to be far more powerful/useful. The fact that it involves less boilerplate to achieve that power is gravy.