- Local Setup
- Archetype – A New Project
- Basics
- Building a Java Project
- Coding Conventions
- Configuration
- Documentation
- Object Oriented Concepts – Classes, Enums, Interfaces
- Other
Learn the basics of Java programming. Unlike the category listing on the left side of the page, which is alphabetized, this page contains list of posts that you may want to review as your Java learning progresses in a possible ordering.
Although unit testing is not first in this list, it is quite important as you learn and grow. For more about why many of these posts include unit testing and work in small loops, please see: Test Driven Development (TDD)
Local Setup
Setup that may be needed on your local machine (desktop, or laptop) in order to start coding in Java:
Archetype – A New Project
Creating a new Java project from a template (archetype):
Basics
Packages
Groupings / folders of Java files:
Imports
Using other Java classes or methods in your Java file:
Variables
Java fields or local variable syntax / conventions:
Methods
Syntax / conventions for Java functions / methods:
Primitives
Java primitives, such as booleans, ints, longs, doubles, floats:
Conditionals
Conditional logic structures:
Looping
Executing a given block of code multiple times:
Error / Resource Handling
What to do when unexpected / undesired scenarios occur? How do we handle resources that need to be closed even when errors occur?
Collections
Groups of related objects in a collection / array together.
Unit Testing
JUnit is one framework for unit testing Java code.
Strings
Java Strings are immutable; once created they cannot be changed. Any changes to a Java String requires a new Java String to be created and the old String hangs around in memory until garbage collection eventually occurs. Therefore, Strings have special handling in Java to avoid performance, memory and other pitfalls.
Building a Java Project
Maven
Maven is often used to build Java projects. In Maven, we do not store dependencies with the Java code. Instead, there are Maven repositories which house these artifacts and we download them to a local Maven repository cache as they are needed.
In Maven, plugins are configured in an XML file (pom.xml) to say how we want the build to behave.
Ant
Ant is a lower level build approach than Maven, meaning that less of the build work is done for you out of the box. There may be one-off situations in which we need do dip down and use an Ant task within a higher-level build. However, I would recommend using a higher level (more abstract) approach to building Java projects in general.
For example, an Ant build doesn’t have any dependency download mechanism build into the framework. Therefore, in code bases I have worked with that used Ant for the build, they often fell into the pitfall of storing dependencies in the same repository (repo) as the source code. This can slow down nearly all interactions with that code repo for even simple things, like asking if your local git clone is up-to-date with the remote git repo.
Coding Conventions
Approaches that have evolved over time, rather than something built into the syntax of Java code.
Note: If this section is empty, it may be due to these posts also being included in other sections of this page. If so, see Coding Conventions page for a full listing.
Configuration
Ways in which configuration can be passed into a Java application.
Documentation
We need to document designs and details about our code, so that our teammates, our future selves, or those consuming our project as a dependency can understand how to interact with the code successfully.
Object Oriented Concepts – Classes, Enums, Interfaces
Java is an object oriented language. Java classes, enums (enumerations) and interfaces represent objects in our application’s domain:
Other
Other Java posts that did not fall into the categories above, if any: