JAVA is criminally underestimated

The point of view of an ignorant computer science student

image

You probably read the title of this post and thought, “What is this guy smoking? Java is everywhere! ” You’re right, Java still dominates the industry and powers some of the world’s largest mission-critical applications. But the spread of Java is not what I’m talking about, I’m talking about the hype around it. I spend a lot of time with inexperienced programmers. What do inexperienced programmers like to do? Be anxious and overconfident about tools like programming languages. None of the CS students I meet admire Java and I think it shouldn’t be that way.

Young / naive developers (myself included) often fall into the trap of fetishizing new languages ​​and tools at the expense of performance and sanity. Before working at Halp (now owned by $ TEAM), I had an almost romantic relationship with server-side TypeScript. I thought the node.js ecosystem was the coolest thing: I loved the idea of ​​transpiled code, real-time debugging, a huge package library, and even weird and fragmented build systems. When I actually used it in development and spoke with more experienced engineers, the magic quickly disappeared.

I had an irrational attachment to the JS ecosystem because it was a hot new thing; it was hype. The reality did not live up to my expectations. Today I enjoy the wonderful things that I have come to expect from JavaScript as I gain experience with Java. I feel cheated that the hype didn’t lead me to Java sooner. Java is fun to write, productive, and enjoys an unfair dinosaur reputation among new developers.

Ergonomics are what makes Java a great programming language

This should not be underestimated: Java is just a pleasure to write. This is largely due to the skill that JetBrains puts into IntelliJ IDEA. Everything is filled in automatically, jumping to the definition is quick, using find works well, and refactoring is easy. However, where Java really shines is in the experience of developers with third-party libraries.

Heavy workload dependency and industry trends

My experience is limited, but I feel like the wind has moved towards liberalizing external dependencies. Not invented here no longer in fashion, in fashion – Not Invented There… In particular, JavaScript developers are more likely to include third-party libraries even for trivial operations like this. like filling the number to the left… I don’t think the current attachment to third-party dependencies is particularly harmful, but API changes in the upstream could harm untyped JS / Python codebases.

When using third-party libraries in Java, you always know exactly what types you need to pass to a method. Most importantly, misuse of the function will result in red wavy lines in your editor. Given that libraries are widely used, I think more people should be enthusiastic about Java.

Nominal dialing saves time

Dynamic / implicit / weak / any typing has a number of disadvantages. When a dependency changes the API method and your application crashes at runtime rather than build time, that’s a problem. When a developer has to go back to the implementation of a method to figure out which types to pass, it’s a waste of time. TypeScript and Python type hints address this slightly, but lack the ability to check passed types at runtime without additional code.

Type protection is my least favorite TypeScript feature. Basically, this is an implicit typing that you must implement yourself and trust that it is implemented correctly. In my opinion, this is the worst of both worlds. Consider the following:

interface Dog {
    bark: () => void;
}

/* The developer has to manually implement
a heuristic check for interface adherence!
When they update the interface, they have
to update the type guards too! */
function isDog(pet: object): pet is Dog {
  return (pet as Dog).bark !== undefined;
}
const dog: any = {bark: () => console.log('woof')};

if (isDog(dog)) {
    // TS now knows that objects within this if statement are always type Dog
    // This is because the type guard isDog narrowed down the type to Dog
    dog.bark();
}

There is something about the AND type declaration of the need to write validation logic for the specified type that really worries me. The above code looks like thatas if someone was using the wrong tool.

Unlike TypeScript definitions, Java’s nominal type systems take the burden off the programmer’s brain by crystallizing type definitions and guaranteeing default type protection.

Removal of responsibility for optimization

Java developers can confidently trust the JVM to make the best applications. Whether they are implementing a multithreaded application or storing large amounts of data on the heap, they can be sure they won’t get shot in the foot by memory management or data races. This is primarily an advantage over C ++, which contains many footguns.

This is part of the Java ergonomic experience. When a developer needs to worry less about technical details, they can focus more on the current problem.

The holy grail of productivity

How many languages ​​can you remember that satisfy the following conditions?

  1. Quality package manager and build system (Maven)
  2. Nominal set
  3. Large community
  4. Automatic optimization

I think the only suitable tool is Java, but let me know if there are others!

edit: As noted by JwostyJava’s competitor, Microsoft C #, has all these characteristics and more / new language features. I’ve never used C # outside of the Unity game engine, but I’m going to learn it.

Surprising absence from the university curriculum

I am currently studying at the University of Colorado at Boulder; this is a great school, but not exactly known for CS. Most of our high school computer science curriculum, however, is shamelessly stolen from CMU or Stanford. During my studies at CU, I used the following programming languages:

  1. C ++. This language has been chosen for all the required core courses: computer systems, operating systems, data structures, etc. This language is a smart choice because it provides direct memory management, kernel module creation, and presents many challenges and learning opportunities.
  2. Python and Julia. As you might expect, these languages ​​were the favorites of the professors of numerical computation and discrete mathematics.
  3. Scala. This language was used by the Principles of Programming Languages ​​primarily for its functional programming and pattern matching functions. Although Scala uses the JVM and interacts with Java, it has a very different development experience than Java.
  4. Web languages ​​(HTML / CSS / JS). They were only used in one course, Software Development Techniques and Tools, on industry trends.

I am finishing this semester and Java has not appeared even once; I consider it a shame.

Conclusion

There is no one true way to build applications, but I think Java is not getting the attention it deserves, especially among startups and the novice programming community. Untyped languages ​​are useful tools, but I don’t think they should be the default choice for building large applications. If you are a full-featured developer and have never used Java extensively, I think you will be pleasantly surprised if you try it on your next project.

Java and the JVM were hyped in the 90s and early 2000s, but I don’t think they should ever disappear! The development experience I have gained with IntelliJ and Java is admirable.

I’m curious why Java has lost the hype at all. The cultural history of programmers is poorly documented, and if you have an understanding, write to me or leave a comment (on reddit/Hacker News).

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *