← Back to Home

Code-Alongs

Overview

Join us for interactive coding sessions where you'll build real-world applications alongside your instructors.

Available Code-Along Topics

Code-Along 1: SSD and Builder Pattern

Learn about Software System Design (SSD) and implement the Builder pattern in a practical example.

Builder Pattern Implementation

In this code-along, you'll implement the Builder pattern to create objects with numerous optional properties. The Builder pattern is ideal when you need to construct complex objects step by step.

Key Concepts Covered:

  • Builder Class Structure: Creating an inner builder class with methods for each property
  • Method Chaining: Returning the builder from each setter method to enable fluent syntax
  • Validation: Implementing validation logic to ensure required fields are provided
  • Immutability: Creating immutable objects using the builder pattern

Code Example:

public class Product {
    private final String name;
    private final String description;
    private final double price;
    private final String category;
    // More fields...

    private Product(Builder builder) {
        this.name = builder.name;
        this.description = builder.description;
        this.price = builder.price;
        this.category = builder.category;
        // More assignments...
    }

    public static class Builder {
        // Required parameters
        private final String name;
        
        // Optional parameters with default values
        private String description = "";
        private double price = 0.0;
        private String category = "Uncategorized";
        
        public Builder(String name) {
            this.name = name;
        }
        
        public Builder withDescription(String description) {
            this.description = description;
            return this;
        }
        
        public Builder withPrice(double price) {
            this.price = price;
            return this;
        }
        
        public Builder withCategory(String category) {
            this.category = category;
            return this;
        }
        
        public Product build() {
            // Validation logic here
            return new Product(this);
        }
    }
}

Code-Along 2: Gradle and File I/O

Set up a Gradle project and work with file input/output operations in Java.

Gradle Setup and File I/O Implementation

In this code-along, you'll learn how to set up a Gradle project and implement file I/O operations to read from and write to files in Java.

Key Concepts Covered:

  • Gradle Configuration: Setting up build.gradle with dependencies and plugins
  • Project Structure: Organizing your Java project with Gradle
  • Reading Files: Using FileReader, BufferedReader, and FileInputStream
  • Writing Files: Using FileWriter, BufferedWriter, and FileOutputStream
  • Exception Handling: Properly handling I/O exceptions
  • Resource Management: Closing file streams correctly

Code Example - Reading a File:

try {
    File file = new File("data.txt");
    FileReader fileReader = new FileReader(file);
    BufferedReader bufferedReader = new BufferedReader(fileReader);
    
    String line;
    StringBuilder content = new StringBuilder();
    
    while ((line = bufferedReader.readLine()) != null) {
        content.append(line).append("\n");
    }
    
    bufferedReader.close();
    System.out.println("File content: " + content.toString());
    
} catch (FileNotFoundException e) {
    System.err.println("File not found: " + e.getMessage());
} catch (IOException e) {
    System.err.println("Error reading file: " + e.getMessage());
}

How to Join a Code-Along

  1. Log in to your BloomTech platform account
  2. Navigate to the "Live Events" section
  3. Look for available Backend Development code-along sessions
  4. If no sessions are currently scheduled, please reach out to the Backend Development team to request one

Preparation Checklist

  • Review the module content before attending
  • Set up your development environment
  • Have your questions ready
  • Test your audio and video setup