Skip to content

Commit 64b79ec

Browse files
committed
re-arrange episodes to match our autumn 2025 plan; closes #51
1 parent ddc5040 commit 64b79ec

File tree

7 files changed

+99
-68
lines changed

7 files changed

+99
-68
lines changed
Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
1-
# Optional home-/group work
1+
# Exercise 1
22

3-
:::{admonition} This is completely optional
4-
You can participate in the lesson without working on any of the tasks below.
53

6-
We share these for individuals and groups who would like to work on some of
7-
these in preparation of the lesson or independently of a CodeRefinery workshop
8-
with their study group.
9-
10-
We might comment on the contributed solutions during the lesson
11-
but we will definitely do so in a constructive and positive way.
4+
:::{admonition} You can participate in two ways
5+
- Either by discussing with others and writing your own thoughts via collaborative notes
6+
- Or by coding
7+
- Or a mix of the two that is most meaningful for you or your group
128
:::
139

10+
11+
## Discussion track
12+
13+
We share these questions in a common collaborative document:
14+
```
15+
A. What does "modular code development" mean for you?
16+
B. What best practices can you recommend to arrive at well structured,
17+
modular code in your favourite programming language?
18+
C. What do you know now about programming that you wish somebody told you earlier?
19+
D. Do you design a new code project on paper before coding? Discuss pros
20+
and cons.
21+
E. Do you build your code top-down (starting from the big picture) or bottom-up
22+
(starting from components)? Discuss pros and cons.
23+
F. Would you prefer your code to be 2x slower if it was easier to read and understand?
24+
```
25+
26+
They can be answered by individual learners but also discussed within an
27+
exercise group.
28+
29+
30+
## Coding track
31+
1432
You can practice on our [exercise repository](https://github.com/coderefinery/modular-type-along-exercise) which contains:
1533
- Data set
1634
- Python notebook which works but is not super general
Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1-
# Types of encapsulation
1+
# Exercise 2
22

3+
4+
:::{admonition} You can participate in two ways
5+
- Either by discussing with others and writing your own thoughts via collaborative notes
6+
- Or by coding
7+
- Or a mix of the two that is most meaningful for you or your group
8+
:::
9+
10+
11+
## Discussion track
12+
13+
The topic of this discussion session is encapsulation.
14+
Can you please comment on these recommendations in the collaborative notes and perhaps suggest
15+
other recommendations which have helped in your work and others could find useful?
16+
17+
18+
:::{discussion} Types of encapsulation
319
Let's say you want to move a code from one system to another. What are the things that can go wrong?
420

521
- **In-language dependencies**, e.g. Python. Can they all be expressed *only* in
@@ -12,12 +28,21 @@ Let's say you want to move a code from one system to another. What are the thin
1228
- Are you using something that is **OS-specific** (GNU/Linux vs BSD)?
1329
- Do you use support programs only available on certain computers? Fewer
1430
external utilities you use = easier portability.
31+
:::
1532

1633

17-
## What needs to be global vs what needs to be local?
18-
34+
:::{discussion} What needs to be global vs what needs to be local?
1935
- Global data can be "seen"/accessed in the entire code.
2036
- Local data is only available in the local vicinity of its definition.
2137
- Try to have as little global data as possible.
2238
- Global data are often input parameters, configuration parameters, command-line arguments.
2339
- But try to localize these to the "main" code/function.
40+
:::
41+
42+
43+
44+
## Coding track
45+
46+
Here you can continue either with some of the coding tasks from the first
47+
exercise session or you can program something inspired by our live-coding
48+
session.

content/index.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,30 @@ Image to get started:
99
17(3): e1008549. <https://doi.org/10.1371/journal.pcbi.1008549>)
1010

1111

12+
## Timing overview
13+
14+
:::{csv-table}
15+
:widths: auto
16+
:delim: ;
17+
18+
20 min ; {doc}`starting-point`
19+
20 min ; {doc}`exercise1`
20+
10 min ; Discussion
21+
10 min ; Break
22+
30 min ; Live-coding with suggestions via notes ({doc}`solution`)
23+
20 min ; {doc}`exercise2`
24+
10 min ; Break
25+
15 min ; Discussion
26+
:::
27+
28+
1229
:::{toctree}
1330
:maxdepth: 1
14-
:caption: The lesson
31+
:caption: Episodes
1532

16-
questions
17-
learning-outcomes
18-
lesson
19-
optional-homework
20-
encapsulation
33+
starting-point
34+
exercise1
35+
exercise2
2136
:::
2237

2338

content/learning-outcomes.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

content/questions.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

content/solution.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
(guide)=
2-
3-
# An iterative solution
1+
# One possible solution
42

53
## Before we start
64

@@ -14,10 +12,7 @@ other languages in its place.
1412
We **collect ideas and feedback in the collaborative document while coding** and the instructor
1513
tries to react to that without going into the rabbit hole.
1614

17-
We recommend to go through this together where the instructor(s) demonstrate(s)
18-
and learners can commend, suggest, and ask questions, and we are either all in
19-
the same video room or everybody is watching via stream. In other words, for
20-
this lesson, **learners are not in separate breakout-rooms**.
15+
Learners can also explore some of these steps in one of the exercise sessions.
2116

2217

2318
## Checklist
Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Our task
1+
# Starting with an example code in a Notebook
22

33

44
## Data
@@ -70,3 +70,23 @@ the ideas and steps in the {ref}`guide`.
7070
It is OK and good if mistakes happen and it is fun if the instructor(s) can
7171
convey a bit of "improv" feel to this lesson.
7272
:::
73+
74+
75+
## Learning outcomes
76+
77+
- Know about **pure functions** (functions without side effects, functions which
78+
given same input always return same output).
79+
- Learn why and how to **limit side effects** of functions.
80+
- Discuss why and how to limit side effects of data. Also discuss when
81+
mutable data may be preferable.
82+
- [The Zen of Python](https://www.python.org/dev/peps/pep-0020/)
83+
- Discuss why **single-purpose functions** are often preferred over
84+
multi-purpose functions.
85+
- **Split-apply-combine**, which lets you more easily parallelize. Make your code
86+
modular in a way that lets you split the steps and parallelize.
87+
- Think about **global vs local** data structures. It is not easy to
88+
separate them right.
89+
- Understand how a command line interface to a code can improve usability and also
90+
make the code more versatile (to be combined with workflow management tools).
91+
- Connect modular code development to the remaining lessons (version control, testing,
92+
documentation, reproducibility).

0 commit comments

Comments
 (0)