DEV Community

Cover image for Common mistakes all Java learners make and how to avoid them
John Selawsky
John Selawsky

Posted on

Common mistakes all Java learners make and how to avoid them

Are you new to coding?

Whether you’re learning Java for fun or as a means to achieve your business goals, one thing is certain, you’ll have many questions about it.

As someone who has also experienced being a beginner to programming, I will try and give some of my views on the best way to learn Java, and how to avoid the most common mistakes.

Platform independence is one of the reasons for Java’s popularity i.e. programs can run on several different types of computers; if your computer has a Java Runtime Environment (JRE) installed, it can run a Java program.

  • Creating mobile apps for Android
  • Java-applications; a vivid example of this is Google’s Gmail
  • Software tools; e.g. Eclipse, IntelliJ, IDEA, and NetBeans IDE
  • Scientific applications

So whether you are interested in creating games, mobile apps, desktop apps, or web apps, Java is able to work in all these environments.

However, there are some extremely common pitfalls that I see people make way too often while learning Java.

So, if you can avoid at least some of them, my advice has done the job.

Error 1. Start without learning the basic concepts of Java first

Even before you start learning Java, you need to understand the basic concepts that support all programming languages. Don’t let the new concept scare you away. When learning a coding language, you will naturally need to move quickly on to the details so that you can start creating things. However, it is important to keep the fundamentals of programming in mind.

The only way to develop a good understanding of coding is to first create a basic understanding of how and why programming does certain things. Failure to understand the basics will limit your understanding of the future.

For example, you don’t understand why you need interfaces and abstract classes, but you start programming components. This won’t lead to anything but more chaos, lack of knowledge, and disappointment. Copying the working code without understanding how it works is a reliable way to fill in your knowledge gaps.

Error 2. Learning only theory

Children don’t learn to ride a bicycle or tie ties by watching videos on YouTube or reading books. The only way they’ve ever understood how to do that is by actually doing it over and over again. Coding works almost the same way.

With each new topic, the sooner you start playing with the code, the faster you’ll learn the concepts. Even if you flip through a whole chapter of reading and a topic, like loops, seems simple — so simple even a monkey can do it — you still scratch your head the first time you are implementing the code.

Tip: Create a project as you review the material. The best starting point is often a personal project.

Error 3. Let the problems in the code accumulate infinitely

The best developers are skeptics. They constantly check if their code really does what they think it should do. This means that before they move on to the next stage, they take a few minutes to double-check and triple-check.

Many “newbies” make endless changes to their code and expect it to work miraculously right away. The problem here is that it puts one problem on top of another, and this is when it becomes difficult to understand what went wrong.

Keep in mind though, that all this article is just the best practice.

Sometimes you have just a Nokia feature (J2ME) phone, some paper to write the code by pen and still go to work for an MIT startup at 19. Right, Elvis Chidera?

It is much easier to unravel an application with one small problem than to fix an application with 10 connected problems. So if you are wanting to go up to the developer level, be a skeptic.

In recent years, it has become easier and easier to learn programming with some online courses and task collections with code auto controllers. Below I will give you some links to these resources.

Error 4. Learn to encode in isolation, never asking for help.

The best programmers embrace their community.

Most cities have meetups (including Java programming). There are also amazing online communities such as Reddit and StackOverflow.

Beginners are often afraid to attend events or comment on open online communities. Impostor syndrome exists. But if you’re a beginner, you must know that the rest of the community of programmers want to raise you up as a developer. This is the approach that most experienced Java developers use. They work very closely together.

Tip: Use the 20-minute rule. Before you ask for help, take at least 20 minutes to find out it for yourself. There is a high probability that the answer is already in front of you, and besides, the struggle makes you a better programmer in general.

Error 5. Becoming too emotional during the early stages

On your way to becoming a professional programmer, you will see many error messages appear. There will probably be a lot of them. It’s okay to spoil everything, as you need to come to terms with the fact that it’s fine to make mistakes.

Be aware that the appearance of an error message on the screen does not mean that you are a bad programmer; it simply means that you have entered the wrong character sequence in the text editor. This can be corrected by simply typing in the text editor!

Error 6. Not understanding the difference between the language and libraries

This is another area where beginners are often confused. You must learn to distinguish between standard libraries and language.

Some say modern programming is more about using libraries (e.g. look at Java libraries) than understanding the language. While libraries can be large, the language itself is often quite compact. Programming comes with learning how to find and use libraries that can help you do what you want in less time and without re-inventing the wheel.

Error 7. Program in any style, except Object-oriented programming (OOP)

OOP is not the most complex topic in the world but is extremely important (both to understand the principles and to put them into work).

When OOP principles are used, you will always understand the relationship between objects and mutual dependencies. When you need to change something, change it so that you know how it affects other objects. First of all, think about how the system works, what objects you need to create, where to place them, and so on. Then you can start writing code.

Conclusion and useful links.

If you can avoid these 7 errors, you should be able to learn Java much faster.

Here are some useful links to start the ball rolling (or continue rolling it in a more effective way).

Stack Overflow is a site where programmers can get free help with their code. If you are stuck and want to ask a question — try to find it first.

Personally, I feel like we have entered an Era where there is no longer need to ask questions on QA forums — everything was asked and answered before; so it’s now just a matter of proper phrasing to find it. Reddit is also a gold mine of knowledge (check out e.g. /r/learnprogramming/ & /r/learnjava/)

Then, there are many educational sites where you can find programming guides.

If you need just practice, go to Codewars and fight your way up. If you want a mixture of lessons and learning by doing — I recommend to check out CodeGym. 80% of the Java Core course is based on practice. It is very useful for Java students, from both beginners to confident users at senior intermediate level. This site is full of challenges to improve your skills every day. I think it has about 1000 problems per level.

You can also use CodeGym’s IDE in browser to solve them or the plugin for IntelliJ IDEA, the most popular Java IDE at the moment. An intelligent verification system checks your code and gives you a few recommendations if something goes wrong. CodeGym is divided into 40 levels. Each level includes about 15–30 coding jobs, 10–20 Java lectures, and motivational articles to cheer students up. And lastly: lectures here are extremely funny humorous. I liked reading them.

Whichever way you choose, whether it’s college or boot camp, the only barrier to success is your work ethic and confidence in the future.

Be prepared to fail many times and be patient with your progress. Becoming an expert requires hard work and time. And if any doubt ever clouds your mind, remember that every programmer has walked this road before you — none of them were any more destined to become a developer than you.

Was published on Git Connected.

Top comments (1)

Collapse
 
wrldwzrd89 profile image
Eric Ahnell

I made my own game engine in Java along with 30 games. Sheer persistence along these lines is how I did it. Don’t be discouraged, new Java coders!