DEV Community

Cover image for 10 Skills Java Programmer can Learn to Accelerate their Career

10 Skills Java Programmer can Learn to Accelerate their Career

javinpaul on January 10, 2020

Disclosure: This post includes affiliate links; I may receive compensation if you purchase products or services from the different links provided i...
Collapse
 
siy profile image
Sergiy Yevtushenko • Edited

Knowledge of Spring will help to be in trend, but Spring itself is an example of poorly designed and even worse implemented piece of technology. Its wide use greatly contributed to recognition of Java as slow and memory hungry language.

P.S. I think Spring is technically obsolete since release of Java 1.5

Collapse
 
vladonemo profile image
Vladimir Nemergut

I must disagree with this statement. Spring is typically ranked somewhere in a middle of the scale of synthetic benchmarks. Which is quite good considering how rich the framework is. The whole Spring ecosystem is one of the best in Java world, making it one of the first choices for enterprise development. Moreover, Spring Boot is also a great choice for rapid prototyping.

Collapse
 
animeshz profile image
Animesh Sahu

I think ktor is better framework. You should be able to have only lightweight code to be working in order to increase the performance and you can turn them on anytime according to requirement, that may increase efficiency of machine too and saves a lot of energy and also better performable.

Collapse
 
siy profile image
Sergiy Yevtushenko • Edited

Number of features is a bad excuse for poor performance.

Let's take a look at Techempower benchmark:

  • JSON Serialization, position - 212 of 366, relative performance - 10%
  • Single query, position - 131 of 404, relative performance - 15.7%
  • Multiple queries, position - 10 of 394, relative performance - 67.1%
  • Fortunes, position - 221 of 371, relative performance - 4.4%
  • Data updates, position - 23 of 365, relative performance - 46.4%
  • Plaintext, position - 245 of 352, relative performance - 1%

In "Multiple queries" and "Data updates" benchmarks those results achieved with modern webflux-based versions, which are quite far from traditional Spring applications. But even these results are poor compared to Vert.x or Jooby versions, for example. Overall this does not look like "in the middle".

The whole Spring ecosystem is one of the most popular, but popularity does not automatically mean high technical quality. In fact it's happens quite often when technically inferior solutions gets more popular than more technically advanced competition.

Spring was a revolution at the time when it appeared. Heavy use of run-time reflection was completely reasonable by that time, there were just no other way to add necessary functionality. Since Java 1.5, there is a compile-time annotation processing which enables achieving almost the same results without such a run-time overhead. Take a look at, for example, Micronaut framework, in many respects Micronaut is a "Spring done properly".

As for rapid prototyping. There are many much smaller frameworks which are even better for rapid prototyping. Also, quick start with the Spring does not mean quick release of the production version. Spring has many other issues like using exceptions as part of business logic, many ways to do same thing, a lot of "magic" which can easily break (and result to many hours/days of painful debugging), overuse of annotations and so on and so forth. All these makes development of the production version far more painful than it needs to be.

Thread Thread
 
stealthmusic profile image
Jan Wedel

So first: Everyone should be happy with whatever feels right. But spring is still industry standard so it’s absolutely correct to put it on the list.

Regarding its design: I think it’s actually very well designed. Especially if you think about how flexibility it is and how it evolved from XML based DI container to something modern as spring boot without a total rewrite.

Regarding vertx: Vertx actually was very poorly designed, at least until version 3. We had couple of teams and micro services that used vertx for years and all of them migrate to spring boot.

So unless you need that last bit of performance in very specific scenarios (which 95% of the use cases are not), there is no reason to pick vertx over spring.

Thread Thread
 
vladonemo profile image
Vladimir Nemergut

Agreed. And I'd also like to add, that developers are paid to solve people's problems. Companies pay developers to solve people's problems, too. If you can accomplish this with a smallest investment possible, reach you architectural (quality) goals (which should also be good enough, not better) and keep the maintenance/operational/ support cost reasonable and sustainable, then opting for a framework like Spring is really a good choice. The size of community and the number of extensions says or all.

Thread Thread
 
siy profile image
Sergiy Yevtushenko

In other words, "1 million of lemmings can't be wrong".
In fact maintenance/support cost with Spring are quite high and quickly grows as application ages.

Thread Thread
 
stealthmusic profile image
Jan Wedel

From my experience, building business applications in vertx and also spring web flux has 5-10x the costs for writing, reading and maintaining code than spring boot with web mvc. We have used web flux in very limited use cases successfully because we needed the performance there.

Thread Thread
 
siy profile image
Sergiy Yevtushenko • Edited

You trying to read my answer as if I promote Vert.x. This is not so. And this does not justify use of Spring Boot. If you really can't write async code in Vert.x style (which is definitely not so easy due to used processing model), then there are countless smaller frameworks, which support familiar JAX RS endpoint style. If there is just no way to leave comfort zone, then Micronaut might help as well. As I've mentioned above, it's Spring done properly, with handling at compile time all things which can be handled at compile time, like DI and MVC. And as far as I can see, it is made Spring-like as much as possible.

Spring survived for so long time not because of quality of its design. It survived because of Java great backward compatibility. When backward compatibility was basically broken with Java 9, there is no way for Spring to survive as it is (in regard to design). All those component scans and countless layers of run-time reflection do not work well with modern Java, requiring to open all application packages to Spring and defeating whole purpose of modularization.

Finally few words about performance. You're right, not everybody needs good performance. But I'm looking at performance from other perspective - high performance means that less resources are necessary to handle specific load. Less memory, less CPU, less instances in cloud, less energy. This results to cheaper bills from cloud provider and lower environment impact.

In fact one of the things I don't like in Spring most is that it grew up whole generations of developers who assume:

  • resources are unlimited
  • nobody was fired for using Spring
  • everything in Spring is perfect and follows best practices
Thread Thread
 
stealthmusic profile image
Jan Wedel

In other words, "1 million of lemmings can't be wrong".

Phew... do you view yourself as the only smart person amongst millions of mindless spring developer lemmings that understands how bad spring actually is? From my experience, most developers I've met are very smart. And they do always strive to reduce unnecessary work and to automate and simplify stuff in the way. Spring helps a lot with that.

Funny side-note here: I was really hating Spring until Spring Boot came out and avoiding job offers just because of the fact that they were using Spring.

Aside from that, I give that point regarding resource consumption. This is going to be a bigger and bigger issue in cloud scenarios. But also here, Spring is not the issue, neither in memory consumption nor in performance. A plain Spring application does not consume much memory and starts really fast (even with thousands of dependencies and auto-configuration). The JVM however does which is a problem when you are running dozens or hundreds of microservices, each starting a JVM with 100-200MB RAM first. Then, one if not the one important factor regarding start-up time and memory consumption is Hibernate/JPA which people usually blame on Spring.

So if you use plain spring, maybye even Spring-Fu (Functional bean definition) without JPA you can already build a native-image with Graal and get a start-up time of 1ms and a couple MB RAM usage. But if you add all that convenience that makes you faster during development, it's going to be much slower and more memory consuming at the moment.

I find both Micronaut and Quarkus interesting and I follow those projects which are build from the ground-up as cloud native frameworks. But since Spring is also evolving in that direction and has a much much richer ecosystem, I don't think they will take over any time soon.

So coming back to the initial posters topic:

10 Skills Java Programmer can Learn to Accelerate their Career

I honestly don't believe, that other frameworks should be put on that list at the moment. However, they definitely belong on a "10 technologies every Java developer should check out" list or similar.

Thread Thread
 
siy profile image
Sergiy Yevtushenko • Edited

Phew... do you view yourself as the only
smart person amongst millions of mindless
spring developer lemmings that understands
how bad spring actually is?

Nope. I'm using Spring for last 10 years or so, and vast majority of Spring devs I've worked with had exactly the same opinion about it. But my argument was not about who is smart and who is not. It was about using Spring popularity as a proof of quality.

So if you use plain spring, maybye even
Spring-Fu (Functional bean definition)
without JPA you can already build a native-
image with Graal and get a start-up time of
1ms and a couple MB RAM usage. But if you add
all that convenience that makes you faster
during development, it's going to be much
slower and more memory consuming at the
moment.

You basically just repeated what I wrote above - Spring with it's "majic" is a CPU/Memory hungry bloatware.

I honestly don't believe, that other frameworks
should be put on that list at the moment.

Spring should not be in that list either.

Collapse
 
thiago18l profile image
Thiago Lopes

Great article man, thanks a lot.

Collapse
 
javinpaul profile image
javinpaul

Thx, happy that you find it useful.

Collapse
 
luckie profile image
LucKie⚡

Quite beautifully written👏, I wish I could find such an article on Golang.

Collapse
 
javinpaul profile image
javinpaul

Thx, happy that you find it useful.

Collapse
 
anshul10s profile image
anshul10s

Great article lambda snippet can be even shorter.

(s1, s2) -> s1.length() - s2.length()

Collapse
 
ericdraken profile image
Eric Draken

This has inspired me to see what I can organize for my team.

Collapse
 
hamidur01 profile image
Hamidur Rahman

Thanks for the resources.

Collapse
 
hacksonx profile image
Shaun Mbhiza • Edited

Great article. Just to follow up, is Java still as much a language that's targeted at write once run everywhere or has it become a language for web applications?

Collapse
 
hophiducanh profile image
Ho Anh

Thanks a lot!

Collapse
 
raphaelkhan profile image
Raphael Khan

This was quite helpful. As a new Java developer I was looking for things to focus on and this article helped narrow it down for me. Thanks

Collapse
 
r4lly99 profile image
mohd rully k

I wish this pandemic accelerate gone , meanwhile I choose to learn Quarkus or Helidon 2.0 framework to accelerate my application services

Collapse
 
arpit20adlakha profile image
arpit adlakha

Great Article , Really Helpfull