Practice for Mob Programming and Go Language
Goal
- Prepare one shared development environment using Visual Studio Code.
- Decide one person in the group to be the driver.
- The driver will share their VSCode screen and type code.
- Other members act as navigators, giving suggestions and reviewing code.
- You may use your group channel on Teams to share the screen.
- Rotate the driver role periodically (e.g., every 10–15 minutes).
Exercise Setup
- Form groups of up to 3 members.
- If 4 people, split into two groups (2 + 2).
- The person with the least programming experience is recommended to be the first driver.
- Start by creating a new Go project by following the steps described in the “Hello World” section.
Exercise Tasks
- Hello World
- File: hello.go
- Implement a function that returns “Hello world” and print it in main().
- Bubble Sort
- Create a new project: bubble
- File: bubblesort.go
- Convert a bubble sort algorithm from Python to Go
import random
def bubble_sort(x):
for j in range(len(x)-1):
for i in range(0, len(x)-1-j):
if x[i] > x[i+1]:
x[i], x[i+1] = x[i+1], x[i]
data = [random.randint(-10, 10) for i in range(10)]
print(data)
bubble_sort(data)
print(data)