News for hackers. Stuff that matters.
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.