In our special Java Daily edition, we’d like to introduce you to Rafael del Nero. He was kind enough to share his experience on 10 Java-related questions.
Rafael Del Nero is a Java Champion, creator of NoBugsProject and quiz master in Oracle Dev Gym, is the author of “No Bugs, No Stress – Create a Life-Changing Software Without Destroying Your Life.” He is also the mind behind “Java Challengers” – an initiative that was created to provide Java developers a profound knowledge about the Java language with fun code challengers! Rafael believes there are many techniques involved in creating high-quality software that developers are often unaware of. His life’s purpose is to help Java developers use better programming practices to code quality software for stress-free projects with fewer bugs.
Java Daily: How did the idea to write The Challenger Developer Guide come about?
Rafael del Nero: I have a mentorship program called the Challenger Developer where I help Java developers to go to the next level in their career. Therefore, the idea of the book came from my mentorship program.
My job in the mentorship is to open the eyes of the mentees for their potential. Developers learn very important principles such as defining clarity for their goals, mindset, communication, knowledge sharing and so on. Those principles are not easy to apply, the purpose of the mentorship is to guide the developer for faster growth in their career.
Java Daily: What do you think about the latest java features? For example Incubator features (JEP338: Vector API, JEP389: Foreign linker API, JEP393: Foreign access API), JVM improvements(Concurrent thread-stack processing).
Rafael del Nero: Those new Java features will significantly improve performance. Most Java developers won’t feel the impact of those features though at a code level. However, in the infrastructure side, those changes will boost performance and many popular Java frameworks and dependencies will certainly make use of those features to make performance optimised.
Therefore, performance optimisation features in Java make a great impact behind the scene, but not so much in code.
Java Daily: In various projects, some functionalities can be done both with lambda expressions and without. For some people, it becomes a programming style. For example, some people use lambdas for filtering and iterating a list, others prefer for each. Is it a problem if the developers in a project are not consistent with each other?
Rafael del Nero: Lambdas make the code more readable and concise, I believe it’s very important for developers to define code standards. In my opinion, if there is the possibility to use lambdas, developers should agree to only use lambdas. If developers are very against the use of lambdas for any reason, it should be fine for them to not use it either.
My point is that developers can use whatever they are more comfortable with, but at the same time, stick to one code standard. Otherwise, code that has multiple patterns and standards, ends up not having one. Code without standards is difficult to maintain because each developer will code in their own style.
Java Daily: Can you recommend a good source of study materials for lambda expressions?
Rafael del Nero: I have a few of them:
- The videos and presentations from my good friend Dr. Venkat Subramaniam: link
- I wrote a full chapter about lambdas and method references in the Java Challengers book. Developers can get the book in the following link.
- I also recommend the book of my friends Jeanne Boyarsky and Scott Selikoff: link.
- I created a video explaining lambdas and method references in a detailed way: Part 1 & Part 2.
Java Daily: What is the difference between Decorator and Proxy Pattern in Java?
Rafael del Nero: The decorator pattern allows developers to decorate and create complex objects without the need of creating several classes. If we have a Pizza class, for example, we could decorate it with the toppings, such as mozzarella, tomato, and so on. Another good example is an HTML UI. We can decorate the HTML with a table, a table with lists, input texts, comboboxes.
The proxy pattern will protect an object to be accessed directly, it is possible to control access of methods, create logs, create cache. Actually, both of those patterns are quite different and they solve their own specific problems.
Java Daily: Spring and Quarkus are quite similar, but when you start a project and you have to use one of them based on what criteria you choose?
Rafael del Nero: Spring is still the most popular Java framework, therefore, this is something strong to consider since there will be more developers to be hired. It’s also a framework that is being evolved constantly and has a large community contribution.
Quarkus on the other hand is getting a lot of traction in the market and is getting more and more popular. It’s also quite simple to learn, very similar to Spring and it’s cloud-native. It’s fast, reliable and many top reference tech companies are supporting it.
I believe the decision between Spring and Quarkus would be a safe one. Quarkus is also an implementation from Microprofile which brings even more reliability to it. Personally, I would go for Quarkus but Spring would be a safe bet as well since it’s still the most popular framework in the market.
Quarkus and Spring are both mature and they have great success cases from big companies using them in production.
Java Daily: Which of them for what type of problems is most suitable for use?
Rafael del Nero: Quarkus is quite powerful for light-weight cloud-native Java projects. Since nowadays microservices are in dominance in the market, it’s a quite smart choice.
Spring can be more suitable for more robust systems that will need many developers who are already experienced with the framework. Therefore, if the project is really big, it might make sense to go with Spring.
Both frameworks pretty much solve the same problem but if you don’t have to work on a big project, Quarkus is a great choice. To be clear in my point, I don’t mean Quarkus can’t be used for big projects, on the contrary. My point is that it might be more difficult to find people with experience in Quarkus.
Java Daily: Can Java catch up with new programming trends?
Rafael del Nero: Yes, Java has shown many times that this is possible with lambdas, streams, and optionals. It’s a big challenge for Java though because of the retro-compatibility. Java won’t be able to follow all the syntax-sugar and programming trends but the essence and new paradigms of other programming languages Java will certainly implement as powerful features as the other programming languages.
Java Daily: What do companies find most difficult when it comes time to upgrade to a newer version of Java? What are the most common problems?
Rafael del Nero: Java by itself is retro-compatible, therefore, there shouldn’t be a problem with the project if only Java is being used. However, the vast majority of the companies use frameworks and third-party libraries which is usually the problem to update the Java version. Java 9 is a good example, with the introduction of modules, frameworks that heavily relied on reflections couldn’t be used with the modules features.
Even though there are workarounds with the modules features, for example, there will be some work to make all dependencies compatible with newer Java versions.
In terms of infrastructure, the application server should also support the new Java version.
Java Daily: What do you think about the interweaving of different types of languages and Java? To what extent do they have a future and how far would they go?
Rafael del Nero: More recent programming languages are betting on the path to write less code. At the same time, this might seem like a good advantage, it’s also a disadvantage because it gets very easy for developers to write obscure code.
Many people say that Java is verbose, nowadays though, we can write less code and do much more with Java. Unnecessary verbosity is not good for a programming language but Java has many features and libraries that dramatically decrease the verbosity of the language. Unfortunately, many people who don’t know Java very well say that Java is still verbose because they don’t know the new features.
The other side of the coin when we talk about “verbosity” is that when we code with Java, the code gets expressive and easier to understand.
The more recent programming languages will go as far as people are using them. The big companies are heavily investing in their programming languages to gain space in the market. Java is still very strong in the market, it is robust, the community is vast, there are powerful companies behind the scenes to make Java better.
I believe the recent programming languages will coexist with Java and there will be people who love and hate one programming language or the other. People shouldn’t have this immature approach towards a programming language though, each programming language has their own pros and cons.
Is there anything else you would like to ask Rafael del Nero? What is your opinion on the questions asked? Who would you like to see featured next? Let’s give back to the Java community together!