← Back to Home
Module 4: Scrum
Learning Objectives
- Identify what will be allocated in the heap when a code snippet is executed
- Describe the contents of a particular frame in the stack at a given point in a code snippet
- Identify the frames in the stack at a given point in a code snippet
- Identify which objects in the heap are eligible for garbage collection at a given point in a code snippet
- Outline how data, variables, and objects are stored in a computer's memory
- Recall that the stack is the portion of memory reserved for the local variables of currently executing methods
- Recall that the heap is the portion of memory that is reserved for storing objects' state
- Distinguish between storing a primitive member variable's value and an object member variable's references in memory
- Understand the principles and practices of Scrum methodology
- Plan and manage work using Trello boards and the Scrum framework
Memory Management in Java
Understanding how memory works in Java is crucial for writing efficient and bug-free code. In this module, we'll explore Java's memory model and how it affects your application's performance and behavior.
The Java Memory Model
Java's memory is divided into two main regions:
- Stack: Where local variables and method call information are stored
- Heap: Where objects and their instance variables are stored
The Stack
The stack is a region of memory that stores:
- Method calls (stack frames)
- Local primitive variables
- References to objects in the heap
Each thread in a Java application has its own stack. When a method is called, a new frame is created on the stack, containing:
- The method's parameters
- Local variables
- Return address (where execution should continue after the method completes)
When a method completes, its frame is removed from the stack.
The Heap
The heap is a shared region of memory where all objects are allocated. When you create an object using new
, memory is allocated on the heap. The heap contains:
- Objects (instances of classes)
- Instance variables (including primitives and references to other objects)
- Arrays (even of primitive types)
The heap is managed by the garbage collector, which automatically reclaims memory from objects that are no longer reachable.
Garbage Collection
Java's garbage collector automatically identifies and removes objects that are no longer reachable from your application. This helps prevent memory leaks and makes memory management easier.
How Garbage Collection Works
An object becomes eligible for garbage collection when it's no longer reachable through:
- References from the stack
- References from other live objects in the heap
- References from JNI (Java Native Interface) methods
The garbage collector periodically runs to identify and remove unreachable objects, freeing up memory for new allocations.
Memory Leak Prevention
Even with garbage collection, memory leaks can still occur if you maintain references to objects you no longer need. Common causes include:
- Storing objects in static fields
- Adding objects to collections (like lists or maps) but never removing them
- Implementing listeners or callbacks without proper cleanup
To prevent memory leaks, always remove references to objects you no longer need, especially in long-lived containers or when using event listeners.
Introduction to Scrum
Scrum is an agile project management framework that helps teams work together. Like a rugby team (where it gets its name) training for the big game, Scrum encourages teams to learn through experiences, self-organize while working on a problem, and reflect on their wins and losses to continuously improve.
While Scrum is most frequently used by software development teams, its principles and lessons can be applied to all kinds of teamwork. This is one of the reasons Scrum is so popular. Often thought of as an agile project management framework, Scrum describes a set of meetings, tools, and roles that work in concert to help teams structure and manage their work.
Why Scrum Works
Scrum is popular for several reasons:
- Transparency: Everyone knows what's happening and why
- Inspection: The team regularly checks on progress and adjusts
- Adaptation: Plans and processes can change as needed
- Incremental Delivery: Value is delivered frequently in small chunks
Scrum Framework Components
Scrum Roles
There are three main roles in Scrum:
- Product Owner: Represents the stakeholders and customers, defines requirements
- Scrum Master: Ensures the team follows Scrum practices, removes impediments
- Development Team: Cross-functional members who do the actual work
Scrum Events
Scrum defines several time-boxed events (meetings) that create regularity:
- Sprint: A time-boxed period (usually 1-4 weeks) where work is completed
- Sprint Planning: Team decides what to work on in the upcoming sprint
- Daily Standup: Brief daily meeting to sync the team (15 minutes)
- Sprint Review: Team demonstrates what was accomplished during the sprint
- Sprint Retrospective: Team reflects on the sprint and plans improvements
Scrum Artifacts
Scrum uses several tools to make work visible:
- Product Backlog: Prioritized list of all desired features and fixes
- Sprint Backlog: Items selected for the current sprint
- Increment: The sum of all completed items at the end of a sprint
User Stories
User stories are a way of describing features from an end-user perspective. They typically follow this format:
As a [type of user], I want [some goal] so that [some reason].
For example: "As a customer, I want to be able to save items to a wishlist so that I can easily find them later."
User stories help the team focus on delivering value to users rather than implementing features for their own sake. They're written in everyday language, which makes them accessible to everyone involved in the project.
INVEST Criteria for Good User Stories
A good user story should be:
- Independent: Can be developed separately from other stories
- Negotiable: Details can be discussed and refined
- Valuable: Delivers value to a stakeholder
- Estimable: Team can estimate the effort required
- Small: Can be completed within a sprint
- Testable: Clear criteria for when it's done
Using Trello for Scrum
Trello is a popular tool for implementing Scrum because of its flexibility and visual nature. Here's how to set up a basic Scrum board in Trello:
Basic Board Structure
A typical Scrum board in Trello might have these lists:
- Backlog: All user stories that haven't been planned yet
- Sprint Backlog: User stories selected for the current sprint
- In Progress: Stories currently being worked on
- Review/QA: Stories completed but awaiting review
- Done: Stories that are completed and meet the definition of done
Creating Cards
Each card in Trello represents a user story or task. A well-structured card should include:
- A clear title (often the user story)
- A detailed description
- Acceptance criteria
- Story points or effort estimate
- Labels for categorization
- Assigned team members
- Due dates if applicable
Managing the Sprint
During the sprint, team members move cards from left to right as work progresses. This provides visibility into the state of the sprint and helps identify bottlenecks or blockers.
Key Topics
Learn the fundamental principles and components of the Scrum framework.
- Agile principles
- Scrum roles and responsibilities
- Scrum events and ceremonies
Learn how to use Trello to organize and manage your project using Scrum.
- Setting up a Trello board for Scrum
- Creating and organizing cards
- Tracking progress during sprints
Learn how to write effective user stories to capture requirements and guide development.
- User story format and components
- Acceptance criteria
- Story points and estimation
Guided Project
In the guided project for this module, you'll apply what you've learned about Scrum to plan and track your Learn and Be Curious project.
Project: Setting Up Your Project in Trello
This project will guide you through setting up a Trello board for your project and planning your first sprint.
Create a Trello board for your project and plan your first sprint.
Additional Resources
The official guide to Scrum, written by the creators of Scrum.
Trello's guide to using their platform for Scrum projects.