jugLviv

Meta


Share on:


jugLviv Leader, CTO @Software Service&Innovation https://software-innovation.ch/

Roadmap for java beginners

Andriy AndrunevchynAndriy Andrunevchyn

In this article, I’ll try to provide a step-by-step tutorial for beginners. For those who know nothing about Java and the required environment or even about software development in general.[/ecko_annotated]

So, let’s begin.
For now, java is the most popular in the world. It means you made a good choice :). It could be a bit difficult to start studying Java alone without any help that’s why I decided to prepare this roadmap.

I’ll split my article into a few logical parts like basic knowledge, required tools, databases, etc

First steps

  1. What is JDK and why do we need it?

    JDK stands for Java Development Kit. In a few words, JDK translates Java language commands (your program) to computer instructions.
    You can download the latest JDK here. Just download and install. Follow official instructions. Now you are ready to write and run a simple Java app. Just don’t forget to check if your JDK works properly. Open the command line and execute the command

    java -version

    if everything is fine you will see the Java version in the console. By good old tradition, the first app should be called HelloWorld. Don’t spend your time on it and download the app here. Run the command line in the same folder as the HelloWorld app and execute the following command

    javac HelloWorld.java

    .JDK will compile the app and create a new file HelloWorld.class – computer language version of the java app. Now you are ready to run our example. Execute the command

    java HelloWorld

    in the console and you will see this response

    Hello, World

    Let’s postpone an explanation of how this app works just remember the following – you should compile each project and only then run it.

  2. Simplest java app

    HelloWorld is the simplest Java app and it consists of one class. Class is a logical unit in Java. In real life, a project could contain thousands of classes.

    package com.devua.article;
    import java.util.Date;
    
    public class HelloWorld {
        public static void main(String[] args) {
            System.out.println("Hello, World");
        }
    }

    The first line is a declaration of the package. Package is not mandatory but it’s good practice. Then we declare – import – the whole path to each other class which we need for our app. If we don’t need other classes we don’t import anything (We don’t use Date class here, so this import is not needed). Then we declare class itself. Hence, the Java app is a set of classes from one to infinity. Cause apps can grow all the time we group classes in packages from the start. I will not explain to you how to write the code inside the classes, it takes a long time to do this and there are many good books on that subject. In Ukraine, we usually recommend this one: Bruce Eckel – Thinking in Java but you can take any other book for beginners. Also, I would recommend these two books: Jeanne Boyarsky and Scott Selikoff – OCA / OCP Java SE 8 Programmer Certification Kit. It’s shorter and cleaner so you will learn faster, especially if you have some elementary level in programming. Also, if you start with “Thinking In Java” you can skip the GUI chapter without any harm. Even I would recommend you to stop reading before chapter about I/O then take a few weeks to practice and only after that read the rest of the book.

Above I explained really basic things. I recommend you now spend a few weeks reading some books for beginners and coding each practice task from that book.

Now when you get some information about language itself and how to run a simple app I’ll describe more specific stuff.

Tools

  1. IDE

    It’s quite usual for Java apps to consist of many classes so it would be difficult to manage the whole project in a file manager. Also, if you write code in a plain text editor it’s quite easy to make mistakes: any kind of typo, misusing Java language command, lost parenthesis, etc. So, for real work, everybody uses IDE (integrated development environment) – an application that assists you during the development process. The most popular IDEs in the Java world are Eclipse, IntelliJ IDEA, and NetBeans. I prefer Eclipse, but you can try all of them. Just download, install, create a new project, create a new class with the name HelloWorld, copy content from the file above, and finally run. It will allow you to decide which one suits you the best. IDE will not do your job but at least save you from stupid mistakes.

  2. Build tools

    As I mentioned above java project could contain many classes also it could contain dozens of third-party libraries and hundreds of configuration files. It is possible to manage everything manually but it’s much easier to use specific tools called – build tools. The oldest one is Ant, the most popular is Maven and the newest is Gradle. All these tools allow you to control and manage middle-size and big projects. You don’t need them for one-class practice tasks but if you would like to develop some pet project or just successfully pass a job interview it’s better to spend some time reading docs about them and creating test projects with Maven and Gradle.

  3. Version control systems (VCS)

    When you start to develop more complex projects you would like to check the history of changes from time to time, perhaps roll back some changes and revert files to the previous state. If you are not alone on the project it is quite nice to save the project on a shared folder and trace changes of each other. For such purposes, we use version control systems. Nowadays the most popular VCS is GIT. There is no need to set up this stuff on the local server, you can use a lot of free services online like GitHub, Bitbucket, Assembla, etc. Again, it’s not mandatory to use VCS for test or pet projects but it’s good practice and such experience would be a big plus on a job interview.

Career path

Now You read a really short list of required knowledge and standard tools but you should understand it’s quite far from real tasks in Java development.
There are different types of Java apps and developers in those areas have slightly different sets of skills. You can start working as:

  1. Android developer

    Honestly, I would say it’s not even Java developer but you will need knowledge of Java there. Just to feel the spirit of Android development you could set up Android Studio, run emulators, download, and run some “hello world” for Android. I would say it’s quite a different “world” compared to a plain Java app.

  2. Embedded developer

    Low-level development for different kinds of devices. Strong knowledge of core Java is a must-have. You will work a lot with device specifications. It would be useful to know how hardware and communication protocols work.

  3. Desktop java

    You should know core Java, especially concurrency and you will have to learn Swing or SWT for user interface development. It’s not so popular but still, there are some markets behind.

  4. Enterprise software developer

    Pay attention – enterprise software does not always mean enterprise Java. It’s the most widespread direction in Java. Enterprise software is computer software used to satisfy the needs of an organization.

Enterprise software

Most probably you will start working on an enterprise project. There are two different approaches to building enterprise software with Java:

  1. based on Java standard technologies i.e. JSF, EJB, etc.
  2. based on Spring (or any other lightweight framework) and separated UI.

Nowadays the second way is more popular. The typical structure of such a project is
frontend -> backend -> DB

As usual, the frontend is written in some modern JS framework, and quite often java developers who are working mostly on the backend do nothing there. Communication between frontend and backend could be implemented in different ways for example REST services. REST service is an exposed URL, when the frontend calls this URL backend executes some action or returns some data. Such an approach allows for the separation of the front end and back end. Let’s assume you as a Java developer will work only on the backend. I explained above how to compile and run a plain Java app. In the case of enterprise software, it works in a bit different way. After compilation, you should build a deployment package (file with extension .war) and run it on web servers like Tomcat, Jetty, etc.
More details on how to create a web project and deploy it on Tomcat can be found here or here

Databases

Most applications store results in DB so you should have at least general knowledge about communication with DB. The core of DB operation in Java is JDBC API. The JDBC API is a Java API that can access any kind of tabular data, especially data stored in a Relational Database. JDBC overview.
There are a few different approaches that were implemented over JDBC: JPA, JDO, or something like JOOQ, where you can work with DB without using JDBC API directly but in fact, it’s recommended to try working with JDBC API at the beginning.
One more interesting thing you should know about DB is NoSQL solutions which are quite popular today so don’t forget to read about it and learn the difference between SQL and NoSQL solutions.

Not The End

It’s quite difficult to cover all the stuff which are required in the daily job of a Java developer so I tried just to show you the right direction. Sometimes in articles, I simplified things so don’t hesitate to double-check and read more. Studying things one by one in logical order allows you to develop skills properly. Don’t jump immediately on omnipresent frameworks like Spring. I would rather recommend you read something about software design principles like DRY, KISS, YAGNI, and SOLID. Pay attention to naming and code conventions in general. Don’t be greedy – use full and clear names for variables and methods, put parenthesis everywhere, avoid ternary and unary operators if you can, and do not write long classes and methods. Any newcomer should understand your code without comments and docs. Be clear and consistent in your code.
I’m pretty sure if you read a bit about everything I wrote and run a few test projects it will give you a good chance to obtain a Java trainee/junior position.

jugLviv Leader, CTO @Software Service&Innovation https://software-innovation.ch/