Live data from Hacker News

Why Java? Tales from a Python Convert

sookocheff.com

71–80 of 102 posts

Re: Why Java? Tales from a Python Convert

#71
post #33
post #29

Earlier quoted context omitted.

Because it's actually useless, having the work been done by someone else or something else means the work is still done, and you still depend on that 3rd-party.

Better program in Assembly then.

I was strictly speaking about getters and setters, and I do maintain that they are completely stupid and useless. If you're writing your 10 kLOC side-project, then sure, just use them and take comfort in knowing that there's a tool out there that you can just add to the toolset. You're (almost) the only one working on this project, there are no clear steps for how to setup a working environment because you gradually built it along the road.

But when you're on a 10 MLOC projects that's been touched by hundreds of people for decades, most of which just can't program and aren't there anymore to fix the mess they left, with untouched original parts still being the core of your system, with nobody having a clear picture of how the whole thing works because it's been divided in so many parts that interact through a poorly-defined, undocumented interface, then you become extremely wary of adding anything because you don't want to complicate things further, but you still have to make it work, because it actually solves a problem for the customer.

The more you can remove, and the less you need, the happier you will be. Using lombok or having the IDE do it may solve the problem, but there is a much better alternative: remove the problem altogether.

Re: Why Java? Tales from a Python Convert

#72
post #34

> Java’s type system, while verbose at times, allows you to write code that largely “just works”. NullPointerException would like to have a word with you about that. In all seriousness, it feels unreal that people can be that impressed by Java's safety or lambdas. Makes you shudder to think about what they've used before that.

AttributeError: 'NoneType' object has no attribute isn't much better. Java might not be perfect, but it does let you catch a lot of problems at compile time rather than run time, which is a step in the right direction. The alternative (run it and see) gets old fast.

Java provides less of the benefits of static typing than many other statically-typed languages (even than others available on the JVM), at a much higher cost in required ritual invocations made to the type system.

Yes, there is a value in static typing, but that value is minimized when you have a type system that isn't particularly expressive and/or have to make add a lot of redundant code to satisfy a comparatively unsophisticated type checker.

Java may have gotten slightly better since its poor performance in cost:benefit terms when it came to static typing helped launch the surge in popularity of dynamic languages, but its still not a great poster child for the benefits of static typing.

Re: Why Java? Tales from a Python Convert

#73
post #5
post #2

These examples look like C# 2.5 with a little bit of LINQ.

IMHO, C#'s tooling and is definitely ahead. Java is starting to get there, and I can see why the JVM is still popular. But given the actions of Oracle and MS as of late, I think I'd take MS. VS starter projects are easy to setup and run... Every Java application I've worked on has been an exercise in frustration just getting the environment setup.

Agreed. On the other end of the spectrum, you have cookiecutter:

https://github.com/audreyr/cookiecutter

Re: Why Java? Tales from a Python Convert

#74
post #51

Earlier quoted context omitted.

If it can be generated, why doesn't the compiler do it for you? This shouldn't be done at the IDE level.

The best argument is that the compiler doing it add complexity to the language. One might say adding complexity to the language is justified if it means removing complexity from the programmer's workload, but in many languages that attempt to solve this problem that's not how it works out. Most solutions to this amount to allowing programmers to intercept field access via getters/setters. This way they can just use p…

You also have that problem in a language with non-synthesized setters, because there's no guarantee that they don't do anything - and people avoid permitting direct field access, so you'll be going through a setter with unknown behavior.

That being said, if you're throwing off side-effects like mad in setters, short of prohibiting either mutability or side-effects, there's not much the language can do to prevent that.

Re: Why Java? Tales from a Python Convert

#76

Earlier quoted context omitted.

AttributeError: 'NoneType' object has no attribute isn't much better. Java might not be perfect, but it does let you catch a lot of problems at compile time rather than run time, which is a step in the right direction. The alternative (run it and see) gets old fast.

Java provides less of the benefits of static typing than many other statically-typed languages (even than others available on the JVM), at a much higher cost in required ritual invocations made to the type system. Yes, there is a value in static typing, but that value is minimized when you have a type system that isn't particularly expressive and/or have to make add a lot of redundant code to satisfy a comparatively…

And don't forget Java's type erasure. Still wondering how they could actually call that a FEATURE.

Re: Why Java? Tales from a Python Convert

#77

Earlier quoted context omitted.

Java provides less of the benefits of static typing than many other statically-typed languages (even than others available on the JVM), at a much higher cost in required ritual invocations made to the type system. Yes, there is a value in static typing, but that value is minimized when you have a type system that isn't particularly expressive and/or have to make add a lot of redundant code to satisfy a comparatively…

And don't forget Java's type erasure. Still wondering how they could actually call that a FEATURE.

Was erasure necessary to maintain backwards compatibility?

Also what are you doing that you need type information at runtime?

Re: Why Java? Tales from a Python Convert

#78
post #71
post #33

Earlier quoted context omitted.

Better program in Assembly then.

I was strictly speaking about getters and setters, and I do maintain that they are completely stupid and useless. If you're writing your 10 kLOC side-project, then sure, just use them and take comfort in knowing that there's a tool out there that you can just add to the toolset. You're (almost) the only one working on this project, there are no clear steps for how to setup a working environment because you gradually…

Try 1 MLoC project written in dynamic programming language (in this case: javascript) and touched by hundreds developers for 3 years.

I guarantee you that you will deal with way more uncertainties than Java.

This getter/setter is a micro-issue/insignificant.

Re: Why Java? Tales from a Python Convert

#79
post #37

OP is glossing way too many things. 1. Desktop users are tricked in to installing Ask toolbar crapware. Which other language tricks users in to doing that? 2. Java development actually have languished for very long time and it is very recent that it started to catch up with C# and other modern languages. Java forums are filled with cries and screams for adding these improvements for years on. 3. Java is built on lang…

Seems like these points glossed a lot of things as well.

I mean... what language that locks you down with one specific operating system (up until recently when they lost the market)?

I see other languages copying Java tools/ecosystems but I give you 10% point for which Java syntax was behind for years.

Your point #4 don't make any sense at all. The only reason Microsoft goes OSS these days because they simply _lost_ their bread and butter: developers. Back then, they haven't entirely lost them so there's no way on earth that Microsoft will be pulling whatever they're doing these days.

> It's ok to use mature tools to get shit done now but proposing them as new frontier doesn't make sense.

Unfortunately none of the current language seems to get shit done in a reliable, reusable, and ubiquity as Java.

Re: Why Java? Tales from a Python Convert

#80
post #69

Earlier quoted context omitted.

Bingo! Coming from C# and C++, I had exactly the same realization using Python (before I switched back). I always ask Python programmers "but are you just keeping track of the types in your head?" because it's impossible to keep myself from doing that. If Python (and dynamic languages in general) are just pushing the type checking into the programmer's lap, I'm not sure what the advantage is other than less verbose (…

That's the problem I had with perl. Sometimes one plus one is two, sometimes it's eleven, and the interpreter doesn't always do what you expect.

Perl has distinct operators for string concatenation and numeric addition (as well as string comparison/numeric comparison):

  $ perl -E 'say "plus: ", 1 + "1"'
  plus: 2
  $ perl -E 'say "concat: ", 1 . "1"'
  concat: 11
There is some type funkiness: a Perl variable can have both string and numeric components. However, which one is in use is only a problem in serializers (JSON, etc.) -- in normal usage you can rely on choosing the right operator for the type at hand.
Post reply on HN