When starting out as a Java developer often you want to just get started and pointed in the right direction.
There are some very popular frameworks and libraries out there that I think you should take the time to learn because you’ll learn some very important underlying concepts and principles.
Here I present to you,
Java Technologies for Beginners
In this list I’ll explore with you some of the most important things to learn when starting out as a Java developer.
I’ll start with Java itself and explain how to really learn and understand what it’s truly about.
Next we’ll dive into the Spring Framework and explore what it’s about.
You’ll need to store all that data somewhere, this is where we’ll explore NoSQL data stores.
Lastly, you can kick up you game and write solid working code with TDD.
1. Java on the JVM
If you’re starting out and you think you know Java, trust me you don’t!
I used to believe I knew Java well because I could create a basic CRUD application with some cool features.
Now when I go back to that code to find how disgusted at how poorly written this program is! That was 8 months ago!
If you think you know Java well, you don’t and you really should!
Java offers many frameworks under its belt.
Learning Java itself is free, you don’t have to buy any books (just yet) and you shouldn’t wait until your professor starts lecturing Java to understand it.
You can learn by yourself from the Oracle Offical JavaSE docs.
All you need is the time and patience to really sift through most to all of it and really understand what Java is really about!
The most fundamental and useful parts I think you should know as a beginner are of course dealing with Collections, Generics, JDBC, and a few others.
First start with the Learning the Java Language and let this be the true test to yourself on how well you actually know Java in the first place!
Essential Java Classes is where you’ll learn some of the most useful parts of the Java API; then you should move on to the next parts.
Build an application
To really learn something you do need to practice, practice and practice some more to get good at it.
You can’t say to me that you just read about the switch statement and you’ll remember it when you write your first app, the chances are you won’t!
Think of an app idea, maybe it could be a simple Register and Login, CRUD application. Just build something!
When you force yourself to try to implement it, you’ll be shocked on how you still don’t know and then having to re-lookup how to do something.
I know because I made the same mistakes learning Java!
What about Java 9?
“Have you head of Java 9?” You may ask.
“Shouldn’t I learn that instead?” Well, no.
Java 8 came out in 2014.
Every three years a new version of Java is release. At time of writing this article, Java 9 isn’t officially released yet.
Every release adds on new features, in Java 9 is the new module system and some other features.
But don’t worry about that yet! You probably won’t be implementing the features of Java 9 just yet, start simple and start small!
2. Java Concepts and Principles
Java isn’t only some libraries and syntax, oh no-no!
On principle of writing good code and manageable systems is to follow the best practices described in this section.
What are some of the best practices you might ask?
Design patterns are one of them!
Have you heard of the Gang of Four? Ruthless vigilant software developers who set out on a request to discover all 23 design patterns who was once lost to many!
They wrote a book called Design Patterns: Elements of Reusable Object-Orientated Software, check it out on Amazon
Now that you know a little bit about what Design Patterns are, I’ll go in-depth on how to learn them.
Scratch that! You don’t really know what they are!
So what are they?
Design Patterns are basically the known, thought-out and truly tested ways of designing a system or parts of a system.
A design pattern is an existing design idea or “pattern” that you can implement to make your software function in a certain way.
Imagine you had a burger joint and you needed a program to choose items on the menu and form a complete burger package and the cost of that burger.
Think about this for a moment, how would you implement it? How would you design it?
Spoiler alert! You don’t have to!
There is a design pattern for that!
Well you’d use the Builder pattern to construct a meal.
This is just one of 23 awesome patterns you can use to solve these architectural problems. You just need to take the time to learn them.
By some of the experts, namely The Gang of Four who authored the book, Design Patterns: Elements of Reusable Object-Oriented Software, isn’t as fun way to read as another book I would recommend.
I would suggest you read Head First Design Patterns first as it offers an easier and more humorous approach to learning design patterns.
The four pillars of Java
If you go into a job interview you will most likely be asked about four pillars of Java.
What would you say?
Well, do you know them?
If you don’t, you should learn them!
The four pillars of Java are what make up the Object-orientated programming paradigm.
In order built robust systems you should know these four pillars really well.
They aren’t that difficult to learn, not as much as Design Patterns, so I’d suggest you start here first!
Side note: Look at Java Interview Questions.
Remember when you wrote code that connects to the database, looks up the username and does all the login in your single Login Button?
If you still practice that approach, stop, stop now and run as far as you can!
Or come back to apply logic Abstraction to it.
You need to separate and abstract login as much as possible so you can write modular code that’s reusable.
Man, live by that statement!
Instead of directly using JDBC to connect to your data base for the login button, maybe your first step is to move that database connectivity to a separate class.
You can call this class LoginJdbc, now that’s just a simple name for now, I’m sure you can do better!
This LoginJdbc can have methods to find a user by there username or id and return a new User object.
Public methods like, findById() or findByUsername() and so on, will be used.
Even that isn’t perfect, and I’ll explain how to better it, but for now it will do!
Imagine this LoginJdbc class has some fields of its own.
For example an int field is used as an Id generator.
Every time LoginJdbc’s add() methods are called, the Id is incremented for the Users Id.
You may have guessed this Id is a private field so no one else from outside can touch it.
This concept is called encapsulation.
Think of Encapsulation as privacy. We all desire privacy in some form or another.
An analogy would be a coffee shop, who pays taxes. Yes, they may path their taxes every month, quarter or yearly but calculating the taxes stays inside of the coffee shop.
It’s the privacy the shop has. They certainly don’t want to share all the details on how much money they have made on X day and so one.
Those details should be encapsulated inside the class, hence the word encapsulation.
You may not care that the coffee shop made X sales this day, but you might wonder how many what’s on their menu.
The use of Getters and Setters is then used to get and set values inside of the instance class.
Although a getter can return the value as a whole (like raw coffee beans), maybe it should be packaged in a bag and sealed before returned to the user.
Having this ability n a method such as getPackagedCoffeeBeans() is useful for this case.
Remember when I promised a better way at abstraction with LoginJdbc?
Well here I am!
What is inheritance?
Inheritance comes in multiple forms, no? Ways! You can inherit in a few ways.
Well there are only two: implementing an interface or extending a class.
Java for now can only extend one class, but can implement as many interfaces as you’d like.
Well what does that mean?
There are many tips and tricks that you can exploit with Design Patterns that will show you useful use cases for inheritance.
The good old say of “Program to an interface not an implementation”.
Well what does that mean?
Create an interface first and then create the implementation.
You can take advantage of this concept because an interface is like a plan for an object and the implementation can easily be swapped out later if you choose to.
Polymorphism in Java is the ability to different form with states.
Polymorphism goes along with inheritance but essentially is the ability to add functionality from a parent class in a child class.
A parent class would be the ability to:
doWork(), doSleep(), doEat(), ...
The child class would extend that ability and additionally have methods like:
So the Child class would have five methods in total, if it extends from the Parent class.
There is a wealth of proper explanations on the web for the 4 pillars of Java, best practises.
The Java documentation does give this explanation really well.
3. Spring Framework
So you’ve probably heart of this think called JavaEE. What is it? How do I use it?
Java Enterprise Edition is simply an extension to the Java Standard Edition platform. JavaEE offers many cool features for building enterprise java applications.
JavaEE is commonly known for the Web tier that it offers, but that’s not all.
The Spring Framework on the other hand is built on top on JavaSE and JavaEE and written by Java experts with many years in the field.
Spring really makes it easy to develop Java applications, covering almost the entire scope of Java enterprise applications.
If you want to build robust web apps, learn Spring.
if you want to make JDBC (Java Database Connectivity) persistence a breeze, learn Spring.
If you want a solid abstraction between dependencies, learn Spring.
Plus there is so much more to Spring! Spring itself is the core framework for Inversion of Control and Aspect-Orientated Programming.
Things like Spring-Web, Spring-Jdbc and so on are module components built around the core Spring framework
If you didn’t understand the topics I mentioned above, that’s fine. I know I certainly didn’t when I started and you can always learn, with time and patience.
Spring also supports other projects like,
Spring Data, which supports many popular databases and managing repositories that connect to databases,
Spring Security, add security to your application and implements a Security Filter Chain that authentication and authorize connectivity.
With all the fun features Spring offers, there comes configuration, and believe me, you don’t want to spend hour trying to figure out how to manually set up this configuration.
This is where Spring Boot comes in.
It scans you class path and looks for all the annotations, then auto configures your application on the fly with an opinionated configuration. Cool hey?
It will essentially get you up and running quickly to building an application and manages the configuration for you.
As a beginner you can’t really afford to not use a high level framework. You will spend too much time trying to figure out low-level stuff rather than actually building applications.
Spring is you friend as it simplifies Java development and makes it easier, but still gives you the freedom to configure yourself.
If you want to learn Spring and truly understand what it’s about, I would recommend: Spring in Action (4th Edition) by Craig Walls
4. NoSQL Databases
So you have probably played around with Relational-databases in school like Apache Derby or H2. There are many other embedded databases out there that you can checkout!
Yes sure you’ve probably grown a custom to designing “good” databases and so on! But what if I told you there is more than Relation-databases and connecting to them, queries and mapping objects wouldn’t be such a nightmare!
Types of NoSQL databases
Believe it or not there are a few flavors of NoSQL databases, being a delight for important use cases.
- Key-Value Store
- Document-based Store
- Column-based Store
- Graph-based Store
I won’t go into much detail about each but I will give a gist into what NoSQL databases are!
NoSQL stores are alternatives to Relational Databases like MySQL, PostgreSQL, which are two types you’ll like to be working with in your career as a software developer.
So what are they?
If you are coming from a relational world it can be difficult to understand at first what and how NoSQL stores work.
You can think of NoSQL databases as much more flexible and easier to use and manipulate, faster too, instead of writing raw SQL queries.
Instead of storing data in a tabular form, you can store in a document that looks much like the Java object itself (Document-based).
Or maybe you want to relate objects together, much like friends, you could use Graph Database.
One of the most popular NoSQL databases at the moment is MongoDB, good for Java and perfect for Node.js based applications.
Because of its super fast performance and low complexity, MongoDB is a perfect candidate.
You can learn more about MongoDB here.
Hibernate isn’t for NoSQL databases, but makes relational-databases much easier!
Do you remember having to write a Jdbc code to connect to the database, use SQL queries to select data and then map those values into your class?
I had to do this to many time! I worked on a project in high school that had 15 tables and it often was a nightmare to work with!
This is where Hibernate comes in!
Instead of writing all that boilerplate code, what you’ll do instead is map all you fields in you Java object to the database.
That sounds simple enough, how does it work?
So imagine you have a User class, with fields like Id, firstName, lastName, etc. Then you can tell Hibernate to make id your primary key with a Java annotation on top of the field, like so:
@Id private long id; //your new primary key
Then Hibernate will do the magic under the hood like writing the SQL queries for you.
This is called Object-Relation Mapping.
What’s best is Spring integrates nicely with Hibernate and other ORM frameworks.
5. Embrace TDD
This step is perceived to be complex and difficult to implement, well at least it was for me.
It doesn’t have to be, TDD is quite simple to understand.
Test-Driven-Development (TDD) is a programming style you have probably heard of, and you’ll probably stumble upon the debate on whether you should embrace it.
Well at least it’s a skill you’ll have and know if you take the time to learn TDD.
What is it?
In layman’s terms, TDD is the process of writing a test first and then coding functionality to satisfy that test.
A test is a unit that check/asserts the desired outcome of your method.
So what does that mean?
Well really, you’re ensuring that you code is working as expected every time you execute your code to ensure it is always working.
Unit testing at its heart is the lowest level of testing you can do, it’s testing units of your code to ensure the desired outcome.
A group of related Unit tests is called a Suite.
For example: A Suite can ensure that your login functionality works properly.
All the nuts and bolts like, ensuring the login authentication works properly with an incorrect password with test data (mock data).
Unit testing is ensure that you code passes on what you expect to happen.
A process could be to:
- Write your test.
- Watch it fail.
- Code to pass.
- Refactor your code.
TDD is ultimately ensuring that you are writing code that works a every time you run it and it can handle anything you can throw at it!
Learn more and get yourself started with JUnit, a Unit testing framework for Java.
Well, that’s it. Just three short and sweet, my 5 things you should focus on.
If you’re a beginner, hopefully this will set you on the right path in becoming a successful Java Developer.
I know it may be tempting to look at other into other frameworks and learn a bit of everything, but that isn’t what you should focus on.
Yes, in the future you can, once you have a solid ground on these things and then I will encourage you to go and explore more into other frameworks.
Remember to niche down and stay focused on one thing at a time and eventually you build up a wealth of knowledge!
if you want to get a feel of what you don’t know, just look at this page.
Yes it can serve as a guide to patch up the things you don’t know and quickly learn them, but it a good starting point to that truly separates amateurs from professionals.
The ever popular Joel Test has been around since the year 2000, yes it’s been that long!
The Joel test evaluates a companies competency for developing good software and will be a determining factor whether you choose to work there.