• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Want to regain confidence in Java having been mostly doing Python since last few years

 
Ranch Hand
Posts: 2949
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had started my career on Java around 15 years back. Then started working on Hadoop, Spark where programming language was Java so was still in good touch. Since last 5 years have got very less work on java and instead got regular work on Python. Also many new versions also came. I had worked on Java 8.
I want to become regain confidence in Java. What are the ways?   Reading Head First book on Java would not be the recommended way in my case since I am not starting from zero and scratch. Is that right ? Or may be read a little advanced book like "Effective Java". Or some other ways instead of reading books like these.  What should be my approach ? Thanks
 
MyExamCloud Software Support
Posts: 753
3
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My recommendation for regaining confidence in Java is to start by updating your skills in the latest changes using books or online tutorials from Oracle. Since you have previously worked in Java up until version 8, it is important to understand the different changes that have occurred since then. After that, focus on building your Java programming skills in the latest changes, such as module programming in Java and coding in JPMS through both top-down and bottom-up approaches.

It is also important to familiarize yourself with the changes related to Class Design, including Sealed classes, Records, and Pattern matching. These changes can be found in the latest versions of Java. You can see the full list of changes in each version on the Oracle documentation website.

Here are the links to the changes in the latest versions of Java:
https://docs.oracle.com/en/java/javase/21/language/java-language-changes.html#GUID-6459681C-6881-45D8-B0DB-395D1BD6DB9B
https://docs.oracle.com/en/java/javase/23/language/java-language-changes.html#GUID-6459681C-6881-45D8-B0DB-395D1BD6DB9B
 
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you'll find that it's like riding a bicycle. Just find some Java code and play with it.

If you're coming in after a long hiatus, there are 2 things that will be unfamiliar. First, improvements in the language, and second, support in the infrastructure.

Since Java is backwards-compatible, its not actually essential that you be familiar with stuff like lambdas, streams, improved switch/case and so forth. You can still write code the way you are used to and it will run, even if the ""with it" crowd may smile at you. Contrariwise, if you get code with these new features that someone else developed, it's a relatively small addition, so you can look it up. Also, I got my kickstart on lambdas from the fact that the IntelliJ IDE in the Android developer kit would volunteer to convert code, so I got to see it applied to stuff I already knew about. Of course, it's also willing to convert my Java code to Kotlin.

In infrastructure, the two biggest things I can think of in the last few years are Oracles's offloading of JEE and Spring Boot.

JEE has moved from the "javax" package tree to the "jakarta" package tree, but for the most part only the package name changed (and some new methods got added to the classes). Note, however that not EVERY "javax" package is part of JEE so you cannot just do a wholesale package name change. Then again, there are tools that can help with that.

Spring Boot is another game changer. At its heart, it's simply leveraging the Spring Framework to make it easy to create all-in one applications that contain a built-in webapp server and webapp. Such applications are easy to deploy and especially to run in container environments. Although they also do well for stand-alone OS/GUI-independent desktop apps. A good example is my recipe manager app at http://10.0.1.26:3001/mtsinc7/gourmetj-springboot

Spring Boot requires knowledge of the spring Framework, and one good introduction to that is Spring in Action. If you're not familiar, spring is an Inversion of Control framework that provides basic IoC injection service supplemented by a wide variety of helpful modules, such as the Spring JPA module my recipe app uses to talk the the database. You can generate a prototype Spring boot app online and there's a good intro at https://spring.io/guides/gs/spring-boot .
 
Marshal
Posts: 8960
646
Mac OS X Spring VI Editor BSD Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To be honest, I don't think someone invented a better way to gain / regain confidence other than just by actually doing. Some may say doing certificates may help to familiarise with new concepts introduced to language over the years/versions, yes, to some extent, but then comes practical usage of new features, and then again, I don't know how else to learn if not actually do it.

Many companies are still on Java 8 I believe (my subjective guess), so think you are not that behind in that sense. I use jdk21, but I am far away from knowing (competently) or using all features that were introduced, I feel I gradually learn them as coding problems come along and I look for more elegant ways to approach them. That's exactly what I meant "by doing".

Other than that, read Java forums here (and try to contribute answering others questions), from time to time you'd see suggestions how to improve some OP's code, and there you likely see those "newer / better ways" that arise from practical use cases.

Now that someone mentioned Sealed classes, that's not something I've personally used in Java yet - you see, as I write this post, at the same time reading about them and trying to play around to get a better sense what exactly they are and how to use them.
 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd like to note that I do NOT recommend doing new development using Java 8. Go for at least Java 11, which is the next-highest Long-Term Support (LTS) version. Between Java 8 and 11 modules were introduced and there were serious and disruptive changes in introspection.  I learned that the hard way when trying to upgrade the JavaRanch Jforum server code.

Actually, I think that the OpenJDK versions on recent editions of Linux are Java 17 and Java 21, and not user if 11 is still an option.

Java 8 is undoubtedly in use in production in a lot of shops, just as Oracle had their clients hung up for years on something like Java 4, but again, for new work, start high and you won't have to convert in a panic when Java 8 goes full End Of Life.
 
Sheriff
Posts: 28323
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Liutauras Vilda wrote:Now that someone mentioned Sealed classes, that's not something I've personally used in Java yet - you see, as I write this post, at the same time reading about them and trying to play around to get a better sense what exactly they are and how to use them.


I made some of the classes in my hobby app into sealed classes, just because it's my plan to try out new Java features as they arrive. So they're sealed and have a few implementations. But now what? In my case it's not like other people are going to build rogue subclasses which shouldn't be subclasses.

And when you read about sealed classes, basically the first thing you read about is how it simplifies using "instanceof" to work with the various sealed subclasses. I don't have any of that code because all of the logic which works differently for different subclasses is located in those subclasses, using inheritance. And basically that's the last thing you read about.

Okay, I'm probably oversimplifying as usual, but my opinion about sealed classes is "Meh".
 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd forgotten about sealed classes. Never tried them.

However, as someone who has created commercially-marketed and open-source software, I can see its utility.

I'm someone who's constantly paranoid about how to handle inputs that are outside the expected range and use of logic in unexpected ways. We've had, for example, literally years of grief because peope needed a Base64 encoder and the only ready-made one they could find was in an undocumented method of a proprietary Sun class which eventually went away.

So the modularization and sealing features can help make components more truly "black box". Although "sealed" is probably more accurately described as "restricted inheritance".
 
Monica Shiralkar
Ranch Hand
Posts: 2949
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jhonson Fernando wrote:
Here are the links to the changes in the latest versions of Java:
https://docs.oracle.com/en/java/javase/21/language/java-language-changes.html#GUID-6459681C-6881-45D8-B0DB-395D1BD6DB9B
https://docs.oracle.com/en/java/javase/23/language/java-language-changes.html#GUID-6459681C-6881-45D8-B0DB-395D1BD6DB9B



Thanks. That is a good reference.

Tim Holloway wrote:
I think you'll find that it's like riding a bicycle. Just find some Java code and play with it.



Thanks. Yes, I realize that it is about picking up riding bicycle after a gap which should not be that difficult since one had ridden a bicycle in the past for long.

Tim Holloway wrote:
Spring Boot is another game changer.



Yes, I have been away just since around 5 years. Sprint boot had come way earlier than that  so had worked on it.

Tim Holloway wrote:
I'd like to note that I do NOT recommend doing new development using Java 8. Go for at least Java 11, which is the next-highest Long-Term Support (LTS) version. Between Java 8 and 11 modules were introduced and there were serious and disruptive changes in introspection.  I learned that the hard way when trying to upgrade the JavaRanch Jforum server code.


What about using the latest version on my personal laptop for practice, which is Java 23?


Liutauras Vilda wrote:
To be honest, I don't think someone invented a better way to gain / regain confidence other than just by actually doing.



True. Thanks.

Liutauras Vilda wrote:
read Java forums here (and try to contribute answering others questions)



yes, but most of the times the questions look tough and answering questions looks daunting task


Paul Clapham wrote:
I made some of the classes in my hobby app into sealed classes, just because it's my plan to try out new Java features as they arrive


 
Thanks. Thats a good way, I realize.


 
Bartender
Posts: 5558
213
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For an even completer overview of the changes from java 0 to java 23, see Rob Spoor's excellent overview: changes
 
Monica Shiralkar
Ranch Hand
Posts: 2949
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:
I made some of the classes in my hobby app into sealed classes, just because it's my plan to try out new Java features as they arrive. So they're sealed and have a few implementations. But now what? In my case it's not like other people are going to build rogue subclasses which shouldn't be subclasses.



Creating hobby app and trying new features seems to be a great way. Could you please recommend that for a basic hobby app using java what all technologies one can use to begin with. I am thinking that hobby app can be something like shopping cart, then one other than core java can use Spring boot and web services (REST/Grafana). When all one as to try are new features of core java in a hobby app then one will still have to use web like sprint boot to make it an application otherwise how will someone make a hobby application using just core java. Is it so?
 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm note sure I understood that last part. If you are talking webapps/Spring Boot, it's not "just java", it's "just" (core) Java + JEE.

My Recipe Manager app is a "hobby app"", although it's also my primary repository for recipes I've collected, so it's commercial grade. Its purpose first and foremost is to store, edit, and display recipes, including ingredients, instructions, and so forth. However, it has a feeble attempt at shopping support as well, since you can collect recipes and it will assemble a shopping list for ingredient, including the idea that some might not need to be bought since you already have a can of beans in your pantry, for example. The list is organized by ingredient type to make it easier to grab related ingredients all at once instead of zapping randomly around store aisles.

One of my hobby apps for Android was a pure shopping app, and it supported a discrete user-maintained list of stores, and attaches items to aisle number for each store. It wasn't really all that great because not only did you have to manually maintain that information, including editing it all when a store re-arranged its layout, but often stores in the same chain may have different floorplans. So organizing by product type has proven better for me. I didn't think it up, but merely worked on the original concept from the Python app I engineered from.

The recipe app, incidentally works off Spring Boot, JavaServerfaces/IceFaces, Spring Web, Spring JPA, and several other cool toys that I can't imediately remember.
 
Monica Shiralkar
Ranch Hand
Posts: 2949
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:I'm note sure I understood that last part. If you are talking webapps/Spring Boot, it's not "just java", it's "just" (core) Java + JEE.


Yes, thanks.

Regarding sample app, I am thinking that a very basic sample application I can make for practicing some new features (new to me), like from console call the java program and it will read some data from a file on local and print. Later, I can build using Sprint Boot, Core Java and web services. I plan to learn Grafana too so may be use it instead of REST.
 
See ya later boys, I think I'm in love. Oh wait, she's just a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic