News for hackers. Stuff that matters.
Re:Generating a Java program with 90% less code by CoolGuySteve on Wednesday December 04, 2019 @11:19AM (#21703463)
Java seems to rely a lot on IDE tools to autocomplete, autorefactor, generally shovel around all this boilerplate.

It always seemed weird to me. Like if my house was really cluttered but instead of building shelves or closets into the house itself, I buy an elaborate conveyor belt and excavator system to rearrange all my things all the time so I can walk through all the mess.

Re:Generating a Java program with 90% less code by dehrmann on Wednesday December 04, 2019 @11:39AM (#21703720)
I agree that Java is almost unwritable without an IDE, but that strictness has led to Java having better IDEs than most languages. For large code bases, most languages get unmaintainable without an IDE, putting Java at an advantage. I'd still use Python for something simple that won't grow past a few thousand lines, though.
Re:Generating a Java program with 90% less code by jakub_g on Wednesday December 04, 2019 @11:52AM (#21703863)
This. Far from being a fanboy of Java (and I write JS for a living), but you can generally quickly understand what's going on with the boring code, and can refactor mercilessly.

Whereas in huge JS codebases relying on framework magic you can really have hard time to understand what's going on without plugging a debugger (and even then it's still not easy). Trying to refactor legacy code that relies on `this` and prototypes is a nightmare.

Re:Generating a Java program with 90% less code by _zamorano_ on Wednesday December 04, 2019 @12:04PM (#21704011)
This!

I sometimes wonder if JS programmers know that with C#/VS you can just change the name of a class, and without doing anything else (not even replacing), all involved names just change, and everything works 100%, without writing any test.

And the same goes for moving a method to another class, or renaming member variables, modules, files... everything just works and is instantaneous.

To me, not being able to aggresively refactor withour worrying something will break somewhere is like backwards and old school (in the bad way)

When a project evolves, a class, a struct... grows and suddenly a name, perfectly fine at the beggining, does not make sense any longer. With C#/VS you just change and 2 seconds later you're still working.

Re:Generating a Java program with 90% less code by ehnto on Wednesday December 04, 2019 @12:13PM (#21704146)
Some might be surprised to know that in modern PHP this is also the case. The whole point of all the typing and structure is so you and the IDE can sanely reason about and understand the structure of the code.

If I get code and all of a sudden not even my IDE knows what's going on, it clues me in that there are layers of indirection in the codebase I'm going to have to waste time reading into, like magic methods or loose typing.

Re:Generating a Java program with 90% less code by rdevsrex on Wednesday December 04, 2019 @02:58PM (#21706275)
Yep, PHPStorm is a memory hog, but man is it handy in catching errors I didn’t think of.
Re:Generating a Java program with 90% less code by cosmotic on Wednesday December 04, 2019 @04:01PM (#21706920)
Is it really a memory hog? I'm using IDEA, PHPStorm's more fully featured Java IDE (That also loads PHP code!) ; I have 6 projects open right now, including a PHP project, some java projects, some ruby, groovy, etc; I have 20 files open, numerous plugins enabled, and all sorts of connections to databases and tests; it's been running for days it's using 500MB.

Both PHPStorm and IDEA are written in Java (they share a common code base). Don't confuse [Java eagerly allocating memory from the operating system but then not using it for anything (yet)] with java using a lot of memory. For speed, java allocates memory it anticipates using in the future. This lets it manage it's own memory without involving the operating system and thus context switches. If you start using a lot of other applications and available system memory starts running low; java will detect this and relinquish the pre-allocated memory it's not using.

Re:Generating a Java program with 90% less code by toolz on Wednesday December 04, 2019 @12:17PM (#21704212)
I sometimes wonder if IDE users realize you can do 99.9% of the same things with simple tools. Personally I don't want my editor magically updating the codebase because there will be edge cases and I don't want magic happening in the background when those edge cases arise. In practice I'm sure the class name change has likely not given you issues in a long time or maybe ever, but that doesn't mean edge cases don't exist and when they happen to someone it can be at the worst times and add significant troubleshooting to an unrelated problem.

edit: further learning those simple tools has a more generic application to other problems while the IDE magic will likely go until there's an issue to be understood and you're depriving yourself of learning generally applicable tooling to trade a slight inconvenience for magic that has the potential to cause great inconvenience and once that magic from the IDE bites you and you learn how it works - you've learned something with no general application to other problems.

edit2: since I can't reply in-line

jcelerier - I _could_ do that with CLI tooling and depending on the language it would be trivial. However, I would _never_ do that because changing the method/function name to suit my context would be very unlikely to avoid making other code less readable. That's a huge anti-pattern that your IDE is making easy. Further, consider the implications for language design when making language design decisions that require a specific type of IDE magic to be considered a reasonable language design decision. I have a hard time believing relying on the IDE lock-in is good for the community of that language.

philwelch - I genuinely don't know the answer, but what happens when you change a class name -> forget you do it before saving the file -> go to another file and try to change the class name there but have a typo -> go back to the original file and save the change? I would bet the typo'd change goes unchanged and now you're left scratching your head since that magic has always worked before.

Re:Generating a Java program with 90% less code by jcelerier on Wednesday December 04, 2019 @12:25PM (#21704352)
> I sometimes wonder if IDE users realize you can do 99.9% of the same things with simple tools

I'd really like you to show me how you can refactor e.g. a method called "write" in a 500+kloc codebase in less than 5 seconds with "simple tools". With any C++ ide from the last decade it's basically a keyboard shortcut + typing the new name + fixing the few remaining compilation errors that may have cropped up in generic code. With sed & al ? good luck, see you in a few weeks.

Re:Generating a Java program with 90% less code by jstimpfle on Wednesday December 04, 2019 @01:24PM (#21705219)
> I'd really like you to show me how you can refactor e.g. a method called "write"

I'm not taking sides on the issue discussed here, but regarding this quote... This is one of the biggest reasons I don't do OOP. Using plain functions with slightly longer but globally unique names so many issues go away.

And the biggest issue is that I can't read a code base if so many function names are not unique and possibly not conveying enough information for local understanding. That style always requires the reader to carry so much context in their head, to be able to resolve the "polymorphism" to concrete implementations. (Yes, in a proper IDE we can jump to the implementation interactively with a few keypresses, but it's still much harder to read).

Re:Generating a Java program with 90% less code by wrmsr on Wednesday December 04, 2019 @01:58PM (#21705659)
Java interface methods do have globally unique* names when fully qualified, but nobody types the full thing out because namespacing is good. It is neither expected nor even desirable for readers or authors to keep resolutions of interface implementations in their heads - that would defeat the purpose of interfaces.

* jar-hell (and dll-hell) aside

Re:Generating a Java program with 90% less code by jstimpfle on Wednesday December 04, 2019 @03:18PM (#21706462)
There is a difference between interfaces and abstract interfaces. It is very helpful to know if all calls to the same function/method resolve to the same implementation. Method syntax always suggests that their could be arbitrarily many implementations.
Re:Generating a Java program with 90% less code by ka0lin on Wednesday December 04, 2019 @04:51PM (#21707549)
> Using plain functions with slightly longer but globally unique names so many issues go away.

That makes me assume two things: you work alone and your projects don't exceed 5.000 (fivethousand) lines of code. Without some namespacing and an expected method length less than 100, more likely 10 lines than 90 or more, you end up with roughly 160 names. An average human knows 150 people, maybe by their name. And while you have friends or at least parents and grandparents occupying some of the »address sace« few of your methods will not be »at hand« for your brain.

And in case you already prefix your methods with something like io_write(...), db_query(...) and you hand in context-specific references like io_write with a sort of file handle and db_query with a sort of database connection I transform all this 1:1 in an OO-style language and back.

Re:Generating a Java program with 90% less code by jstimpfle on Thursday December 05, 2019 @07:42AM (#21711823)
Your assumption is wrong (of course), and yes, I don't doubt that it's always possible to make a rewrite in a shitty way, and then convert it back.

For a clearer description of what I mean, see my other comment below where I write two lines of code in both ways.

Re:Generating a Java program with 90% less code by pjmlp on Wednesday December 04, 2019 @01:46PM (#21705499)
> Using plain functions with slightly longer but globally unique names so many issues go away.

Only on monolith code bases without any signs of modularity.

Re:Generating a Java program with 90% less code by jstimpfle on Wednesday December 04, 2019 @03:07PM (#21706360)
Oh, don't get me wrong, I'm not against abstract interfaces where they make sense. What I'm against is using underqualified names for stuff that has a statically resolveable implementation.

In other words, don't make it look complicated before it actually is.

Re:Generating a Java program with 90% less code by pjmlp on Thursday December 05, 2019 @02:06AM (#21710522)
Even on that case, with good modularity on C code (TU == module), there will be plenty of hidden symbols and some indirection (function pointer) going on, and not a pile of global symbols.

That was kind of the gist of my comment.

Re:Generating a Java program with 90% less code by jstimpfle on Thursday December 05, 2019 @05:31AM (#21711296)
You did't understand what I was saying.

    foo.log(xyz);
    bar.log(42);
vs

    log_event(foo, xyz);
    log_event(bar, 42);
Provided that both approaches do the same, which is more clear? It is the second one, because it clearly suggests that there is no polymorphic switching based on foo/bar.

Wading through non-trivial projects, pervasiveness of the first approach makes me nervous, because I'm told at every occasion, "don't even try to understand what's going on in the system globally. We .log(), shouldn't that be enough for you to know?".

While the second approach is calming to me, "You see, we have this simple logging system, where everything ends up being written to. It's not that complex after all, and if you want to know what's going on you can just jump directly to the log_event()" function.

Yes, by asserting that foo and bar are of the same type, and asserting that the .log() method is not virtual, I can reach the same conclusion. But that's the point, it requires work that you can't practically do if each line of code contains a method call. There is no mincing words, you're using the wrong syntax...

Re:Generating a Java program with 90% less code by pjmlp on Thursday December 05, 2019 @08:33AM (#21712098)
Ok, but you are betting on false hopes then.

First foo or bar can be function pointers.

Or maybe log_event is a macro whose behavior depends on the environment. And I have used some crazylogging ones back in the 2000's when coding C, that would even dump the current state of the process alongside its parameters.

Or then again, log_event() plugs into a configurable logging system and one cannot predict its behavior just from the call site, even when using the same types.

Finally if we move away from C semantics, maybe log_event is overloaded or is doing multiple dispatch, thus the two calls, depending on the argument types, are not going to land on the same implementation.

Re:Generating a Java program with 90% less code by jstimpfle on Thursday December 05, 2019 @09:40AM (#21712568)
> First foo or bar can be function pointers. Or maybe log_event is a macro whose behavior depends on the environment.

Then different uses of the same identifier still resolve to the same implementation, and make the IDE jump to the same location, etc.

(I acknowledge that everything can be something else. And in theory you can redefine macros to have uses of the same identifier resolve to different implementations. Etc, etc. I'm sure you know about the IOCCC. But here we talk about good programming practice. It's a good practice not to suggest something complicated while the reality is simple. There's no argument to win here.)

> Finally if we move away from C semantics, maybe log_event is overloaded or is doing multiple dispatch, thus the two calls, depending on the argument types, are not going to land on the same implementation.

Which is why I do not use C++, or at least avoid most of its features. For me, it's all about clarity and reducing number of moving parts. It's not a contest in making complicated things that pretend to be simple. And it's not a contest in making simple things that look complicated. And it's not a contest in reducing the number of characters in individual identifiers at all costs.

Re:Generating a Java program with 90% less code by jcelerier on Thursday December 05, 2019 @11:40AM (#21713717)
> It is the second one, because it clearly suggests that there is no polymorphic switching based on foo/bar.

so, question : suppose you have your log_event, and now your bosses comes and tells you that the client needs to have two additional different logging mechanisms - say, to journald and to some websocket log server. The system can log to either of your three logging mechanisms at any point through changing a configuration somewhere in a GUI but you also need some core classes to always be logged through journald no matter the state of the rest of the system.

How do you update your design to reflect that ?

Re:Generating a Java program with 90% less code by r-w on Thursday December 05, 2019 @02:24PM (#21715490)
You change it. Better to change a nice solution than to keep adding small chunks to an already complex one. https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it
Re:Generating a Java program with 90% less code by jstimpfle on Thursday December 05, 2019 @03:40PM (#21716229)
Exactly this. This answer needs to be so much more popular. "What if the requirements change" is such a common and such a wrong question.

What is needed in the face of changing requirements is actually this: lean structure with few dependencies that can be adapted.

Re:Generating a Java program with 90% less code by jstimpfle on Thursday December 05, 2019 @03:50PM (#21716336)
I might change log_event() to log to a facility depending on the configuration, and make another function log_core_event() that has the special logging implementation, and change the core modules to call log_core_event() instead. (gee, it's a simple text replace!). This way you can actually see what happens without any indirection.

That wasn't hard.

Re:Generating a Java program with 90% less code by jcelerier on Friday December 06, 2019 @02:22AM (#21719863)
but now you also have to change every log_event(x) to log_event(configuration, x), and pass the log configuration as an argument in literally every function of your code (you would not want to use a global prone to thread initialization issues if you have multiple threads doing logging on startup, right ? :-) )

Also you've made your logging library project-specific by making a log_core_event function. Thanks but I'll keep using spdlog in my projects, which do not need newcomers to learn about your log_core_event, what is a core module and what is not, just to be able to write the three functions they are called for in that project !

Re:Generating a Java program with 90% less code by jstimpfle on Friday December 06, 2019 @03:24AM (#21720070)
That's kinda moving goalposts since the configuration seemed to be a given. In any case, I don't see a problem with global variables. Otherwise, the threading of the configuration (and other context) I assume to have existed before that little change.

That all has nothing to do with virtual methods.

> thread initialization if you have multiple threads doing logging on startup, right ? :-) )

There is no technical difference between "global" and "local" variables. It's merely a syntactical difference.

If you run into concurrency problems with global variables, you'll run into problems just as well with objects. Unless you make multiple objects. In which case, you could also have done thread-local storage, no?

In the end, it's much clearer to me to use global variables (TLS or not) since this way I can actually see the data relations. If there is just one instance of a thing, why would I pass it around as objects? It's not going to help understandability.

> Also you've made your logging library project-specific by making a log_core_event function.

That doesn't make sense. Can't I just add another function without breaking everything? Note that I probably wouldn't even add this function to "the logging library" but to the core modules...

> what is a core module and what is not

If you prefer having everything switched behind your back, resulting in unreadable and unintelligible source code... you do you.

More technical notes...

If you don't like the presence of two or more functions for logging, then why not have an explicit context argument? You call log_event(MODULE_FOO, foo, xyz) instead, and the log_event function implements all the plumbing logic in a central place, easily understood (Most logging approaches do that, I think. They have "facility" and "severity" arguments). This approach seems much more preferable to me compared to an implementation that you can't see locally, and that can't be influenced locally. What would you do if we go for the OOP approach with a virtual method, and now call into a different module that would need a different logger?

If having a dynamically switched implementation was really what we want to do, there is no problem with doing that. My post was just about using method syntax for static things, which I think harms readability.

Re:Generating a Java program with 90% less code by jcelerier on Friday December 06, 2019 @05:07AM (#21720477)
> In any case, I don't see a problem with global variables.

well, that cuts short to the discussion. There are plenty of places & coding standards where those are outright forbidden.

> If you prefer having everything switched behind your back, resulting in unreadable and unintelligible source code... you do you.

we have very different notions of readable. For me the less stuff I have to read and the more readable it is - I just want my code to be the pure domain problem and could not give a rat's ass about how logging or networking or whatever is implemented if those aren't my domain.

> Can't I just add another function without breaking everything?

that does not break the code but that breaks Joe intern's mental model and expectations of anyone who will think that log_* functions are from the same library

> then why not have an explicit context argument?

and here we are, reinventing OOP by hand in C. There is literally no difference between log_event(context, ...) and context.log_event(...) - but you get better tooling :

* completion -for the first I'd most certainly end up typing the full name if there are a lot of l-started functions while for the second I'd type c<shortcut>.l<shortcut><enter> and only see the few relevant functions in the autocompletion list) etc... in the second.

* namespacing - if I want to see all the logging functions available I can just click on "context" and my IDE will happily show me all the available methods in a panel and nothing else. With C functions, well, I have to scroll in a list of 150000 functions. And also wonder (& have to explain) why log_event() is in <util/logger.h> and log_event_core is in <core/core_logger.h>.

* split implementations - if at some point you want to port your software to, say, an arduino without network capabilities (talking literally forom past experience here), the monolithic log_event function now becomes an #ifdef HAS_NETWORK / #ifdef HAS_JOURNALD / ... mumbo-jumbo. While with multiple logger subtypes it's just a matter of changing your build system to not compile the unavailable implementations, without even needing to change the code (or change a list of types in a header if you use static polymorphism instead).

> What would you do if we go for the OOP approach with a virtual method, and now call into a different module that would need a different logger?

dependency injection ? modules can request either for a default logger which will be sourced from the gui configuration, or whatever specific logger they actually need due to functional requirements.

Besides, I still don't see the readability problem with virtuals. Again in my IDE if I want to see "what happens" I press F2 on context.log_event and it displays me the list of all the possible implementations if it isn't able to determine that one is used statically at that point. And I much prefer to read three five-lines email_logger::log, journald_logger::log, websocket_logger::log functions than a pile of if/else's.

Re:Generating a Java program with 90% less code by jstimpfle on Monday December 09, 2019 @06:04AM (#21741704)
> HAS_NETWORK / #ifdef HAS_JOURNALD / ... mumbo-jumbo. While

But when I had a glance at the project you linked on github, that was basically the first thing I found there...

A suggestion that I have there would be to use the linker instead (make different source files based on implemntation / existance of an implementation). This way you can eliminate most of the #ifdefs.

Regarding dependency injection, I don't see a practical difference to just using global variables / global functions, apart from the fact that by convention DI gives you back objects with virtual implementations, which I don't like.

I won't go into the rest of the things you said because we pretty much discussed it all.

Re:Generating a Java program with 90% less code by r-w on Thursday December 05, 2019 @02:21PM (#21715463)
It seems like your problem isn’t with OOP, but with generics. (You would like Go.)
Re:Generating a Java program with 90% less code by tsss on Wednesday December 04, 2019 @12:53PM (#21704759)
Obviously you don't have much experience with IDEs and statically typed languages, which is a shame because they make our life so much easier. There are no edge cases. And even if there were the IDE can show you the refactoring and you can decide on a case-by-case basis.

> what happens when you change a class name -> forget you do it before saving the file -> go to another file and try to change the class name there but have a typo -> go back to the original file and save the change?

A good IDE does not care if you save the file or not. It is always up-to-date. Renaming a class in just one file is also impossible, since the IDE will do refactorings atomically over the whole project. But lets just assume you somehow managed to fuck it up that badly (things can always go wrong): You will still realize your error almost instantly because a statically typed language does not defer such checks to runtime. The program wouldn't even run anymore.

By far the biggest issue with automatic refactoring is accidentally renaming stuff in comments (or forgetting to do so) because I'm too lazy to look at every single place. But find&replace has the same problems.

Re:Generating a Java program with 90% less code by philwelch on Wednesday December 04, 2019 @12:21PM (#21704274)
With a statically typed language and an IDE this isn’t a real issue. There’s no “edge case” when you rename a class or method symbol in a Java project because the IDE deterministically knows what are the invocations of the same symbol.
Re:Generating a Java program with 90% less code by TeMPOraL on Wednesday December 04, 2019 @01:33PM (#21705321)
Except when you use reflection. Or code generation tooling that tends to crop up around DI frameworks.

Yes, in general, the ability of IDE to make these kind of large-scale changes quickly, reliably and mostly bug-free is nice. But I rarely miss it in languages where it's impossible.

It may be that one of the ways your language shapes your code is the way you structure it. For instance, in my Lisp codebases, I can hardly think of any place where Java-style automated refactoring could be useful; in the current largish codebase I work on, it rarely is the case that constructs introduced in one file are used directly in more than one or two other files - which makes refactoring entirely doable with a dumb text editor, and Java-like automated refactoring wouldn't save all that much time over doing a regex search and manually visiting every line listed in results.

Re:Generating a Java program with 90% less code by r-w on Thursday December 05, 2019 @02:25PM (#21715510)
What types of program are you writing?
Re:Generating a Java program with 90% less code by philwelch on Friday December 06, 2019 @02:08PM (#21724964)
I would expect that Lisp programming wouldn't derive much benefit from an IDE.
Re:Generating a Java program with 90% less code by addicted44 on Wednesday December 04, 2019 @01:21PM (#21705176)
Unless you're using something like .Net remoting (or the Java equivalent), and now suddenly everything breaks.

Or you have a larger codebase split up into multiple .Net solutions and DLLs where code is referenced through the generated DLLs.

The refactor looks great, until it starts breaking things for the many consumers of your code.

In fact, the latter is a situation where simple text tools will make life a lot safer and easier than whatever the IDE does (which pretty much will be limited to the bounds of the .sln file, whereas a simple text tool operating over files in the entire codebase will alert you to the fact that this is being used elsewhere).

My argument isn't to claim that simple text tools are better at refactoring. They aren't. However, I've run across several situations where we've had issues in a massive codebase because developers believed that refactoring was as easy as hitting the Refactor button in Visual Studio, and everything will work magically.

The belief in programming 'magic' (whether through IDEs or frameworks that abstract a ton) without understanding what those tools actually do is what I'm worried about. Use IDEs to do what you need to by all means, but it's much better when you actually understand what it's doing before doing something with it.

Re:Generating a Java program with 90% less code by philwelch on Wednesday December 04, 2019 @02:54PM (#21706227)
> Or you have a larger codebase split up into multiple .Net solutions and DLLs where code is referenced through the generated DLLs.

Sure--and to be fair, I've never worked in .Net much. But if you're changing the package interface, you should arguably do so in a backwards-compatible fashion anyway, depending on how your stuff actually gets built and deployed. If everything's contained in the same repo and you can't refactor across multiple components in the same repo, that sounds like a problem.

> The belief in programming 'magic' (whether through IDEs or frameworks that abstract a ton) without understanding what those tools actually do is what I'm worried about. Use IDEs to do what you need to by all means, but it's much better when you actually understand what it's doing before doing something with it.

Agreed!

Re:Generating a Java program with 90% less code by arbie on Wednesday December 04, 2019 @12:30PM (#21704425)
What if the IDE did not traverse a specific file during the global search and replace?

Are you relying on a correct and comprehensive project/workspace setup within the IDE?

Re:Generating a Java program with 90% less code by this_user on Wednesday December 04, 2019 @12:52PM (#21704747)
So your argument is that something might, in some extremely rare cases, go wrong, and that is why you'd rather do it the manual way? That's basically like a carpenter refusing to use power tools, because they might, theoretically, explode.
Re:Generating a Java program with 90% less code by Sharlin on Wednesday December 04, 2019 @12:38PM (#21704543)
> Are you relying on a correct and comprehensive project/workspace setup within the IDE?

Of course. Not much point in using an IDE otherwise.

Re:Generating a Java program with 90% less code by philwelch on Wednesday December 04, 2019 @02:55PM (#21706238)
> Are you relying on a correct and comprehensive project/workspace setup within the IDE?

That's not something I "rely" on, it's the first thing I make happen whenever I use an IDE.

Re:Generating a Java program with 90% less code by chosenbreed37 on Wednesday December 04, 2019 @01:21PM (#21705167)
> What if the IDE did not traverse a specific file during the global search and replace?

You generally get compilation/build errors highlighting the bits that were missed (for whatever reason)

Re:Generating a Java program with 90% less code by pavel_lishin on Wednesday December 04, 2019 @12:49PM (#21704702)
Then your tests catch it, and you have to fix a single file manually, instead of a dozen or a hundred or a thousand.
Re:Generating a Java program with 90% less code by ken on Thursday December 05, 2019 @10:03AM (#21712810)
Sure, and that’s exactly the same failure mode as “sed”. What’s the benefit of the big IDE?
Re:Generating a Java program with 90% less code by pavel_lishin on Thursday December 05, 2019 @10:12AM (#21712903)
> What’s the benefit of the big IDE?

To quote myself, "fix a single file manually, instead of a dozen or a hundred or a thousand".

And what happens when you need to rename, say, a method name that's also used as a variable name in many places? xWhat happens if multiple classes define the same method name, but you only want to rename that method for a single class?

Yes, you can probably do it in sed. If you're used to it enough, you can probably do it pretty quick, with sufficient regexps that you only have to debug a few times.

Or you can right click or hit CMD-. or hit F2 or whatever with your cursor on a method name, type in the new name, wait 2 seconds, and you're done.

Re:Generating a Java program with 90% less code by gmueckl on Wednesday December 04, 2019 @12:41PM (#21704590)
Given the truly excellent quality of refactoring toolsets like Resharper for C# I'd wager that you're more likely to miss an edge case with your manual approach than with the tools. The tools can reliably differentiate between methods of the same name in different classes at the call sites (or between different classes with the same name in different namespaces). They will search comments and strings for occurrences of the name in question and prompt you with a nicely formatted overview dialog box which ones to adjust.

The tools are at a point where I'm usually breaking my code when I'm doing manual refactoring, but never when I let the tools do the job.

Re:Generating a Java program with 90% less code by nec4b on Thursday December 05, 2019 @02:34AM (#21710605)
IDEs are not magical. They understand your code because they use compilers to parse it, therefore they can also reason about it at a higher level than a simple text editor or CLI tool which treat your code as nothing but characters.
Re:Generating a Java program with 90% less code by z3t4 on Wednesday December 04, 2019 @03:10PM (#21706393)
Refactoring by renaming things is like renovating a house by painting it in another color. I like to refactor using a wrecking ball.
Re:Generating a Java program with 90% less code by STRiDEX on Wednesday December 04, 2019 @12:09PM (#21704087)
renaming a class in vscode works in js and ts via typescript language service.
Re:Generating a Java program with 90% less code by _zamorano_ on Wednesday December 04, 2019 @12:13PM (#21704151)
Honest question: By "works" you mean you have 100% guarantee nothing will break nowhere?
Re:Generating a Java program with 90% less code by treve on Wednesday December 04, 2019 @12:30PM (#21704412)
Edge cases exist. I'd assume that Java and c# will also have edge-cases when things like reflection come into play.
Re:Generating a Java program with 90% less code by Filligree on Wednesday December 04, 2019 @12:45PM (#21704649)
Certainly, but reflection is almost never used. I don't think I've touched a single real-life codebase where it would get in the way in this manner.

The same can't be said for languages like JS.

Re:Generating a Java program with 90% less code by smhinsey on Wednesday December 04, 2019 @01:32PM (#21705315)
Even reflection is going to vary based on your IDE. If you use ReSharper or Rider, a safe rename refactoring will locate and optionally update string references as well. I don't know if VS itself has adopted this feature.
Re:Generating a Java program with 90% less code by Filligree on Friday December 06, 2019 @11:23AM (#21723206)
IDEA does the same thing. It's amazingly useful, even if you don't use reflection -- variable names end up in comments and documentation as well, all of which it will offer to change.
Re:Generating a Java program with 90% less code by ken on Thursday December 05, 2019 @10:00AM (#21712784)
I’ve never touched a “real life” code base in a static language (including C#) where this wouldn’t be an issue. C# is not a sufficiently high level language that I can avoid duplication without the use of reflection.
Re:Generating a Java program with 90% less code by dehrmann on Friday December 06, 2019 @12:18AM (#21719453)
People try to avoid reflection like the plague, most use cases don't depend on a hard-coded method/class name, and the ones that do can sometimes be detected by tools. It's pretty rare to run into this, and the one of two times I did something horrible like this, I wrote a test for it and made if fail loudly because what I was doing was brittle (by Java standards) and unexpected.
Re:Generating a Java program with 90% less code by maremp on Thursday December 05, 2019 @01:32PM (#21714852)
> I sometimes wonder if JS programmers know that with C#/VS you can just change the name of a class

How exactly does this knowledge help? I know this is possible and I do miss it. But it's extremely diffcult to support it in JS because of how the languages works. VSCode tries, but it's still limited. So should we all switch to writing C#? You can't avoid writing JS if you want to create a web app. There are tools to avoid it, but one has to know what's under the hood or they'll have a bad time.

TypeScript is doing great progress on this part, and it supports easy refactors, but it's still lacking in some parts, for example the type inference is still poor when it comes to complex cases and the type declarations depend on will of maintainers.

Re:Generating a Java program with 90% less code by ulshv on Wednesday December 04, 2019 @02:11PM (#21705818)
It is possible for JS/TypeScript as well in VS Code. Works really well.
Re:Generating a Java program with 90% less code by Gaelan on Wednesday December 04, 2019 @01:25PM (#21705235)
I think you can do all those things with typescript and any decent IDE.
Re:Generating a Java program with 90% less code by edflsafoiewq on Wednesday December 04, 2019 @02:09PM (#21705792)
Is this really true? The hard part of renaming a class isn't usually changing the name Foo -> Bar, it's finding all the variables with type Foo named stuff like result_foo and renaming them result_bar. Can it help with that?
Re:Generating a Java program with 90% less code by dnautics on Wednesday December 04, 2019 @02:16PM (#21705863)
Static typing can help with a lot of things but it can't fix this error:

    pub fn add(a: i64, b: i64) i64 {
      return a - b;
    }
Re:Generating a Java program with 90% less code by maxdamantus on Wednesday December 04, 2019 @02:51PM (#21706199)
Actually, it kind of can:

https://tryidris.herokuapp.com/compile#YWRkIDogSW50IC0+IElud...

The above link refers to the following Idris code:

  add : Int -> Int -> Int
  add a b = a - b

  addTest : add 4 5 = 9
  addTest = Refl
Re:Generating a Java program with 90% less code by reitzensteinm on Wednesday December 04, 2019 @03:02PM (#21706320)
That unit test would be just as easily implemented with dynamic typing.
Re:Generating a Java program with 90% less code by exitheone on Wednesday December 04, 2019 @03:04PM (#21706330)
yes, intellij for java will also rename all local variables and all mentions of the class in comments.
Re:Generating a Java program with 90% less code by edflsafoiewq on Wednesday December 04, 2019 @05:05PM (#21707712)
How exactly does that work? How does it decide what variables to rename and what to rename them to?
Re:Generating a Java program with 90% less code by erik_seaberg on Wednesday December 04, 2019 @01:37PM (#21705381)
Boilerplate is the enemy. IDEs can easily write piles of it, but offer very little help reading any of it, and editing it is a trap. Anything that can be generated behind the scenes, compiled, and thrown away should be.
Re:Generating a Java program with 90% less code by TeMPOraL on Wednesday December 04, 2019 @01:42PM (#21705452)
Indeed, IDEs are still oriented towards writing code, not reading it. I'm yet to find a good tool that would help with exploring and familiarizing yourself with a large codebase. Soucetrail comes the closest, but it has like 5% of the features I'd like to see in it.

(My dream code exploring tool would be a cross between an IDE and a tablet&pen friendly PDF reader. I should be able to navigate through files using all the semantics-aware IDE goodies, the tool should also understand version control, but it should also be able to generate and manipulate structural graphs (as in, boxes and arrows), as well as let me highlight, draw and freehand over the code.)

Re:Generating a Java program with 90% less code by LameRubberDucky on Thursday December 05, 2019 @03:09PM (#21715962)
UML?
Re:Generating a Java program with 90% less code by lallysingh on Wednesday December 04, 2019 @02:10PM (#21705807)
I disagree. The cognitive overhead of sifting through so much boilerplate hides a lot of bad code. The identifiers and logic seem reasonable in an island surrounded by getters, setters, builders, injection annotations, overloads, and trivial constructors. But in context of the actual code invoking it, also surrounded in an ocean of boilerplate, the code does the wrong thing.

The overhead has significant cost for trivial gains. The costs result in overly complicated systems to solve simple problems. Most of the complexity in these systems is for dealing with complexity brought in by the ecosystem, not the problem domain.

Re:Generating a Java program with 90% less code by tlarkworthy on Wednesday December 04, 2019 @01:55PM (#21705626)
Sadly in practice, runtime dependency injection swaps compile errors for runtime errors. I hate DI!
Re:Generating a Java program with 90% less code by eecc on Wednesday December 04, 2019 @12:46PM (#21704669)
Magik? Has anyone mentioned Spring yet?
Re:Generating a Java program with 90% less code by jdmichal on Wednesday December 04, 2019 @03:44PM (#21706704)
Spring magic is both relatively straight-forward to understand, and actually relies on heavy typing for autowiring.
Re:Generating a Java program with 90% less code by eecc on Wednesday December 04, 2019 @04:12PM (#21707052)
Uh right, sure. But then there's the Spring lifecycle to take into consideration and it may happen that your annotations may or may not work. It depends (of course it's not totally aleatory, there's some logic behind it, usually obvious after several hours debugging ;)

Another honorable mention is Spring Boot @Conditional for which adding a minor little diversion from defaults will turn a functioning happy project in a dysfunctional nightmare.

:'(

Re:Generating a Java program with 90% less code by jdmichal on Wednesday December 04, 2019 @06:02PM (#21708136)
I agree with you completely on that. I'll clarify that, to me, there's a difference between straight-forward and obvious. And Spring is terrible at being obvious. Some annotation on a class 5 transitive dependencies deep can affect your code. It's definitely really deep into "spooky action at a distance", and that's always a nightmare for debugging. But once you see all the pieces, it's (usually) relatively straight-forward to describe what is happening.
Re:Generating a Java program with 90% less code by ubu7737 on Thursday December 05, 2019 @12:05AM (#21710123)
Spring is semi-magical but when you learn the whole thing it gives you godlike abilities.
Re:Generating a Java program with 90% less code by eecc on Thursday December 05, 2019 @04:44PM (#21716925)
Really? Try Clojure then
Re:Generating a Java program with 90% less code by gldalmaso on Wednesday December 04, 2019 @01:14PM (#21705080)
The worst experience I had refactoring JS was the need to change functions that were used elsewhere from plain to async. I really hoped to have had a strong IDE that could assure me the affected code was as intended and did not have the flow completely break because a promise was returned where none was expected before. I distinctively thought "I wish this was Java". Some of the affected code was already in Typescript and that did help a bit, but I was still not too confident because I still didn't trust the IDE completely (Typescript support was comparatively new).

I have even come to question if we should make all our javascript apis async from the start to avoid this scenario though it seems a rather extreme guideline. We didn't really do that, but I still dread this type of refactoring.

Re:Generating a Java program with 90% less code by jacobush on Wednesday December 04, 2019 @01:25PM (#21705228)
Same for Python codebases. Which I wrote myself. Last year. And now hate.
Re:Generating a Java program with 90% less code by TeMPOraL on Wednesday December 04, 2019 @01:20PM (#21705162)
I have a bit of opposing viewpoint. One of my biggest hurdles ever in understanding large codebases comes from the sheer amount of code involved per any architectural unit. IDE may let me move around a codebase quicker, but if a single functionality is smeared into 20 classes in three separate inheritance hierarchies, this will still cause me headaches until I draw the entire structure on a large sheet of paper and keep it on my desk. There is only so much thing I can keep in my head or in front of my eyes at the same time, so the denser the language (in terms of ability to abstract and DRY things), the easier I find a large codebase to work with.
Re:Generating a Java program with 90% less code by BOBOTWINSTON on Wednesday December 04, 2019 @12:21PM (#21704270)
I find it really amazing when a language's weakness drives an unintended strength to evolve like this.

Ruby Example:

Ruby projects tend to always have really well maintained test suites. The language makes it easy for you to introduce non-obvious bugs or write unreadable (yet efficient) meta code.

This has lead to 1) very mature testing frameworks (meh) and 2) high adoption and usage of these frameworks (actually impressive).

Funny enough, I think adoption of IDEs is extremely low in the Ruby world. 90% of the developers I interact with in my city are on Sublime/VSC/Vim. I've seen some pretty impressive usage of Rubymine that has made me curious, but never bothered to really spend time with it myself. I'd be really curious what the teams at GitHub/Stripe/[Insert big Ruby company] typically use editor-wise.

Re:Generating a Java program with 90% less code by codeduck on Wednesday December 04, 2019 @12:26PM (#21704353)
I do most of my ruby work in rubymine. I use it not so much for the IDE tools like refactoring etc, but because I can use it to condense multiple bash sessions into a single UI. I also use pycharm and IDEA, and certainly in IDEA's case I use it primarily because it's the best-in-class Java IDE.
Re:Generating a Java program with 90% less code by albemuth on Wednesday December 04, 2019 @01:25PM (#21705232)
> condense multiple bash sessions into a single UI

How does it compare to tmux/screen?

Re:Generating a Java program with 90% less code by codeduck on Wednesday December 04, 2019 @05:11PM (#21707760)
Haven't used tmux much, and last time I used screen was over 10 years go. Rubymine gives me my iterative test results, multiple independent launch commands, the ability to run a single rspec test, refactoring support, autocompletion, a coherent gem environment, debugging etc all in one place. Yes, I could do all this on the cli, but I'm lazy, and Rubymine means I don't need to.
Re:Generating a Java program with 90% less code by chongli on Wednesday December 04, 2019 @12:07PM (#21704055)
For large code bases, most languages get unmaintainable without an IDE, putting Java at an advantage

That’s an assumption which advantages Java by default. Other languages may be able avoid having a large code base entirely. I recall reading some stories of people rewriting giant Java code bases into very small Clojure programs that were more flexible, maintainable, and scalable.

Re:Generating a Java program with 90% less code by ehnto on Wednesday December 04, 2019 @12:15PM (#21704181)
An eCommerce framework is never going to have a small footprint, for one example. That's why Java or other strongly typed/structured languages get used in enterprise software.
Re:Generating a Java program with 90% less code by TeMPOraL on Wednesday December 04, 2019 @01:04PM (#21704914)
Java is used in enterprise software primarily because it's what gets used in enterprise software. Language popularity is a positive feedback loop, and once a language establishes itself in a sector to the point universities start to teach it with that sector in mind, it's hard to unseat it. Businesses, especially large ones, don't choose tech based on technical merits; they tend to focus on aspects like "can we get support with SLA for parts of our tech stack", and "how easy to find/cheap the developers specialized in that stack are", and "let's do what the IBM/Oracle salesman says we should, that must be the right thing to do".

I don't see a reason an eCommerce framework couldn't have a small footprint. The lower bound is the amount of actual, necessary complexity in the problem space. But that's usually orders of magnitude less than the size of the codebase, because of all the boilerplate and greenspunning that happens in Java, Enterprise Java in particular.

(Note that in commercial work, I moved from Java to Common Lisp, so I have a different view than typical about just how much boilerplate and repetition can be simplified and removed when your language lets you do it.)

Re:Generating a Java program with 90% less code by qes on Wednesday December 04, 2019 @02:44PM (#21706128)
You're not going to cut your lines of code by an order of magnitude by switching from Java or C# to JavaScript or Python, but I would say you do get an order of magnitude increase in ease of managing large code bases with the popular statically typed languages.

I'd rather have 1M lines of Java than 100k lines of JavaScript, and if essential complexity took 1M lines of Java to flesh out, you aren't reaching parity with 100k lines of JS.

Re:Generating a Java program with 90% less code by TeMPOraL on Wednesday December 04, 2019 @03:04PM (#21706331)
> You're not going to cut your lines of code by an order of magnitude by switching from Java or C# to JavaScript or Python

Why not? I can easily see reducing SLOC 10-50x by switching from Java to JavaScript.

> if essential complexity took 1M lines of Java to flesh out

I very much doubt that in a 1M SLOC Java codebase - at least in pre-Java 8 codebase - the essential complexity is any more than 1% of that. My work experience with Java suggests that the language and the surrounding ecosystem and practices promote extreme proliferation of accidental complexity.

Re:Generating a Java program with 90% less code by ehnto on Thursday December 05, 2019 @01:13AM (#21710336)
I am sure you could reduce complexity quite quickly but then you are building a different product. The selling point of an eCommerce framework is the structure and existing feature toolkit. Like modules, events, mechanisms to safely override core functionality and all of that. I am also sure you could build a more compact eComm framework, but I think you would start to trade off structure for reduced complexity. For me though, more structure equals less need to worry about the complexity as that's been abstracted away.

I wouldn't mind seeing the other side of the fence though, I will admit I have worked in enterprise codebases for most of my career so I am definitely biased.

Re:Generating a Java program with 90% less code by coliveira on Wednesday December 04, 2019 @12:14PM (#21704171)
Yes, the secret is to write software that is composed of several modules that operate independently. Java's culture is to write a big ball of classes that are combined to everything you need. In other languages you can create different programs that compose to provide the desired functionality. This was the original "aha" moment of C and UNIX designers. Even though C is a brittle language, it allows the decomposition of systems into small programs thanks to files and filters.
Re:Generating a Java program with 90% less code by ehnto on Wednesday December 04, 2019 @12:19PM (#21704239)
There's nothing stopping you from writing uncoupled classes that work like small modules and maintaining them in one repository. Tightly coupled classes are a code smell even in Java, I wouldn't say it's the languages fault, more that the language is used more often in enterprise software and so all the frameworks/libraries/tooling is geared toward monoliths.
Re:Generating a Java program with 90% less code by harikb on Wednesday December 04, 2019 @01:27PM (#21705256)
From a sample size of one - My Python and Go code tend to be fewer lines per file compared to Java, for projects that are similar in complexity. This is not about the terseness/dense nature of the language, but the sheer simplicity in other languages to decouple file structure from class structure (at least within a given directory)
Re:Generating a Java program with 90% less code by ehnto on Thursday December 05, 2019 @01:00AM (#21710303)
What about Java do you think adds lines in regards to file structure?

I must also admit I woild rather ten lines of code and be clear and certain, so being verbose doesn't bother me much.

Re:Generating a Java program with 90% less code by r-w on Thursday December 05, 2019 @02:37PM (#21715656)
With respect to verbosity: Certain, yes. Clear, no. Boilerplate is a thing.
Re:Generating a Java program with 90% less code by Andrex on Wednesday December 04, 2019 @01:23PM (#21705202)
> Yes, the secret is to write software that is composed of several modules that operate independently.

This isn't a secret, and in certain corners not even considered generally true -- backlash against microkernels and microservice architectures have intensified in the last half-decade, to give two examples.

Re:Generating a Java program with 90% less code by z3t4 on Wednesday December 04, 2019 @02:26PM (#21705956)
90% of code bases that attempt modulability get it wrong. The idea is to be able to lift out functionality to be reused elsewhere. But what 90% of code bases do wrong is that they move code into modules, but you can not lift out those modes as they depend on all other modules. It might help if you use the words library instead of module. And public API instead of micro service.
Re:Generating a Java program with 90% less code by pjmlp on Wednesday December 04, 2019 @01:51PM (#21705574)
The famous UNIX mantra hardly seen in commercial UNIX settings, but cargo cult across the FOSS UNIX community.
Re:Generating a Java program with 90% less code by simion314 on Wednesday December 04, 2019 @01:14PM (#21705081)
> Other languages may be able avoid having a large code base entirely. I recall reading some stories of people rewriting giant Java code bases into very small Clojure programs that were more flexible, maintainable, and scalable.

I can rewrite any bad written code in less lines, same language same framework as initial code.

Re:Generating a Java program with 90% less code by toolz on Wednesday December 04, 2019 @12:50PM (#21704710)
disclaimer: elixir fanboi here just trying my best to temper my bias for this comment.

I recently rewrote a c# project that had not been completed in elixir. Hugely, anecdotal (as all of these types of stories are) but the project went from ~5kLoC to <800LoC when rewritten in elixir. That's after the elixir app was feature complete too. Now you might believe that's a developer experience gap, but the c# dev had way more experience with c# and in my experience this other dev is much better than me generally. Within a week of learning elixir he was catching my bugs all over the place.

Re:Generating a Java program with 90% less code by loxs on Wednesday December 04, 2019 @01:16PM (#21705104)
Neither 800LoC nor ~5kLoc qualifies as a large codebase. In my experience sh*t starts to get real when you go beyond 30-50kLoC, at least that's when I start losing the needle in the haystack. I've done that with Erlang and it's not really fun.

In comparison, my current project in TypeScript is at this stage now and by using an IDE things are quite under control. Refactoring is easy and even major architectural changes are manageable (we did ~5 so far, depending on how you count).

Wasn't the case with Erlang. We only managed to do one such major change and it almost killed the project. It probably even actually killed the project as we were late to the party and failed afterwards.

Re:Generating a Java program with 90% less code by BubRoss on Wednesday December 04, 2019 @02:26PM (#21705959)
Why was dealing with a large project in erlang so difficult?
Re:Generating a Java program with 90% less code by nobleach on Wednesday December 04, 2019 @06:58PM (#21708488)
No type system means an Erlang developer has to keep a lot of things straight in their head. It's not unique to Erlang.
Re:Generating a Java program with 90% less code by TheFiend7 on Wednesday December 04, 2019 @11:53AM (#21703868)
I disagree with the idea that you can't maintain a robust system/codebase in python, mainly because nearly our entire distributed computing stack is written in python.

Granted it isn't 10s of thousands of lines, but it isn't small either. It does a lot of things ranging from webapis to data pipelining with ingestion and egestion of large datasets. One batch job can result in 10s of GBs in output files. It has to be performant too, 10s of millions of "operations" in one batch job is common.

Admittedly the process/threading model can be painful to work around at times, but totally doable, and is honestly somewhat friendly to distributed systems to an extent because it somewhat forces you into an actor model paradigm.

Re:Generating a Java program with 90% less code by iamaelephant on Wednesday December 04, 2019 @11:59AM (#21703951)
> Granted it isn't 10s of thousands of lines, but it isn't small either.

I'm not trying to belittle what you do, but if your good base is in the 4 figures in size then it's not large (in fact yes, it is small). When people talk about large code bases they are generally talking 100-1000x larger than yours, or more.

Re:Generating a Java program with 90% less code by jimbokun on Wednesday December 04, 2019 @12:03PM (#21703999)
True, but maybe that's partly because it's an order of magnitude smaller than the same program written in Java?
Re:Generating a Java program with 90% less code by eropple on Wednesday December 04, 2019 @12:13PM (#21704143)
You're missing one or two zeroes from the post to which you are replying.
Re:Generating a Java program with 90% less code by TheFiend7 on Wednesday December 04, 2019 @12:16PM (#21704194)
It sits on top of our own IP database which is 6 figures in lines and is written in C++. Java has fancy bells and whistles when it comes to IDE's, but that's all they are.

I just think it's foolish to think Java is the only language that can handle large codebases. I mean just look at the linux kernel.

EDIT: Removed comment about processing capabilities because it's irrelevant to the discussion. I left my original comments about lines and the IDE though.

Re:Generating a Java program with 90% less code by mlazos on Wednesday December 04, 2019 @01:00PM (#21704860)
I don’t think anyone is saying Java is the only one they’re saying because it has good IDE support it is better than many other languages, e.g. python. I tend to agree. Once a python program gets over 20k lines (I touched a program like that before) it’s an absolute nightmare to maintain and without type annotations can be near impossible to figure out what is going on.
Re:Generating a Java program with 90% less code by nikanj on Wednesday December 04, 2019 @12:22PM (#21704301)
The size of data processed, or the number of nodes running, has almost no effect on the quality of the IDEs.
Re:Generating a Java program with 90% less code by LandR on Wednesday December 04, 2019 @03:16PM (#21706450)
This is true. At my last job our primary codebase was around 5 million Loc split over 400+ assemblies.

Current job I've seen single files that are over 30k lines.

Re:Generating a Java program with 90% less code by mlazos on Wednesday December 04, 2019 @01:05PM (#21704925)
This is a little off topic but is the performance mainly coming from the computation being distributed? I wrote this text parser in python a few years ago, rewrote the same thing in Java and got like a 10x speedup. It’s possible I’m a bad python programmer.
Re:Generating a Java program with 90% less code by iudqnolq on Wednesday December 04, 2019 @11:11PM (#21709915)
Also there's a general effect that any rewrite can improve the code quality. Same thing might have happened if you rewrote in Python.
Re:Generating a Java program with 90% less code by dcolkitt on Wednesday December 04, 2019 @12:03PM (#21703990)
> For large code bases, most languages get unmaintainable without an IDE

I disagree. Most people working on the Linux kernel (including Linus) or the major GNU projects (including RMS) are using vim or emacs with maybe some supplemental find/grep/sed/awk.

Re:Generating a Java program with 90% less code by Datenstrom on Wednesday December 04, 2019 @12:26PM (#21704362)
This is my development stack, vim is my text editor with some minor modern features using plugins and tmux lets me tile into any other command line tool that is best for the job. I prefer my tools to be Turing complete, and there is nothing an "IDE" can do that I cannot (most likely far faster too).
Re:Generating a Java program with 90% less code by nobleach on Wednesday December 04, 2019 @07:02PM (#21708514)
I tried writing Kotlin in Vim, I really did. Java was somewhat manageable, but Kotlin was absolutely impossible. The biggest thing those bloated Java-based IDEs offer is deep introspection into the language. You use a reference, the IDE can auto-import the package for you. When learning a new language, knowing what package to import is invaluable. Even the Kotlin in Action book from Manning Publications flat out says, "the IDE will automatically import that for you". It was quite a turn-off but.... it's a nice language, so when I write it, I have to use IntelliJ.
Re:Generating a Java program with 90% less code by wayoutthere on Wednesday December 04, 2019 @11:49AM (#21703827)
I think part of what's happening right now is that the IDE for most languages other than Java seem to be consolidating on VS Code as the lowest common denominator. This makes sense given how many projects these days are a hodgepodge of 3 or 4 different languages, but the fact that working with the JVM more or less requires a dedicated IDE makes Java a lot less attractive to most teams.

(Yes, I know you can do Java in VS Code but I wouldn't want to manage a large Java codebase with it.)

Re:Generating a Java program with 90% less code by JackFr on Wednesday December 04, 2019 @12:08PM (#21704074)
> I wouldn't want to manage a large Java codebase with it.

Why not?

Re:Generating a Java program with 90% less code by itronitron on Wednesday December 04, 2019 @01:21PM (#21705179)
probably because the code insight offered in VS Code is lagging behind what was available years ago in popular Java IDEs such as Eclipse and IntelliJ
Re:Generating a Java program with 90% less code by rmangi on Wednesday December 04, 2019 @12:12PM (#21704118)
while I agree VS Code is starting to get a lot of traction, it's far from the only solution for polyglot development (IntelliJ...) and it certainly has the facilities to support large java codebases.
Re:Generating a Java program with 90% less code by pm90 on Wednesday December 04, 2019 @11:55AM (#21703903)
Strictness of what, exactly? Of all Java code being belched by IDEs?

“Code should be written for humans to read and only incidentally for machines to run” (paraphrasing a famous quote by Harold abelson)

Re:Generating a Java program with 90% less code by watwut on Wednesday December 04, 2019 @12:08PM (#21704072)
Strictness of syntax and language. It means that ctrl+space gives you exactly right methods into popup, that if you rename the class all places that use that class and no other will be changed, you can rename method and trust that all correct calls will be renamed too and no other.

You can find all the places that call a method and know they are really all. That sort of basic thing.

E.g. not for writing, but for analyzing what unknown code does and for refactoring that code. Comparing to javascript, in js you have to be much more careful when refactoring and changing things.

Re:Generating a Java program with 90% less code by pm90 on Wednesday December 04, 2019 @12:45PM (#21704646)
I think this is possible with any statically typed language, all of which today have IDE's that can do exactly this.
Re:Generating a Java program with 90% less code by the8472 on Wednesday December 04, 2019 @01:23PM (#21705206)
Most static languages. In my experience the typscript masquerade breaks down too often and you can't rely on IDE omniscience.
Re:Generating a Java program with 90% less code by landryraccoon on Wednesday December 04, 2019 @12:41PM (#21704580)
> “Code should be written for humans to read and only incidentally for machines to run”

So this is a cute statement but isn't it actually false? None of us would be sitting around code reviewing each other's code for fun if there wasn't a mountain of money / value / knowledge to be extracted from a computer running the code at the end of the day.

Actually this is easily falsifiable. As soon as quantum computing becomes possible the first languages will probably be quite horrible, with painful tooling and torturous debugging and difficult to read control flow compared to current modern languages. Nonetheless, a huge army of programmers will be trying to write code for these quantum computers, for the sake of the computer, and not for any human to read.

Re:Generating a Java program with 90% less code by pm90 on Wednesday December 04, 2019 @12:56PM (#21704801)
Another "Actually this is false in the corner case I'm going to call out".

Of course its not a universal rule, its not a law of physics. Doesn't make it less useful as a guiding principle (similarly, design patterns in software architecture).

The core argument is that we're besides the point in conventional (2019) computing where we need to worry too much about optimizing code to run as efficiently as possible. The complexity and bottlenecks to delivering features is now in writing software that is meant to be worked on and maintained by a large number of humans. And for that purpose, it is better to optimize for clarity.

Re:Generating a Java program with 90% less code by landryraccoon on Wednesday December 04, 2019 @01:07PM (#21704965)
But it's not really a corner case though. For a lot of professional applications it's perfectly fine to make a tradeoff of complexity or readability in order to get performance. And that tradeoff is done for business reasons - because sometimes the computer is more important than the programmer.
Re:Generating a Java program with 90% less code by coding123 on Wednesday December 04, 2019 @12:18PM (#21704225)
incidentally:

1. used when a person has something more to say, or is about to add a remark unconnected to the current subject; by the way.

2. in an incidental manner; as a chance occurrence.

That quote seems pretty misinformed, code has to be a lot more connected to the machine to be runnable that that quote would have us believe.

Otherwise this would be valid code:

Ask the user their name. After they enter the name, load a game. Use some cool graphics.

That being said, perhaps that will be possible in 100 years. (Yes the first line may be possible in 10 years)

Re:Generating a Java program with 90% less code by nikanj on Wednesday December 04, 2019 @12:29PM (#21704406)
"Code should be primarily written for humans to read. Only in rare cases should the code be primarily written for the machine in mind"

In other words, don't doo premature optimization. Write the code so that it's readable, except on the chance occurrence where you need to eke out more performance.

Re:Generating a Java program with 90% less code by eeZah7Ux on Wednesday December 04, 2019 @12:27PM (#21704376)
Having a problem so bad that you develop a good solution? That's the opposite of a feature.
Re:Generating a Java program with 90% less code by ailideex on Wednesday December 04, 2019 @04:29PM (#21707274)
> I agree that Java is almost unwritable without an IDE, but that strictness has led to Java having better IDEs than most languages.

I think the conundrum of java is not quite the same thing as strictness.

Re:Generating a Java program with 90% less code by mister_hn on Wednesday December 04, 2019 @01:18PM (#21705135)
Well, having tried both Eclipse and IntelliJ Ultimate, I can say that

* Eclipse has a crappy UI and can't handle Java9+ code very well, but can handle large code bases

* IntelliJ Ultimate has nice UI and assistance, but it totally fails with large code bases and still tricks you if you run code inside the IDE, especially when you want to use jigsaw modules and not classpath, as it uses by default

Unfortunately, using Java with other editors (vim, VS Codium, etc) is just difficult

Re:Generating a Java program with 90% less code by alasdair_ on Wednesday December 04, 2019 @12:18PM (#21704220)
I agree, it’s verbose. That being said, The boilerplate often helps when reading unfamiliar code. More importantly, the IDE support is fantastic, especially on large codebases.

An example: if I want to refactor a simple thing like Rename a method called “doFoo()” I can do this trivially.

Now, this seems simple but it’s not - I only want to refactor uses of this particular method, NOT any other methods that happen to be called “doFoo()” on unrelated classes or interfaces. Moreover, I want the refactor to intelligently work on everything, including inherited classes, abstract classes and interfaces, while correctly ignoring the stuff i mentioned previously.

None of this matters much if you have a small codebase and a fee developers, but on a huge codebase with many developers, all that boilerplate lets people quickly understand new code and easily refactor that code while being sure they did not break anything.

Re:Generating a Java program with 90% less code by runT1ME on Wednesday December 04, 2019 @02:05PM (#21705752)
>The boilerplate often helps when reading unfamiliar code

I don't believe this to be true at all, especially for large code bases. Often the people who support this position have not worked on 100k, 500k, 1m LOC applications I've found.

Boilerplate makes it much more difficult to read and scan large swatehs of code. I think when people say boilerplate 'helps', they often noticing a correlation between the fact that many strongly typed systems happen to have excess boilerplate. I believe it's the typing that helps, not the boilerplate.

Re:Generating a Java program with 90% less code by alasdair_ on Wednesday December 04, 2019 @03:24PM (#21706513)
I agree on the strong typing note.

That being said, IntelliJ's IDEA is fantastic at hiding a lot of the boilerplate in Java (like getters and setters and all those import statements at the top of the file) and modern Java is FAR FAR better about being less verbose than it was in 1.0

Java also has Lombok (https://projectlombok.org/) that hides almost all of the repetitive stuff completely.

Re:Generating a Java program with 90% less code by jonfw on Wednesday December 04, 2019 @01:52PM (#21705588)
I absolutely agree, and that is why Java is a great choice for monolithic applications. It's verbose and it's extremely flexible.

The real reason to move away from Java is to move towards different software architectures (microservices!)

Re:Generating a Java program with 90% less code by alasdair_ on Wednesday December 04, 2019 @03:32PM (#21706596)
>The real reason to move away from Java is to move towards different software architectures (microservices!)

This is a SpringBoot microservice:

@RestController public class BasicController {

    @RequestMapping(value="/{id}", method = RequestMethod.GET)
    public String get(@PathVariable("id")Integer id) {
        return doStuff(id);
    }
}

I'm not sure it's any more verbose than the equivalent Ruby on Rails microservice (for example).

Re:Generating a Java program with 90% less code by dcolkitt on Wednesday December 04, 2019 @12:11PM (#21704109)
In some ways the Java philosophy seems like the antithesis of the Unix philosophy. Instead of a lot of small, fast, composable tools that do one thing and do it well, Java culture mostly promotes giant self-contained systems that capture everything in a sprawling OO type system.

This distinction is reflected in even small design details. For example Java programs are comparatively slow to boot up. If you're mostly used to the Unix way of repeatedly piping the STDIN/STDOUT of small utilities in an interactive command line, this is painfully inconvenient.

But if your workflow involves a monolithic server that manages every component of the business logic in a single process, then 5 second boot times aren't really a big deal. Because maybe you bounce the server once a week at most.

Re:Generating a Java program with 90% less code by zten on Wednesday December 04, 2019 @01:06PM (#21704950)
Yes! Things like Spring Boot are actually a reaction to the days of Java EE and the web of Java-centric technologies.

This always confused me as a newer developer. Vendors competed with each other with different JavaEE implementations (WebSphere, Glassfish etc) that all conformed to the same interface and provided everything including the kitchen sink, but what really differentiated the products were vendor-specific features that require you to go outside the interface, but if you tried to use that stuff, another senior developer would tell you that we can't marry our implementation to a specific vendor... meanwhile, literally every company you go to uniformly uses Spring and Hibernate, and both will inevitably require you to not pretend that they're dumb implementations of javax.inject and javax.persistence.

Re:Generating a Java program with 90% less code by imtringued on Wednesday December 04, 2019 @07:22PM (#21708686)
And Micronaut is a reaction to Spring Boot bloat... And GraalVM native image is a solution to Micronaut bloat... When does it finally end?
Re:Generating a Java program with 90% less code by pjmlp on Wednesday December 04, 2019 @01:54PM (#21705604)
THE UNIX FOSS philosophy, hardly seen in commercial settings.
Re:Generating a Java program with 90% less code by dionian on Wednesday December 04, 2019 @03:36PM (#21706628)
back in the day when i started java, which was its early days(90's), we didnt even have a package manager type solution for java libraries (i.e. maven) - UNIX had a massive head start on java in some respects
Re:Generating a Java program with 90% less code by oftenwrong on Wednesday December 04, 2019 @10:36PM (#21709762)
5 second boot time? Most Java programs I have worked on start up near-instantly.

Small programs can be written in java. It's a general purpose programming language. You could write grep in java.

Re:Generating a Java program with 90% less code by aembleton on Thursday December 05, 2019 @03:29AM (#21710789)
Have you worked on any that make use of a framework that uses lots of reflection such as Spring?
Re:Generating a Java program with 90% less code by oftenwrong on Thursday December 05, 2019 @10:23AM (#21713035)
I have avoided Spring as much as possible. Performance is one reason.

But I thought we were talking about Java:

"For example Java programs are comparatively slow to boot up."

Re:Generating a Java program with 90% less code by eitland on Wednesday December 04, 2019 @11:46AM (#21703792)
I dare anyone of you who thinks like this to study as much modern idiomatic Java as I've studied Python or Javascript.

I'll give you this though: Old Spring and JSF code could be really bad, I remember updating two different XML files every time I changed something in a controller.

Edit: even back then with all that boilerplate it was really nice compared to legacy Delphi where it took three full days with an expert to find and install all required dependencies before one could even start compiling the old source.

By comparison my Java dev environment was up and running in less than half a day with Ant, and when we introduced Maven a few months later setip time for a new developer was mostly the time it took to check out code, install dev databases (yep, back in the days) and set necessary environment settings. (Protip: many people hate NetBeans but one thing it got more right than all other Java IDEs AFAIK was accepting the pom file as the truth instead of creating its own.

Re:Generating a Java program with 90% less code by pashky on Wednesday December 04, 2019 @11:55AM (#21703894)
On the other hand consider this: suppose you’ve built retail business out of your house, then it grew well. And now all those conveyor belts come in very handy, right?

Sometimes project is big enough to have a lot of code, boilerplate or not. And then all that IDE automation suddenly becomes essential.

I’ve been to some huge Scala codebases, it was much harder to navigate or make changes there than shove around Java cruft with IDE.

Re:Generating a Java program with 90% less code by whalesalad on Wednesday December 04, 2019 @12:08PM (#21704065)
This is a trend I see reemerging with the hyper focus on VSCode. At some point people won’t be able to work on their projects without it. That might not be a good thing... as we have seen with Java.

I like being able to consider a shell to be the lowest common denominator for a codebase. If basic shell commands, environment variables, a vanilla vim/nano editor etc... can’t be used to hack on your system then I think it’s far too coupled to tooling.

Re:Generating a Java program with 90% less code by shpongled on Wednesday December 04, 2019 @12:19PM (#21704246)
I can write code in Notepad, but why would I do that when I can see type annotations/errors on the fly? It greatly increases my productivity, probably by a factor of least 1.5x.
Re:Generating a Java program with 90% less code by whalesalad on Wednesday December 04, 2019 @02:29PM (#21705997)
I’m not suggesting you must use a barebones editor for work. I’m suggesting that if you NEED a massive IDE for development then there is a problem.

I use Sublime with a handful of plugins, linters, etc... enabled. But if someone wanted to hack on my projects with Notepad they totally could.

Re:Generating a Java program with 90% less code by thu2111 on Wednesday December 04, 2019 @04:24PM (#21707217)
You don't need an IDE in any language I'm aware of beyond exotica like language workbenches. People are using the word "need" here to mean "is really really useful".
Re:Generating a Java program with 90% less code by rmangi on Wednesday December 04, 2019 @12:14PM (#21704161)
why are people afraid of modern text editors? Why cling to 1980s technology?
Re:Generating a Java program with 90% less code by epicide on Wednesday December 04, 2019 @12:52PM (#21704744)
I don't think it's necessarily (just) for a love of 80s editors. I think it's more of a litmus test that your developer experience is too tightly coupled with specific tooling.

i.e. if you can't (realistically) choose your own tools, then your experience with the ecosystem is that of your experience with the tool. No tool can be a good experience for everybody.

Re:Generating a Java program with 90% less code by pjmlp on Wednesday December 04, 2019 @01:53PM (#21705593)
Well some people would advertise UNIX as an IDE and then just try to turn into POSIX anything that they use, hardly any different.
Re:Generating a Java program with 90% less code by epicide on Wednesday December 04, 2019 @04:13PM (#21707055)
I think you may be projecting others' arguments onto the parent.

I did not read it as "everything should support the UNIX IDE" as much as expressing a preference for it and that it's a red flag if you can't even use standard vanilla tools (e.g. grep) to do basic things in an ecosystem.

I think it's fair to say that you should be able to edit code in your editor of choice and not have a terrible time.

Re:Generating a Java program with 90% less code by pjmlp on Thursday December 05, 2019 @12:45AM (#21710255)
Which brings back to having a language designed for poor developer experience, given that tooling support cannot be part of the overall experience.

So if for language X, if I as language designer want to provide the same experience as Smalltalk, either I consider the interaction with IDE workflows, or I design command line tooling to go along the language (e.g. Go).

And the command line experience comes back again to the universe where it is more prevalent, POSIXy systems.

So I don't think I am making false assumption here, as one cannot have it both ways.

Re:Generating a Java program with 90% less code by ohithereyou on Wednesday December 04, 2019 @01:00PM (#21704861)
>If basic shell commands, environment variables, a vanilla vim/nano editor etc... can’t be used to hack on your system then I think it’s far too coupled to tooling.

The above does not evince a fear of modern text editors. Nor does it equate to clinging to 1980s technology. Why do you think it does?

Re:Generating a Java program with 90% less code by mdtusz on Wednesday December 04, 2019 @02:50PM (#21706189)
Why are people still flying 737's? Why cling to 1970's airliners?

Just because something was created long ago does not mean it hasn't improved. Vim and Emacs are both extremely featureful and powerful editors and many people prefer to be able to pick and choose specific tools that do their jobs extremely well.

It's not about using "old" technology - it's about using a tool that excels at its targeted task, and letting you choose the best tool for ancillary tasks like searching, formatting, testing, debugging etc.

Re:Generating a Java program with 90% less code by dionian on Wednesday December 04, 2019 @03:54PM (#21706827)
youre not wrong and i may be biased as a long time java guy but if i had to do java without the tooling to make it less annoying , id probably try to switch languages... and this is an independent problem from the other benefits i get from JVM... namely platform (JVM) and ecosystem (open source libraries).
Re:Generating a Java program with 90% less code by itronitron on Wednesday December 04, 2019 @11:30AM (#21703601)
I am sure many people feel the same way about Python and Javascript. What you described seems to be a result of building larger systems in which multiple people are contributing code.
Re:Generating a Java program with 90% less code by root_axis on Wednesday December 04, 2019 @11:42AM (#21703755)
The criticism doesn't really apply to Python and JavaScript though. Not to say that Python and JavaScript don't have their own issues, but dependence on an IDE tightly coupled to the language semantics is not one of them.
Re:Generating a Java program with 90% less code by ng12 on Wednesday December 04, 2019 @11:57AM (#21703921)
I can't speak for Python but the JavaScript community has been investing heavily in TypeScript, and the desire for a more integrated IDE experience is a huge driver for that growth.
Re:Generating a Java program with 90% less code by root_axis on Wednesday December 04, 2019 @12:36PM (#21704517)
Definitely true, though I think the problem is less severe with regard to TS because open source language-servers afford TypeScript IDE features universal availability which is not the case in JVM land. Also, consider the trend towards Kotlin in the Java world where a part of Jetbrain's business model relies on the fact that they created and maintain the language while also selling the IDE that makes the language practical to use (Kotlin being an amazing language notwithstanding).
Re:Generating a Java program with 90% less code by jefflombardjr on Wednesday December 04, 2019 @06:13PM (#21708212)
Typescript: Putting the Java™ in Javascript
Re:Generating a Java program with 90% less code by SmellyGeekBoy on Wednesday December 04, 2019 @11:57AM (#21703926)
Last time I worked with Python or JavaScript I was using a very basic text editor. I'm not sure I'd be quite so brave with Java.
Re:Generating a Java program with 90% less code by kjeetgill on Wednesday December 04, 2019 @12:03PM (#21703988)
I don't know about JS, but my python work is done in a repl like ipython in conjunction with a text editor. It gets me half of what I wanted from an IDE.
Re:Generating a Java program with 90% less code by nurettin on Wednesday December 04, 2019 @11:36AM (#21703683)
I confirm this. I rename classes and move them around, and without a refactoring tool that renames files and changes imports automatically, life would be very hard. Before refactoring tools got to this level, I was running pytest to see what import statements got affected during my refactors.
Re:Generating a Java program with 90% less code by salawat on Wednesday December 04, 2019 @12:06PM (#21704039)
Uh. Question. Why are you executing tests to get the compiler to tell you what was effected instead of doing a top level recursive grep to identify any classes or configs with an explicit symbolic dependency?

I mean, you get the same result, sure, but I find I can hardly ever rely on test coverage alone as an accurate safety net to clearly indicate whether I've reached an actual stopping point for a full refactor.

This is one of the ways in which Java excels, in that that loop is fully accommodated for in most major IDE's.

You can still get caught by surprise at runtime, but I've found that for a strongly typed language like Java, the syntax, and necessity of boilerplate makes most bugs obvious until you start getting overly dependent on frameworks you don't understand.

Re:Generating a Java program with 90% less code by nurettin on Wednesday December 04, 2019 @12:56PM (#21704808)
I am not executing tests to perform import error detection. That was before refactoring tools got better. I was executing tests to check for import errors because it doesn't rely on full coverage on every method. It relies on all modules being imported by tested modules. That is easy to do even if you are too lazy to test every module. Just put an empty test function in all of them and pytest will detect them recursively. Given all that, I would avoid executing manual grep commands. However, you have a valid point for configuration files. Especially log configs need to be checked.
Re:Generating a Java program with 90% less code by dep_b on Wednesday December 04, 2019 @12:06PM (#21704036)
Would the language described in the article (Unitliy) be harder to refactor? Why?

Python is not static typed, it won’t refactor as easily.

Re:Generating a Java program with 90% less code by zozbot234 on Wednesday December 04, 2019 @11:33AM (#21703628)
This kind of automation depends on a language being easy to parse, and Java achieves this better than C/C++ or most scripting languages. The LSP (language server protocol) is a language-independent standard that can be used to enable this more generally, by connecting parsers/compilers/etc. with editors/IDE's.
Re:Generating a Java program with 90% less code by btilly on Wednesday December 04, 2019 @01:13PM (#21705055)
My comment for years has been that most programming languages are for humans first, and computers second. But Java is for tools first, humans second and computers third.

The result is an excellent toolchain. But also you are completely unproductive unless you master said toolchain.

Re:Generating a Java program with 90% less code by mdtusz on Wednesday December 04, 2019 @11:48AM (#21703810)
I am a big fan of rust, but I am starting to feel like this is a thing with it too. Not to the same extent at all, but I often find myself writing what feels like scaffolding boilerplate code.

That said, the code is usually there for a good reason and I'm extremely thankful for it in the instances where things are refactored and the compiler catches it, or some deviation from the norm comes up and the scaffold allows for doing things the way you need.

Re:Generating a Java program with 90% less code by ratww on Wednesday December 04, 2019 @12:19PM (#21704242)
This is strange, I've been programming mostly Rust for the last six months and I'm finding it very terse actually. It is much shorter than the original Javascript code it's replacing, mostly because of the error handling.

Are you using an MVC web framework, or something like that? Asking because I'm curious about other people's experience with Rust.

Re:Generating a Java program with 90% less code by mdtusz on Wednesday December 04, 2019 @02:54PM (#21706230)
Boilerplate may not be the best term. It's more the presence of fitting into types and structures that certain libraries/frameworks provide where you just need to be much more explicit than in some languages. It's definitely a good thing long term though.

Writing code without dependencies/frameworks that have a required structure is a joy, however.

Re:Generating a Java program with 90% less code by devit on Wednesday December 04, 2019 @12:21PM (#21704279)
Are there cases of such boilerplate that are not solved by macros?
Re:Generating a Java program with 90% less code by marcus_holmes on Wednesday December 04, 2019 @11:57AM (#21703914)
ditto for Go. Huge fan, but it does involve a lot of boilerplate.

Not that I think that's a bad thing. I prefer it to "magic" (I never got on with Rails because of this... what just happened? why did it do that? where does it say it should do that?).

And you never know when you have a class/use case that needs the boilerplate to change. Having it the same 99% of the time so that you have the option to change it for that 1% edge case is a good thing, imho.

Re:Generating a Java program with 90% less code by jimbokun on Wednesday December 04, 2019 @12:05PM (#21704033)
> (I never got on with Rails because of this... what just happened? why did it do that? where does it say it should do that?)

With Spring you get to ask all these questions...with all the boilerplate of Java as an added bonus!

Re:Generating a Java program with 90% less code by pm90 on Wednesday December 04, 2019 @11:59AM (#21703945)
Go seems to have much less boilerplate than Java. I’m really glad that OOP was explicitly unsupported and the language designers opted for using interfaces instead.
Re:Generating a Java program with 90% less code by kjeetgill on Wednesday December 04, 2019 @12:11PM (#21704114)
Interfaces are as much a part of OOP as inheritance. Go is as OOP heavy as Java. They differ mostly in how/when an "class" is bound to an interface. Java declares up front, Go does this implicitly at usage sites aka static duck-typing (which is great!).

That said, I think OOP education focused a lot on inheritance during Java's rise and that was mostly a mistake in hindsight.

Re:Generating a Java program with 90% less code by ickyforce on Wednesday December 04, 2019 @03:08PM (#21706376)
> Go seems to have much less boilerplate than Java

Maybe if you compare to Java from 10y ago. Have you ever tried to print a map in an alphabetical order of its keys?

The only thing more verbose in Java are getters/setters which hopefully will disappear once records are available.

Re:Generating a Java program with 90% less code by Spooky23 on Wednesday December 04, 2019 @01:06PM (#21704952)
That's a design feature. Java is the modern COBOL.

The idea is that you hire an army of marginally qualified developers through an agency that are making $14-18/hr in the US and have them churn out code.

To use your house example, it's like addressing clutter by having 5 children and making them clean.

Re:Generating a Java program with 90% less code by pjmlp on Wednesday December 04, 2019 @01:55PM (#21705627)
Re:Generating a Java program with 90% less code by tyingq on Wednesday December 04, 2019 @12:03PM (#21704004)
I can't imagine writing Java in a plain vim session. You would need a photographic memory.
Re:Generating a Java program with 90% less code by peterashford on Wednesday December 04, 2019 @04:59PM (#21707647)
Coding Java was what made me stop using Emacs for everything and switch to IDEs. It's a much better experience
Re:Generating a Java program with 90% less code by tyingq on Wednesday December 04, 2019 @05:31PM (#21707944)
I imagine you have an old keyboard somewhere where the "." key is worn smooth with no "." visible. Maybe the tab key on your current keyboard is now in similar condition.
Re:Generating a Java program with 90% less code by pjmlp on Wednesday December 04, 2019 @01:41PM (#21705441)
As proven by Xerox PARC, EHTZ, Apple, Borland and Microsoft tooling as well.

The best programming languages for developer productivity are those that are designed with tooling in mind, instead of grammar + semantics and then we see later how everything evolves.

Re:Generating a Java program with 90% less code by MichaelMoser123 on Wednesday December 04, 2019 @07:32PM (#21708766)
my question is how do you make sense of a seemingly endless stacktrace? (really curious, it's some time since i did something in java)

Another problem i had with java: most projects are impossible to understand by looking at the source code, as they tend to do things like Spring or EJB: with delayed loading where class names are specified in some configuration files - and it is often hard to figure out how the system is initialized.

That leads to another question: Is it possible to learn about an unfamiliar java project from source code in this day and age?

i mean they used to say that perl is a write only language; but enterprise java isn't very readable either.

Re:Generating a Java program with 90% less code by aembleton on Thursday December 05, 2019 @03:35AM (#21710813)
> Is it possible to learn about an unfamiliar java project from source code in this day and age?

Yes it is, but it helps a lot if you're familiar with the framework and the original developer used sensible conventions. I guess that's the same with any language though.

Re:Generating a Java program with 90% less code by skizm on Wednesday December 04, 2019 @12:57PM (#21704813)
A code base is not like a house. There is no "done" state. You have to rearrange and extend code bases every few months due to changing business needs.
Re:Generating a Java program with 90% less code by jayd16 on Wednesday December 04, 2019 @11:52AM (#21703860)
Java doesn't have a preprocessor macros so everything is generated explicitly. Its not that unique of a concept.
Re:Generating a Java program with 90% less code by iampims on Wednesday December 04, 2019 @12:00PM (#21703962)
It has build-time annotations though, which often serve the same purpose.
Re:Generating a Java program with 90% less code by raverbashing on Wednesday December 04, 2019 @11:33AM (#21703629)
It's a nice analogy. And I agree with it.

For me it seems weird that the Java IDE is "smarter" than the compiler. Then why can't the compiler abstract stuff...

Like the 'auto' keyword that took how long to exist again?

Re:Generating a Java program with 90% less code by phillipcarter on Wednesday December 04, 2019 @11:45AM (#21703786)
This is just one example of a general tension between compiling to produce an asset vs compiling as a service to provide data for tooling. The environments and things you optimize for are different, so you get differences like this. Compilers like what C# and F# use unify these into the same codebase (no presentation compiler) but the tradeoffs still exist.
Re:Generating a Java program with 90% less code by coding123 on Wednesday December 04, 2019 @11:38AM (#21703701)
The compiler is not interacting with the user. The ide isn't smart enough to apply some refactoring without the users consent.
Re:Generating a Java program with 90% less code by KorematsuFred on Wednesday December 04, 2019 @12:56PM (#21704796)
Java is not a cluttered house, it a mega warehouse with over billion products lying around. No amount of organizing will make it simple for you top find what you want. Hence the conveyer belt instead of better organization.
Re:Generating a Java program with 90% less code by axaxs on Wednesday December 04, 2019 @11:51AM (#21703854)
This is exactly why I've always had a strong aversion to Java. I like 'easy to remember' languages, with a strong preference towards Go and Python, and -somewhat- C though I don't use it often. In any of these languages, I can use an IDE with nice integrations, or if I want to write a quick one off, I can drop into vim and pound out a 50 liner and run it. This is an absolute nightmare to attempt in Java.