Java Boot Camp

Boot Camp for developers interested to learn Java.

  1. Java
    1. What is Java?
    2. How do we develop Java Applications?
    3. Java Language Specification
      1. 🤔 Given that the specification is hard to read and understand, why should I care?
  2. Setup Environment (SDKMAN)
  3. Gradle and Maven
    1. Advantages of Gradle over Maven
    2. Install Gradle
  4. IDE (IntelliJ IDEA and VS Code)
  5. Create a project using Gradle
    1. Create Project
    2. Explore Project
  6. Hello World Application (from source to executable application)
    1. Gradle Task Dependency Tree
    2. Project Dependencies
    3. Package Project
  7. Extend your application capabilities (using third-party libraries)
    1. The Classpath
    2. Make a fat JAR
  8. Making Applications Portable (Containerisation using Docker)
    1. What is Docker?
    2. How does this work?
    3. More than just Containers
    4. Setup Docker
    5. Working with Docker
    6. Dockerize the Application
    7. Multi-Stage Docker Build
    8. Managing Docker Containers
  1. JShell
  2. Java single file execution
  3. Introduction to classes and methods
    1. Source and class files
    2. Methods
  4. Using existing functionality
  5. Introduction to variables and types
  6. Introduction to collections
    1. Arrays
    2. Lists
  7. Introduction to control-flow
    1. If-Else
    2. switch
    3. For loop
  8. Annotations
  1. Numbers and Strings (Variables and Scope)
    1. Puzzle (Time for a change)
    2. Puzzle (Long Division)
    3. Puzzle (It's Elementary)
    4. Puzzle (The Joy of Hex)
    5. Puzzle (Hello Whirled)
    6. Puzzle (Line Printer)
    7. Puzzle (huh?)
    8. Puzzle (String Cheese)
    9. Puzzle (Classy Fire)
    10. Puzzle (What's my class?)
    11. Puzzle (What's my class, Take 2)
    12. Mutable Strings
      1. Puzzle (No Pain, No Gain)
    13. Text blocks and multiline strings
    14. Primitive Types
    15. Signed and Unsigned Integrals
    16. Reference Types (the rest)
    17. Variables and their Values
  2. Stack and Heap
    1. OS Process Memory
    2. What goes in the Java Stack?
    3. What goes in the Java Heap?
    4. Variables without a value
    5. Can we have a reference variable without the equivalent object in the Java heap (null)?
      1. What happens if we try to call a method on a null object?
      2. What is NullPointerException?
    6. The new operator and the Java Heap
    7. Garbage Collection
    8. String or new String?
    9. What happens to a variable when it goes out of scope?
  3. Operators
    1. Puzzle (Tweedledum)
    2. Puzzle (Tweedledee)
    3. Puzzle (The Last Laugh)
    4. Puzzle (Oddity)
    5. Puzzle (Swap Meat)
    6. Puzzle (Escape Rout)
    7. Puzzle (A Big Delight in Every Byte)
    8. Puzzle (Inclement Increment)
  4. Mutable and Immutable
    1. The final keyword
  5. Casting
    1. Puzzle (Multicast)
  6. Autoboxing
    1. Autoboxing is an easy target for NullPointerException
  7. Enumerations
    1. Can we create an instance of an enum?
    2. Enums in Java can have methods
    3. Even enums have names too
    4. Enum's Ordinal
      1. Can we retrieve the enum through the ordinal?
    5. Enums in Java can have state
    6. Considerations before Persisting Enums
      1. Using the Enum's Ordinal as the unit of Persistence
      2. Using the Enum's Name as the unit of Persistence
      3. Using a specific property as the unit of Persistence
    7. Enums can extend functionality
  8. Packages, Imports and Static Imports
    1. Packages
      1. Organise Packages by Technology
      2. Organise Packages by Feature
      3. Organise Packages by Feature and Technology (Hybrid)
    2. Imports
      1. Same class name in different packages
    3. Static Imports
  9. Date Time API
  10. Internationalization
  11. Miscellaneous
  1. Anatomy of a Java class
    1. Terms
  2. Classes, methods and properties (static no OOP)
    1. Is void a type?
    2. Properties (static no OOP)
  3. How can we test functionality that makes use of static methods?
    1. What does static mean?
    2. How do static fields behave?
  4. Access control
    1. Classes access modifiers table
    2. Class members access modifiers table
    3. Which access modifier should I pick?
  5. Simple objects
    1. Create a simple box object
    2. Add open and close functionality to the box
    3. Is boolean the right choice?
      1. Are there any other advantages, besides readability?
      2. Why is the enum declared private?
    4. What does 'object state' mean?
    5. How do instance methods interact with the object's state?
    6. Adding more state to our object
    7. How can we prevent the use of invalid labels?
      1. Why is the isValidLabel() method private and static?
  6. What does this means?
    1. Can we access static methods using the this keyword?
    2. How does the this keyword works with inner anonymous classes?
    3. 🤔 How does this works with nested inner anonymous classes?
  7. Constructors
    1. How many constructors can a class have?
    2. Can one constructor call another constructor in the same class?
    3. What are static factory methods?
    4. Should utilities classes, like the Math class, have a constructor?
    5. Can we call methods from within a constructor?
  8. Mutable and immutable
    1. How can we create immutable objects?
    2. How does mutability works when we have nested objects?
  9. Inheritance
    1. Extending the Box functionality (creating and evolving the LightBox class step by step)
    2. Can we add items to a box if the box is not open?
    3. 🤔 Can we design our classes to automatically prevents the object from going into invalid state (finite state machine)?
    4. Create the HeavyBox (complete example)
    5. How can a subclass invoke a method in the parent class (the super keyword)?
    6. Can we prevent a class from being extended (the final keyword)?
    7. Are constructors inherited?
    8. How do private constructor effect inheritance?
    9. Can a subclass invoke the constructor of a superclass (the super())?
    10. Can a constructor in a parent class call a method in a subclass?
    11. What happens when not all 'children' are 'parents'?
    12. Is inheritance evil and should be considered as an anti-pattern?
  10. Abstraction
    1. When a class must be abstract?
    2. Can final classes be abstract?
    3. Can abstract classes have private constructors?
  11. The Object class
    1. The toString() method
      1. Be careful with sensitive information
      2. Be careful with recursive toString() calls
    2. The equals() and hashCode() methods
      1. Be careful with recursive equals() (and hashCode()) calls
      2. Puzzle (Animal Farm)
    3. The getClass() method
      1. The getClass(), class and the equals() method
    4. 🤔 The wait(), notify() and notifyAll() methods
  1. Interfaces
    1. What is an interface?
    2. How is an interface different from a class?
    3. How can we use interfaces?
    4. Can we create an instance of an interface?
    5. Functional interface and lambda functions
      1. What is the relation between lambda and functional interfaces?
      2. What are the differences between lambda functions and inner anonymous classes?
    6. Can an interface extend another class or another interface?
    7. How many interfaces can a class implement?
    8. What happens if a class implements two interfaces that have the same abstract method?
    9. What's the purpose of an interface that has no abstract methods (marker interface)?
    10. What are default and static methods?
    11. What happens if a class implements two interfaces that have the same default methods?
    12. Can we use an interface just to define constants?
  2. Sorting (the Comparable and Comparator interfaces)
    1. How can we apply natural ordering to a custom class (the Comparable interface)?
    2. How does the compareTo() method works?
    3. What will happen if one of the properties used is null?
    4. Can we use multiple properties to determine natural ordering?
    5. How can we sort the Point or any other custom class (the Comparator interface)?
    6. Can we compare two integers by subtracting one from the other?
  3. The instanceof and type cast operators
    1. Is there a better approach than relying on instanceof and type cast operators (polymorphism)?
    2. Are there good examples of the instanceof and type cast operators?
    3. What is type upcasting and how is it different from type casting or type downcasting?
      1. Type Upcasting
      2. Type Downcasting
    4. Can we type cast null?
    5. Can we type cast primitive types?
  4. Inheritance and composition
    1. What is composition?
    2. Why is there a big push in favour of composition over inheritance?
    3. What are the disadvantages of composition?
  5. Overloading, overriding, and hiding
    1. Overriding
      1. Do we need to use the @Override annotation?
      2. Can we use the @Override annotation when overriding methods defined by an interface?
      3. Can we override a private method?
      4. Can we change the visibility of an overridden method?
      5. Can a parent class prevent a method from being overridden?
      6. Can we return something different when overriding methods?
      7. Can we override static methods?
    2. Overloading
      1. Does Java support return-type-based method overloading?
      2. Can we overload instance methods?
      3. What are the benefits of using method overloading?
      4. When should we use method overloading and when should we avoid it?
    3. Hiding
  6. Initialisation blocks, outer, inner and anonymous classes
    1. Initialisation block
    2. static initialisation block
    3. Outer class
    4. Inner instance class
    5. Inner static class
    6. Inner anonymous class
    7. Local class
  7. Annotations
    1. Project Lombok
  8. Generics
  9. Miscellaneous
    1. Objects have two words headers
    2. Records
    3. Others
  1. Definition
  2. Arrays
    1. Arrays Declaration
    2. Create Arrays
      1. Puzzle (ABC)
    3. Working with Arrays
    4. Read past the array's length
    5. Multidimensional Arrays
      1. Two dimensional array
      2. Irregular Arrays
    6. Arrays are reference types
    7. Arrays are always Mutable
    8. Defensive Copying
    9. Arrays of Objects
      1. Working title
    10. Sorting and Searching
    11. An Array of Characters Is Not a String
  3. Lists (Vector, ArrayList and LinkedList)
    1. Create Lists
    2. List Implementations
      1. Vector
      2. ArrayList
      3. LinkedList
      4. Which List to Use?
    3. Double Brace Initialization
    4. Mutable and Immutable Lists
  4. Set (HashSet, LinkedHashSet and TreeSet)
    1. Create Sets
    2. Set values MUST BE Immutable
    3. Types of Sets
      1. HashSet
      2. LinkedHashSet
      3. TreeSet
      4. Which Set to Use?
    4. Mutable and Immutable Sets
  5. Map (Hashtable, HashMap, LinkedHashMap and TreeMap)
    1. Create Maps
    2. Map Keys MUST BE Immutable
    3. Types of Maps
      1. Hashtable
      2. HashMap
      3. LinkedHashMap
      4. TreeMap
      5. Which Map to Use?
  6. Covariance and invariance
  7. Relation between Collections the Objects they contain
    1. List and the equals() method
    2. Hash based Collections and the equals() and hashCode() methods
  8. Queue and Stack
    1. Queues
    2. Stacks
  9. Java Collections Framework
  10. Google Guava (Collections)
  11. Miscellaneous
  1. Control Flow and Loops
    1. If (if/else) Control Flow Statement
      1. If Example
      2. If/else Example
      3. If/else-if/else Example
      4. Java Ternary Operator
    2. Switch Control Flow Statement
      1. Switch Example
      2. Switch Fallthrough Example
      3. Switch Default Example
      4. Switch Expressions
      5. Pattern matching for switch
    3. For Loop
      1. Puzzles (In the Loop)
    4. While Loop
      1. Puzzle (Shifty i's)
      2. Puzzles (Looper)
      3. Puzzle (Bride of Looper)
      4. Puzzle (Son of Looper)
      5. Puzzle (Ghost of Looper)
    5. Do/While Loop
    6. Foreach Loop
    7. Nested Loops
    8. Break, Continue, Labels and Return
      1. Break
      2. Label
        1. Puzzle (Dupe of URL)
      3. Continue
      4. Return
    9. Loop and Control Flow Examples
      1. How many rolls it takes to roll a 6?
      2. A simple game with dice and random numbers
  2. Exceptions
    1. Alternative Approach
  1. Testing with JUnit 5 (Hamcrest and AssertJ)
    1. Add JUnit 5
    2. Parameterized Test
    3. Custom Converters
    4. Tests Tagging
    5. Nested Tests
    6. Hamcrest
    7. AssertJ
    8. JUnit 5, Hamcrest and AssertJ
    9. Test Lifecycle
  2. Mocking (Mockito and EasyMock)
    1. What is Mocking (Test Doubles) and Why do we need it?
    2. Test Doubles
    3. Mockito
    4. EasyMock
    5. Which Mocking Framework
  3. Mutation Testing (PIT)
  4. Google Guava (Preconditions)
  5. Miscellaneous
  1. Single-responsibility Principle
  2. Open–closed principle
  3. Liskov substitution principle
  4. Interface segregation principle
  5. Dependency inversion principle
  6. Miscellaneous
  1. Lambda Expressions
    1. Function as Parameters
    2. Constructor as Parameters
  2. Multiple Parameters
  3. Dealing with Exceptions
  4. Foreach Loops
  5. Streams (Lambda)
    1. Filter
    2. ForEach
    3. Map
    4. FlatMap
    5. Mapping and Filtering
  6. Collectors
  7. Common Uses
    1. Sum numbers in List
    2. Sum content in List based on property
    3. Create Map from List
  8. Miscellaneous
  1. Try with Resources
  2. Java Streams
    1. Buffered Streams
  3. Java Readers
    1. Consuming an InputStream
    2. Writing to an OutputStream
  4. Java Non-Blocking IO
  5. HTTP Client (Java)
  6. Miscellaneous
  1. H2, MySQL and PostgreSQL
  2. Data Sources (Hikari Connection Pool)
  3. Flyway (Database Migration)
  4. Statements, Prepared Statements, Result Sets
  5. Transactions
  6. JOOQ
  7. Query DSL
  8. JPA and Hibernate
  1. Java Memory Model
  2. Threads
    1. Daemons
    2. Waiting for a thread to finish (Join)
    3. ThreadLocal
    4. Stale Caches
    5. Race Conditions
    6. Methods that should never be used.
  3. Concurrent Data Classes
    1. Primitive Wrappers
    2. List
    3. Set
    4. Map
    5. Queue
    6. Exchanger
  4. Classic Concurrency Control
    1. Volatile
    2. Synchronized
    3. Deadlocks
  5. New Approach to Concurrency
    1. Executors and Schedulers
    2. Lock and ReentrantLock
    3. Latch
    4. CyclicBarrier
    5. Fork Join Framework
  6. Cost of Concurrency
  7. Miscellaneous
  1. Creational Design Pattern
    1. Factory Pattern
    2. Abstract Factory Pattern
    3. Singleton Pattern
    4. Prototype Pattern
    5. Builder Pattern.
  2. Structural Design Pattern
    1. Adapter Pattern
    2. Bridge Pattern
    3. Composite Pattern
    4. Decorator Pattern
    5. Facade Pattern
    6. Flyweight Pattern
    7. Proxy Pattern
  3. Behavioral Design Pattern
    1. Chain Of Responsibility Pattern
    2. Command Pattern
    3. Interpreter Pattern
    4. Iterator Pattern
    5. Mediator Pattern
    6. Memento Pattern
    7. Observer Pattern
    8. State Pattern
    9. Strategy Pattern
    10. Template Pattern
    11. Visitor Pattern
  1. Java
  2. Gradle
  3. Docker
  4. Kubernetes
  5. JUnit
  6. Mockito
  7. Miscellaneous