Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions common-content/en/module/java/demo/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Demo
Demo a main method and talk through each of the components that make up a method signature → this could be your solution to an exercise, or something completely new!
42 changes: 42 additions & 0 deletions common-content/en/module/java/entry-criteria/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
+++
title = 'Entry Criteria'

time = 20
[objectives]
1='List the entry criteria for the Java module'
[build]
render = 'never'
list = 'local'
publishResources = false

+++

## 🎯 1. Meet the criteria

### People

- [ ] We need at least two trainees to start a module
- [ ] A minimum ratio of 1:6 volunteers to qualifying trainees

### Skills

- [ ] Trainees must have completed ????

### Space

- [ ] A place to meet on Saturdays

### Time

- [ ] Volunteers and trainees must commit to 5 weeks of Saturday sessions

### Money

- [ ] {{<our-name>}} will pay for trainee expenses like food, bus tickets, equipment and childcare

### A Plan

- [ ] Here’s the plan: it’s this module!
When you have all these things, you can start a Java module.

## 📅 2. Set the date!
4 changes: 4 additions & 0 deletions common-content/en/module/java/review/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Review
- Share solutions to exercises → share code, talk through what you've done to the group, ask questions and discuss alternative solutions / tradeoffs etc
- Discuss reflections for each exercise (these are listed under Reflections sections in Prep) → there is no right or wrong answers here, this is a chance to consolidate what you've learnt and analyse / challenge the various patterns and principles covered in this sprint.
- Please write your answers to the reflection questions as you are completing the corresponding exercises - don't wait until the last minute before class!
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
+++
title = 'Debugging Java Code Using the IDE'

time = 120
objectives = [
'Use debugging tools in the IDE to fix runtime issues',
'Set breakpoints and inspect variables.',
'Step through code execution to identify logic errors.'
]
[build]
render = 'never'
list = 'local'
publishResources = false

+++

Debugging is an essential skill for any developer. IntelliJ provides powerful tools to help you find and fix issues quickly. In your IDE, there are two ways to run a program:
- Run
- Debug

If you use the debug option, you will be able to set breakpoints at which the program will pause execution. When the program stops on a breakpoint, you can:
- View the value of all variables that are in scope
- View the current execution stack
- Evaluate a specific piece of code
- Step line-by-line through the code

When stepping through code, you can:
- Step over: steps over the next single line
- Step into: step into a method that is being invoked on the current line
- Run to cursor: continues execution until it reaches the cursor
- Evaluate: evaluates a selected portion of code. You can also write arbitrary code to evaluate.

## Self Study
As you read through the resources below try to answer the following questions:
- What are some Intellij shortcuts to help with debugging?
- How does debugging in Java compare to debugging you've seen in other languages?

### Reading material
- [Introduction to debugging in Java](https://www.w3schools.com/java/java_debugging.asp)
- [Debugging a Java application with IntelliJ](https://www.jetbrains.com/help/idea/debugging-your-first-java-application.html)
- [Understanding compilation](https://www.baeldung.com/java-compiled-interpreted)

{{<note type="exercise" title="Exercise 4.1">}}
**Goal:** Learn to use breakpoints and inspect variables.

- Write a program that calculates the sum of numbers from 1 to 100 and prints the result
- Introduce a bug (e.g., start the loop at -1 instead of 1).
- Use IntelliJ’s debugger to:
- Set a breakpoint inside the loop.
- Inspect the value of the sum variable and the result variable, seeing how they change as you step through.
- Step through the code to find the error.
{{</note>}}

## Reflections
Think about the following questions, make notes and be prepared to talk through your thoughts in the workshop.
- How might you have found the issue if you didn't have a debugger?
- What was the process you followed when debugging code? e.g. how did you decide where to put breakpoints?
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
+++
title = 'Getting Started with the IDE and main methods'

time = 120
objectives = [
'Install and set up IntelliJ IDEA.',
'Navigate the IDE interface: project explorer, editor, console, and debugger.',
'Create a basic Java project and run a simple program.',
'Explain the role of the main method in Java applications.'
]
[build]
render = 'never'
list = 'local'
publishResources = false

+++

## Why Java and How It Differs from JavaScript
Before diving in, let’s set the stage. Java and other programming languages such as JavaScript share some conceptual similarities—e.g. the use of loops, conditionals, and functions—but Java has its own syntax, type systems, and execution models. Java is a statically typed, compiled language, which means you’ll encounter concepts like compilation errors and method signatures that don’t exist in scripting languages like JavaScript. This sprint will help you make that mental shift.

## Overview
An IDE (Integrated Development Environment) is your main tool for Java development. It simplifies tasks like writing code, compiling, debugging, and managing dependencies.
Every Java application starts with a main method. Understanding its role and how methods are structured is key to writing functional programs. The main method is the entry point of every Java application.

## Self Study
As you read through the resources below try to answer the following questions:
1. You've probably used an IDE before when coding in other languages - what makes an IDE particularly useful when coding in Java?
2. What is a Java main method for?
3. What are some differences between how a program is run in Java vs other languages you've seen before?

### Reading material
- [Introduction to Java](https://www.w3schools.com/java/java_intro.asp)
- [Interpreted vs Compiled Programming Languages](https://www.freecodecamp.org/news/compiled-versus-interpreted-languages/)
- [Getting started with IntelliJ IDEA](https://www.jetbrains.com/help/idea/getting-started.html)
- [Top 5 reasons you need an IDE](https://medium.com/@synergenttechsolution30/java-ides-top-5-reasons-you-need-an-ides-95426a0e6d5a)
- [Java main() Method Explained](https://www.baeldung.com/java-main-method)

{{<note type="exercise" title="Exercise 1.1">}}
**Goal:** Get comfortable with IntelliJ and running Java code.

- Install IntelliJ IDEA and create a new Java project.
- Create a main method and add logic so that it prints: "Hello, Java!"
- You'll need to Google for how to print to the console in Java!
- Run the program from the IDE.
{{</note>}}

## Reflections
Think about the following questions, make notes and be prepared to talk through your thoughts on the Saturday.
- Share three useful Intellij keyboard shortcuts
- Getting familiar with keyboard shortcuts will save you lots of time and improve your flow when writing code - it's well worth taking the time to learn!
- If you rename your main method will it still run?
- What do the keywords public, static and void mean?

Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
+++
title = 'Java keywords and syntax'

time = 120
objectives = [
'Identify Java reserved keywords in an IDE',
'Explain and use common keywords like public, private, static, void, for, if, and primitive types',
'Declare variables and print them out to the console.',
'Write a conditional statement',
'Write a for loop and a switch statement',
'Explain the trade-offs between switch statements and if/else statements'
]
[build]
render = 'never'
list = 'local'
publishResources = false

+++

Java has strict syntax rules and reserved keywords that define its structure. Understanding these early will prevent common errors.

Compilation is the process of converting the Java code you write into a format that your computer can execute. Compile time is when Java checks your code for errors before running your program, which is different from languages like Python or JavaScript that check for errors while the program is actually running. This provides us with the significant benefit of being able to spot (some!) errors without running the code. It also means Java IDEs come with a set of powerful tools to aid development.

Java has two types of data type: primitive and reference. Without going into too much detail right now, primitive types are usually much faster for the computer to deal with and should be used in situations where performance is important. Moreover, the primitive types are the basic 'building blocks' of Java and all reference types are ultimately made up of primitive types. You can identify primitive types because they are always in lowercase, unlike reference types which are in UpperCamelCase. The primitive types are defined by the Java language itself and we cannot create any new ones ourselves or change any existing ones. We'll focus on the following primitive types for now:
- int
- long
- double
- boolean
- char
Java is a statically typed language, which means that variable types are known at compile time. As such, the type must be provided by the programmer when writing the code.
For example, if you are to define a string, you must explicitly state that the variable is of type string:

```java
String myVariable = "hello world";
```

## Self Study
As you read through the resources below try to answer the following questions:
1. What is a keyword in java?
1. Choose 3 keywords and explain what they represent
2. What is meant by the term 'primitive type'?

### Reading material
- [Dynamic vs. static typing](https://docs.oracle.com/cd/E57471_01/bigData.100/extensions_bdd/src/cext_transform_typing.html)
- [Java keywords with explanations](https://www.w3schools.com/java/java_ref_keywords.asp)
- [Java Primitives](https://www.baeldung.com/java-primitives)
- [Java For Loop](https://www.baeldung.com/java-for-loop)
- [Decision Making in Java - Conditional Statements](https://www.geeksforgeeks.org/java/decision-making-javaif-else-switch-break-continue-jump/)

{{<note type="exercise" title="Exercise 2.1">}}
**Goal:** Practice basic syntax and keywords.

Create a program that:
- Declares variables of different primitive types (int, double, boolean, char).
- Prints their values to the console.
- Add comments explaining what each keyword does (e.g., public, static, void).
{{</note>}}

{{<note type="exercise" title="Exercise 2.2">}}
**Goal:** Identify and fix compilation errors.

- Remove a semicolon or misspell a keyword in your code.
- Observe the compilation error in IntelliJ.
- Fix the error and re-run the program
{{</note>}}

{{<note type="exercise" title="Exercise 2.3">}}
**Goal:** Compare Java control flow with JavaScript.

Write a program that:
- Uses a for loop to print numbers 1 to 10.
- Uses an if-else statement to check if a number is even or odd.

**Bonus:** Rewrite the same logic in JavaScript and note the differences in syntax.
{{</note>}}

{{<note type="exercise" title="Exercise 2.4">}}
- Write a program that uses a switch statement to print the name of the day based on an integer (1 = Monday, etc.).
- Explain why switch in Java differs from JavaScript (e.g. type safety).
{{</note>}}

## Reflections
Think about the following questions, make notes and be prepared to talk through your thoughts in the workshop.
- List the primitive types you've seen and explain what they represent
- What is an enhanced for loop in Java? Would an enhanced for loop be useful for this exercise? Why? When would an enhanced for loop be useful?
- Did you encounter any compilation errors when writing your code? How did you fix them? Did the IDE help?
48 changes: 48 additions & 0 deletions common-content/en/module/java/sprint-1/method-signatures/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
+++
title = 'Method Signatures'

time = 120
objectives = [
'Write methods and explain the structure and components of method signatures.',
'Write and run custom methods with parameters and return types.',
'Document methods using JavaDoc'
]
[build]
render = 'never'
list = 'local'
publishResources = false

+++

Understanding method signatures is essential for ensuring the code is readable & maintainable. When writing code, we should expect that someone else will need to understand and adapt it - we work in teams, not in isolation. Therefore, it's important to write code that is clear and understandable.
It's important when writing Java code to document classes and methods so others understand the intended purpose of the code, this can been done with JavaDoc - have a read through how to format different types of JavaDoc.

## Self Study
As you read through the resources below try to answer the following questions:
1. What are the components of a method signature? Are any of them optional?
2. What is Javadoc? Who is it for and why is it useful?

### Reading material
- [Introduction to methods in Java](https://www.baeldung.com/java-methods)
- [Method signatures in Java](https://www.baeldung.com/java-main-method)
- [Writing Java methods](https://www.w3schools.com/java/java_methods.asp)
- [Introduction to JavaDoc](https://www.baeldung.com/javadoc)

{{<note type="exercise" title="Exercise 3.1">}}
Goal: Write a method signature which takes parameters.
- Create a private method called greetUser that:
- Accepts a String name as a parameter.
- Returns a greeting message like "Hello, Alice!".
- Call this method from a main method and print the result.
- Explain each part of the method signature for the name method.
{{</note>}}

{{<note type="exercise" title="Exercise 3.2">}}
- Create a method calculateSum that takes two integers and returns their sum.
- Add JavaDoc comments explaining the method.
{{</note>}}

## Reflections
Think about the following questions, make notes and be prepared to talk through your thoughts in the workshop.
- Why are private methods useful? Why not just have everything in the main method?
- Javadoc should describe the why not the what of your code - why?
9 changes: 9 additions & 0 deletions org-cyf/content/tracks/java/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
+++
title = 'Java'
description = 'Learn Java'
layout = 'module'
emoji="🤖"
track_kinds = ["jobs-after-sdc"]
menu="Java"
weight = 1
+++
9 changes: 9 additions & 0 deletions org-cyf/content/tracks/java/overview/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
+++
title = "Course overview"
layout = "overview"
overview_menu = "Java"
+++

## Objective

Learn Java!!
9 changes: 9 additions & 0 deletions org-cyf/content/tracks/java/prep/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title = 'prep'
description = 'This work must be done to prepare for this module'
layout = 'prep'
menu_level = ['module']
weight = 1
[[blocks]]
src='module/java/entry-criteria'
name="Entry Criteria"
+++
9 changes: 9 additions & 0 deletions org-cyf/content/tracks/java/sprints/1/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
+++
title = 'Java Sprint 1'
description = 'Introduction to the IDE, basic java concepts & debugging'
layout = 'sprint'
menu_level = ['module']
menu=['sprints']
weight = 2
theme = "Introduction to Java"
+++
8 changes: 8 additions & 0 deletions org-cyf/content/tracks/java/sprints/1/backlog/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
+++
title = 'backlog'
layout = 'backlog'
menu_level = ['sprint']
weight = 2
backlog= 'Module-Java'
backlog_filter= '📅 Sprint 1'
+++
35 changes: 35 additions & 0 deletions org-cyf/content/tracks/java/sprints/1/day-plan/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
+++
title = 'day-plan'
layout = 'day-plan'
menu_level = ['sprint']
weight = 3
[[blocks]]
name="Energiser"
src="blocks/energiser"
[[blocks]]
name="Morning orientation"
src="blocks/morning-orientation"
time=15
[[blocks]]
name="Review"
src="module/java/review"
time=60
[[blocks]]
name="Morning break"
src="blocks/morning-break"
time=20
[[blocks]]
name="Demo"
src="module/java/demo"
time=60
[[blocks]]
name="lunch"
src="blocks/lunch"
[[blocks]]
name="Study Group"
src="blocks/study-group"
time="150"
[[blocks]]
name="Retro"
src="blocks/retro"
+++
Loading
Loading