Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
f3d36fb
Remove old course content and add new pages
thomaskileyukaea Aug 9, 2023
cf49f19
Add a concluding section talking about YAGNI
thomaskileyukaea Aug 9, 2023
22ef936
Add headers for the various new pages
thomaskileyukaea Aug 9, 2023
046677d
Add in exercises for the new sections
thomaskileyukaea Aug 9, 2023
664afbc
Fix file name extensions
thomaskileyukaea Aug 9, 2023
d39c621
Add first draft of the software design episode
thomaskileyukaea Oct 10, 2023
e0e6da1
Add first draft of the pure functions section
thomaskileyukaea Oct 10, 2023
3103a3c
Adding first draft of the MVC section
thomaskileyukaea Oct 10, 2023
9c40c44
First draft of the class section of the episode
thomaskileyukaea Oct 17, 2023
860fbd8
First draft of the episode conclusion
thomaskileyukaea Oct 17, 2023
fcd6aa1
Update introduction to not mention paradigms
thomaskileyukaea Oct 18, 2023
0d06342
Move exercise about good and bad code before abstractions
thomaskileyukaea Oct 18, 2023
97f8590
Highlight where the code we are refactoring is
thomaskileyukaea Oct 18, 2023
78943f8
Expand the solution of the find problems with the code exercise
thomaskileyukaea Oct 18, 2023
77ffa14
Make the section explaining the tests clearer
thomaskileyukaea Oct 18, 2023
7f9b163
Add guidance to the regression test exericse
thomaskileyukaea Oct 18, 2023
253efda
Define regression testing before using it as exercise name
thomaskileyukaea Oct 18, 2023
81b414f
Add paragraph introducing cognitive load
thomaskileyukaea Oct 18, 2023
a2c5f2e
Fix type in introduction to pure functions
thomaskileyukaea Oct 18, 2023
6e69823
Add a bit about congitive load in advantages of pure functions
thomaskileyukaea Oct 18, 2023
0006a86
Explain that pure functions are easier to test ine one place
thomaskileyukaea Oct 18, 2023
b0f48e9
Incorporate the point about reuse pure functions into main text
thomaskileyukaea Oct 18, 2023
a653eeb
Highlight that the glue code is the non-pure code
thomaskileyukaea Oct 18, 2023
cd19c7f
USe model view presenter as alternative architecture
thomaskileyukaea Oct 18, 2023
5358305
Add header to call out about the controller
thomaskileyukaea Oct 18, 2023
b0d520d
Provide an example for how the model should be agnostic about the view
thomaskileyukaea Oct 18, 2023
4f727f0
Improve formatting of model/view classification exercise
thomaskileyukaea Oct 18, 2023
13b7df2
Emphasise the connection to the last episode
thomaskileyukaea Oct 18, 2023
a541c88
Improve clarity of first exercise in the MVC section
thomaskileyukaea Oct 18, 2023
e8375d4
Improve readability of the second exercise from the MVC section
thomaskileyukaea Oct 18, 2023
17f0395
Tightening up concluding paragraph
thomaskileyukaea Oct 18, 2023
9c8ec84
Fix semantic break in section about constructors
thomaskileyukaea Oct 18, 2023
19f07b3
Correct code sample to use write capitalisation for math.pi
thomaskileyukaea Oct 18, 2023
7f60230
Add examples for invariants and encapsulation
thomaskileyukaea Oct 18, 2023
66a904c
Add a callout about why maintaining invariants is good
thomaskileyukaea Oct 18, 2023
0f68b3e
Improve the class loading exercise content
thomaskileyukaea Oct 18, 2023
0c8817a
Add the controller modifications to the solution
thomaskileyukaea Oct 18, 2023
7924462
Fix spelling type in exercise title
thomaskileyukaea Oct 18, 2023
13bab51
Small fixes to flow of text in oop section
thomaskileyukaea Oct 18, 2023
3f3ecd3
Make the using classes in functional programming a callout
thomaskileyukaea Oct 18, 2023
bd41da7
Fixed incorrect usage of episode
thomaskileyukaea Oct 18, 2023
2bea011
Add diagram for solution to the architecture exercise
thomaskileyukaea Oct 18, 2023
10aa3fd
Remove redundant see this commit text
thomaskileyukaea Oct 18, 2023
3362067
Correct broken links in extras
thomaskileyukaea Oct 18, 2023
f766d70
Add initial timings for episodes
thomaskileyukaea Oct 23, 2023
4343b1d
Ensure model test is agnostic as to where it is run from
thomaskileyukaea Oct 23, 2023
515ed18
Correct example function name
thomaskileyukaea Oct 23, 2023
51cf100
Fixing spelling mistakes in refactoring functions exercise
thomaskileyukaea Oct 23, 2023
a79d394
Make sure there is an import for the Mock class
thomaskileyukaea Oct 23, 2023
c4e1146
Cover the changes needed to the regression test with the class refactor
thomaskileyukaea Oct 23, 2023
a77b9d6
Link decoupling to abstractions
thomaskileyukaea Oct 23, 2023
dfdb1a9
Make consistent use of first/second person
thomaskileyukaea Oct 23, 2023
aebc099
Ensure each problem links to a specific part of maintainable code
thomaskileyukaea Oct 23, 2023
a6e502a
Improve grammar of exercise solution
thomaskileyukaea Oct 23, 2023
35fd32d
Move MVC stuff after the classes section
thomaskileyukaea Oct 23, 2023
d1c3491
Combine YAGNI section into the MVC section
thomaskileyukaea Oct 23, 2023
05fee5b
Use consistent langauge - responsibilties - when talking about parts …
thomaskileyukaea Oct 23, 2023
dfcf219
Improve the flow of the start of the classes section
thomaskileyukaea Oct 23, 2023
1de7c86
Use correct name for CSVDataSource
thomaskileyukaea Oct 23, 2023
1f03d9e
Make the interfaces section not use real interfaces
thomaskileyukaea Oct 23, 2023
0df2ed8
Remove ... from example solution
thomaskileyukaea Oct 23, 2023
4488303
Ensure code samples consistent with new order
thomaskileyukaea Oct 23, 2023
54f3c9c
Fix formatting of solution regression test
thomaskileyukaea Oct 23, 2023
b663efa
Correct name of the regression test to match convention
thomaskileyukaea Oct 23, 2023
9eae6e2
Provide a skeleton for the test to make the exercise a bit easier
thomaskileyukaea Oct 23, 2023
c3d845c
Provide signature for pure function
thomaskileyukaea Oct 23, 2023
dc747dd
Use variable name data rather than all_loaded_data for example
thomaskileyukaea Oct 23, 2023
cafc20d
Introduce a header for the testing of pure functions section
thomaskileyukaea Oct 23, 2023
fa67fab
Add a hint showing how the class will be use
thomaskileyukaea Oct 23, 2023
c1eeb61
Remove bit about adding a layer of indirection
thomaskileyukaea Oct 23, 2023
51a1f99
Clarifying mocking section
thomaskileyukaea Oct 23, 2023
84edea9
Add skeleton test for writing the mock test
thomaskileyukaea Oct 23, 2023
3185e1b
Remind students to import the appropriate package
thomaskileyukaea Oct 23, 2023
f461a05
Make example actually build a JSON reader
thomaskileyukaea Oct 23, 2023
8ad11f7
Fix solutions based on testing
thomaskileyukaea Oct 23, 2023
47b3c81
Include the notion of writing tests before refactoring
thomaskileyukaea Oct 23, 2023
a672614
Reiterate running the regression test after each refactor
thomaskileyukaea Oct 23, 2023
e53f787
Correct capitalisation of files
thomaskileyukaea Nov 3, 2023
e7a3e0e
Fix missing fullstop
thomaskileyukaea Nov 3, 2023
224ea65
Fix line numbers for solutions based on change to code
thomaskileyukaea Nov 10, 2023
32ba1a1
Merged Thomas's work on section 3
anenadic Dec 12, 2023
8f1937b
Link and typo fixes
anenadic Dec 12, 2023
e3a994e
Initial pass over intro and first 2 episodes of section 3
anenadic Dec 14, 2023
b628416
Initial fix of config
anenadic Dec 14, 2023
e1f4e55
Mainly review of episode on refactoring
anenadic Dec 14, 2023
83ff771
Reworded the refactoring process a bit
anenadic Dec 15, 2023
8af5e71
More review of Thomas' work
anenadic Feb 27, 2024
5e135e0
More review of section 3
anenadic Feb 28, 2024
466b840
Added extra episdoe on OOP
anenadic Feb 28, 2024
e56693c
Review of episode on architecture
anenadic Feb 29, 2024
1efc791
Further updates the episode on architecture
anenadic Mar 1, 2024
0a36e7c
Fix for extras episode name
anenadic Mar 6, 2024
77169e2
#321 - Initial rework inc. section ordering and design goals
steve-crouch Mar 25, 2024
c44c2f5
Initial swap of refactoring and decoupling/abstractions episodes
anenadic Mar 25, 2024
d08fe3d
Added procedural programming episode
anenadic Mar 25, 2024
cba2d0c
Review of abstraction episode
anenadic Mar 25, 2024
5f27aaf
Review of refactoring episode
anenadic Mar 25, 2024
ef4af2e
Connected episodes better
anenadic Mar 26, 2024
4bc5198
#321 - revise software design learning narrative
steve-crouch Mar 27, 2024
f2b7402
#321 - move software architecture episode to software design, update …
steve-crouch Mar 27, 2024
a27bcb3
Update _episodes/32-software-design.md
steve-crouch Mar 27, 2024
f4d0bc2
Update _episodes/32-software-design.md
steve-crouch Mar 27, 2024
939e275
Merge pull request #332 from carpentries-incubator/issue-321
steve-crouch Mar 27, 2024
2f4a115
Update _episodes/34-code-refactoring.md
anenadic Mar 27, 2024
b1345a6
Update _episodes/33-code-decoupling-abstractions.md
anenadic Mar 27, 2024
2c3b5ac
Update _episodes/33-code-decoupling-abstractions.md
anenadic Mar 27, 2024
db5837b
Fixes as per Steve's review on PR #327.
anenadic Mar 27, 2024
219a2ae
Merging changes to abstractions and refactoring episodes.
anenadic Mar 27, 2024
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
5 changes: 4 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,13 @@ extras_order:
- discuss
- protect-main-branch
- vscode
- software-architecture-extra
- programming-paradigms
- procedural-programming
- functional-programming
- object-oriented-programming
- persistence
- databases
- verifying-code-style-linters
- quiz
# Files and directories that are not to be copied.
exclude:
Expand Down
4 changes: 2 additions & 2 deletions _episodes/15-coding-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ because an incorrect comment causes more confusion than no comment at all.
>> which is helpfully marking inconsistencies with coding guidelines by underlying them.
>> There are a few things to fix in `inflammation-analysis.py`, for example:
>>
>> 1. Line 24 in `inflammation-analysis.py` is too long and not very readable.
>> 1. Line 30 in `inflammation-analysis.py` is too long and not very readable.
>> A better style would be to use multiple lines and hanging indent,
>> with the closing brace `}' aligned either with
>> the first non-whitespace character of the last line of list
Expand Down Expand Up @@ -487,7 +487,7 @@ because an incorrect comment causes more confusion than no comment at all.
>> Note how PyCharm is warning us by underlying the whole line.
>>
>> 4. Only one blank line after the end of definition of function `main`
>> and the rest of the code on line 30 in `inflammation-analysis.py` -
>> and the rest of the code on line 33 in `inflammation-analysis.py` -
>> should be two blank lines.
>> Note how PyCharm is warning us by underlying the whole line.
>>
Expand Down
38 changes: 19 additions & 19 deletions _episodes/30-section3-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Section 3: Software Development as a Process"
colour: "#fafac8"
start: true
teaching: 5
teaching: 10
exercises: 0
questions:
- "How can we design and write 'good' software that meets its goals and requirements?"
Expand All @@ -13,7 +13,11 @@ objectives:
keypoints:
- "Software engineering takes a wider view of software development beyond programming (or coding)."
- "Ensuring requirements are sufficiently captured is critical to the success of any project."
- "Following a process makes development predictable, can save time, and helps ensure each stage of development is given sufficient consideration before proceeding to the next."
- "Following a process makes software development predictable, saves time in the long run,
and helps ensure each stage of development is given sufficient consideration
before proceeding to the next."
- "Once you get the hang of a programming language, writing code to do what you want is relatively
easy. The hard part is writing code that is easy to adapt when your requirements change."
---

In this section, we will take a step back from coding development practices and tools
Expand Down Expand Up @@ -65,7 +69,7 @@ Someone who is engineering software takes a wider view:
but there is an assumption that the software - or even just a part of it -
could be reused in the future.

### The Software Development Process
### Software Development Process

The typical stages of a software development process can be categorised as follows:

Expand All @@ -75,7 +79,7 @@ The typical stages of a software development process can be categorised as follo
This helps maintain a clear direction throughout development,
and sets clear targets for what the software needs to do.
- **Design:** where the requirements are translated into an overall design for the software.
It covers what will be the basic software 'components' and how they'll fit together,
It covers what will be the basic software 'components' and how they will fit together,
as well as the tools and technologies that will be used,
which will together address the requirements identified in the first stage.
- **Implementation:** the software is developed according to the design,
Expand All @@ -99,7 +103,7 @@ these stages are followed implicitly or explicitly in every software project.
What is required for a project (during requirements gathering) is always considered, for example,
even if it isn't explored sufficiently or well understood.

Following a process of development offers some major benefits:
Following a **process** of development offers some major benefits:

- **Stage gating:** a quality *gate* at the end of each stage,
where stakeholders review the stage's outcomes to decide
Expand All @@ -115,31 +119,27 @@ Following a process of development offers some major benefits:
- **Transparency:** essentially, each stage generates output(s) into subsequent stages,
which presents opportunities for them to be published
as part of an open development process.
- **It saves time:** a well-known result from
- **Time saving:** a well-known result from
[empirical software engineering studies](https://web.archive.org/web/20160731150816/http://superwebdeveloper.com/2009/11/25/the-incredible-rate-of-diminishing-returns-of-fixing-software-bugs/)
is that it becomes exponentially more expensive to fix mistakes in future stages.
For example, if a mistake takes 1 hour to fix in requirements,
is that fixing software mistakes is exponentially more expensive in later software development
stages.
For example, if a mistake takes 1 hour to fix in the requirements stage,
it may take 5 times that during design,
and perhaps as much as 20 times that to fix if discovered during testing.

In this section we will place the actual writing of software (implementation)
within the context of the typical software development process:
within the context of a typical software development process:

- Explore the **importance of software requirements**,
the different classes of requirements,
different classes of requirements,
and how we can interpret and capture them.
- How requirements inform and drive the **design of software**,
the importance, role, and examples of **software architecture**,
and the ways we can describe a software design.
- **Implementation choices** in terms of **programming paradigms**,
looking at **procedural**, **functional**, and **object oriented** paradigms of development.
Modern software will often contain instances of multiple paradigms,
so it is worthwhile being familiar with them and knowing when
to switch in order to make better code.
- How you can (and should) assess and update a software's architecture when
requirements change and complexity increases -
is the architecture still fit for purpose,
or are modifications and extensions becoming increasingly difficult to make?
- How to **improve** existing code to be more **readable**, **testable** and **maintainable**.
- Consider different strategies for writing well designed code, including
using **pure functions**, **classes** and **abstractions**.
- How to create, assess and improve **software design**.


{% include links.md %}
23 changes: 11 additions & 12 deletions _episodes/31-software-requirements.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Software Requirements"
teaching: 15
exercises: 30
teaching: 25
exercises: 15
questions:
- "Where do we start when beginning a new software project?"
- "How can we capture and organise what is required for software to function as intended?"
Expand All @@ -22,7 +22,7 @@ The requirements of our software are the basis on which the whole project rests
if we get the requirements wrong, we'll build the wrong software.
However, it's unlikely that we'll be able to determine all of the requirements upfront.
Especially when working in a research context,
requirements are flexible and may change as we develop our software.
requirements are flexible and may change as we develop our software.

## Types of Requirements

Expand Down Expand Up @@ -223,17 +223,16 @@ and these aspects should be considered as part of the software's non-functional

> ## Optional Exercise: Requirements for Your Software Project
>
> Think back to a piece of code or software (either small or large) you've written,
> Think back to a piece of code or software (either small or large) you have written,
> or which you have experience using.
> First, try to formulate a few of its key business requirements,
> then derive these into user and then solution requirements
> (in a similar fashion to the ones above in *Types of Requirements*).
> then derive these into user and then solution requirements.
{: .challenge}


### Long- or Short-Lived Code?

Along with requirements, here's something to consider early on.
Along with requirements, here is something to consider early on.
You, perhaps with others, may be developing open-source software
with the intent that it will live on after your project completes.
It could be important to you that your software is adopted and used by other projects
Expand All @@ -249,10 +248,10 @@ so be sure to consider these aspects.
On the other hand, you might want to knock together some code to prove a concept
or to perform a quick calculation
and then just discard it.
But can you be sure you'll never want to use it again?
Maybe a few months from now you'll realise you need it after all,
But can you be sure you will never want to use it again?
Maybe a few months from now you will realise you need it after all,
or you'll have a colleague say "I wish I had a..."
and realise you've already made one.
and realise you have already made one.
A little effort now could save you a lot in the future.

## From Requirements to Implementation, via Design
Expand All @@ -269,12 +268,12 @@ At each level, not only are the perspectives different,
but so are the nature of the objectives and the language used to describe them,
since they each reflect the perspective and language of their stakeholder group.

It's often tempting to go right ahead and implement requirements within existing software,
It is often tempting to go right ahead and implement requirements within existing software,
but this neglects a crucial step:
do these new requirements fit within our existing design,
or does our design need to be revisited?
It may not need any changes at all,
but if it doesn't fit logically our design will need a bigger rethink
but if it does not fit logically our design will need a bigger rethink
so the new requirement can be implemented in a sensible way.
We'll look at this a bit later in this section,
but simply adding new code without considering
Expand Down
Loading