You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: patterns/everything-as-code.md
+29-1Lines changed: 29 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,17 +17,45 @@ Everything (including [infrastructure](../practices/cloud-services.md)) should b
17
17
## Details
18
18
19
19
* All code is treated the same (e.g. application code, infrastructure code, test code, etc).
20
-
* All code is peer-reviewed and tested.
20
+
* All code is [peer-reviewed](#code-review) and tested.
21
21
* All code is version controlled.
22
22
* Code changes should be automatically checked for code quality using tools like [SonarQube](https://www.sonarqube.org) (as well as via IDE plugins).
23
23
* Code should be automatically scanned for secrets or other sensitive data (see [security](../practices/security.md) for details)
24
24
* Prefer well structured and expressive code over extensive documentation to avoid documentation getting out of date.
25
25
* Design the interface prior to the implementation and choose vocabulary to make it coherent. This includes external interfaces (e.g. REST API) and internal interfaces of classes, method signatures etc.
26
26
* Adopt test-first approach to minimise waste and increase cohesion of the code (see [testing](../practices/testing.md)).
27
27
28
+
### Code review
29
+
30
+
A code review involves another member of the team looking through a proposed code change and providing constructive feedback.
31
+
32
+
Many teams consider code which has been written [as a pair](https://martinfowler.com/articles/on-pair-programming.html) to already have been reviewed, and do not require a separate review.
33
+
34
+
Robert Fink provides an excellent description of the [motivation and practice of code reviews](https://medium.com/palantir/code-review-best-practices-19e02780015f). Some key points from this and other sources ([Google](https://google.github.io/eng-practices/review/reviewer/), [SmartBear](https://smartbear.com/learn/code-review/best-practices-for-peer-code-review/), [Atlassian](https://www.atlassian.com/agile/software-development/code-reviews)) are:
35
+
36
+
#### Egalitarian
37
+
* With the right (basic) training, anyone in the team can review anyone else's code with no hierarchy.
38
+
* Everyone's code must be reviewed, no matter how experienced they are.
39
+
#### Small
40
+
* Code reviews should be relatively small as it is hard to review very large changes effectively.
41
+
* This is one reason to break stories down as small as practical and to implement each incrementally, ensuring no single change is too large to be reviewed well.
42
+
#### Meets user needs
43
+
While effective testing is the best way to detect bugs or non-functional problems, code review plays an important role in spotting _potential_ issues:
44
+
* Does the code look like it will meet the acceptance criteria, or are there obvious errors or omissions?
45
+
* Does it handle edge cases?
46
+
* Are common issues guarded against relating to security (e.g. [OWASP Top 10](https://owasp.org/www-project-top-ten/)), performance, scalability or robustness?
47
+
#### Of high quality
48
+
* Is the code clear and simple?
49
+
* Is the code layout and structure consistent with agreed style and other code?
50
+
* Would it easily allow future modification to meet slightly different needs, e.g. ten times the required data size or throughput?
51
+
28
52
## Examples
29
53
30
54
* Application code written in languages such as Python, Java or C#.
31
55
* Application configuration, held in files (e.g. YAML, Json) held in source control.
32
56
* Declarative infrastructure as "code" (actually often YAML or HCL).
33
57
* Database migrations: SQL scripts held in source control.
58
+
59
+
## Further reading
60
+
61
+
*[Clean Code: A Handbook of Agile Software Craftsmanship](https://learning.oreilly.com/library/view/clean-code-a/9780136083238/)
Copy file name to clipboardExpand all lines: patterns/governance-side-effect.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ Automate preventative measures and ongoing compliance checks to ensure systems m
33
33
Properly configured tooling supports good practice and provides an audit trail through the whole software delivery lifecycle:
34
34
* Use of an issue tracking system such as Jira ensures changing requirements are visible over time.
35
35
* Use of issue references in source control commit messages (which can be enforced with commit hooks) ensures code changes can be traced back to a business requirement.
36
-
* Source control systems provide visibility of who changed what when, and enforce and record peer review approvals.
36
+
* Source control systems provide visibility of who changed what when, and enforce and record [peer review](everything-as-code.md) approvals.
37
37
* Continuous integration systems record the result of build and test stages as well as deployments to each environment, including who did what when.
38
38
* Integration of CI/CD systems with change management systems ensures a consistent view of changes are visible.
39
39
* Cloud platforms provide logs of changes to resources, e.g. AWS CloudTrail.
0 commit comments