Skip to content

Commit c1c7f01

Browse files
committed
build: testing new build
1 parent d6a7d4e commit c1c7f01

File tree

7 files changed

+150
-131
lines changed

7 files changed

+150
-131
lines changed

.github/release-please-config.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"release-type": "simple",
3+
"bump-minor-pre-major": true,
4+
"packages": {
5+
".": {
6+
"release-type": "simple",
7+
"extra-files": [
8+
{
9+
"type": "generic",
10+
"path": "README.md"
11+
}
12+
],
13+
"changelog-path": ".github/CHANGELOG.md"
14+
}
15+
}
16+
}
17+
18+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.1.0"
3+
}

.github/workflows/build-on-pull-request.yaml

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,3 @@ name: "Validate Pull Request"
22
on:
33
pull_request:
44

5-
jobs:
6-
test-website-build:
7-
runs-on: ubuntu-24.04
8-
steps:
9-
- name: Checkout
10-
uses: actions/checkout@v4
11-
12-
- name: Test Website Build
13-
run: |
14-
cd .github/website
15-
make install
16-
make build
17-
cp -r build/. '../pages'
18-
ls -al "../pages"
19-
20-
prepare-pdf:
21-
runs-on: ubuntu-24.04
22-
steps:
23-
- name: Checkout
24-
uses: actions/checkout@v4
25-
26-
# Set a descriptive version. For PRs it'll be the short sha.
27-
- name: Set Version
28-
id: set_version
29-
run: echo ::set-output name=VERSION::$(git rev-parse --short HEAD)
30-
31-
# Prepare the content files.
32-
- name: Prepare Content
33-
run: ./scripts/prepare-markdown-for-ebook.sh ${{ steps.set_version.outputs.VERSION }}
34-
35-
# Create a PDF from the prepared markdown.
36-
- name: Prepare PDF
37-
uses: docker://pandoc/latex:2.9
38-
with:
39-
args: "-V toc-title:\"Table Of Contents\" --toc --pdf-engine=pdflatex --standalone --output hacker-laws.pdf hacker-laws.md"
40-
41-
# Publish the PDF and intermediate markdown as an artifact.
42-
- name: Publish PDF Artifact
43-
uses: actions/upload-artifact@master
44-
with:
45-
name: hacker-laws.pdf
46-
path: hacker-laws.pdf
47-
48-
- name: Publish Intermediate Markdown Artifact
49-
uses: actions/upload-artifact@master
50-
with:
51-
name: hacker-laws.md
52-
path: hacker-laws.md
53-

.github/workflows/cicd.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
test-website-build:
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v5
19+
20+
- name: Test Website Build
21+
run: |
22+
cd .github/website
23+
make install
24+
make build
25+
cp -r build/. '../pages'
26+
ls -al "../pages"
27+
28+
release:
29+
needs: test-website-build
30+
runs-on: ubuntu-24.04
31+
outputs:
32+
released: ${{ steps.release-please.outputs.release_created }}
33+
tag: ${{ steps.release-please.outputs.tag_name }}
34+
steps:
35+
- uses: googleapis/release-please-action@v4
36+
id: release-please
37+
with:
38+
manifest-file: .github/release-please-manifest.json
39+
config-file: .github/release-please-config.json
40+
41+
release-pdf:
42+
runs-on: ubuntu-24.04
43+
needs: release
44+
if: ${{ needs.release.outputs.released }}
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v5
48+
49+
# Set a descriptive version. For PRs it'll be the short sha.
50+
- name: Check Version
51+
run: echo "${VERSION}"
52+
env:
53+
VERSION: ${{ needs.release.outputs.tag }}
54+
55+
# Set a descriptive version. For PRs it'll be the short sha.
56+
- name: Prepare Markdown
57+
run: |
58+
# Set the env vars we use (version set for clarity).
59+
export DATE=$(date +%F)
60+
export VERSION="${VERSION}"
61+
make prepare-markdown
62+
env:
63+
VERSION: ${{ needs.release.outputs.tag }}
64+
65+
# Create the PDF files.
66+
- name: Create PDF
67+
run: make create-pdf
68+
69+
# Publish the PDF and intermediate markdown as an artifact.
70+
# - name: Publish PDF Artifact
71+
# uses: actions/upload-artifact@3
72+
# with:
73+
# name: hacker-laws.pdf
74+
# path: hacker-laws.pdf
75+
76+
- name: Attach assets to GitHub Release
77+
env:
78+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
run: |
80+
gh release upload "${{ needs.release.outputs.tag }}" --clobber hacker-laws.pdf hacker-laws.md

README.md

Lines changed: 8 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
---
2+
title: "Hacker Laws"
3+
author: "Dave Kerr, github.com/dwmkerr/hacker-laws"
4+
subtitle: "Laws, Theories, Principles, and Patterns that developers will find useful. ${VERSION}, ${DATE}."
5+
version: ${VERSION}
6+
---
7+
18
<h1 align="center"><a href="https://hacker-laws.com" target="_blank">hacker-laws</a></h1>
29
<h4 align="center">🧠 Laws, Theories, Principles and Patterns for developers and technologists.</h4>
310

@@ -86,18 +93,14 @@
8693
- [Online Resources](#online-resources)
8794
- [PDF eBook](#pdf-ebook)
8895
- [Podcast](#podcast)
89-
- [Translations](#translations)
90-
- [Related Projects](#related-projects)
91-
- [Contributing](#contributing)
92-
- [TODO](#todo)
9396

9497
<!-- vim-markdown-toc -->
9598

9699
## Introduction
97100

98101
There are lots of laws which people discuss when talking about development. This repository is a reference and overview of some of the most common ones. Please share and submit PRs!
99102

100-
: This repo contains an explanation of some laws, principles and patterns, but does not _advocate_ for any of them. Whether they should be applied will always be a matter of debate, and greatly dependent on what you are working on.
103+
Warning: This repo contains an explanation of some laws, principles and patterns, but does not _advocate_ for any of them. Whether they should be applied will always be a matter of debate, and greatly dependent on what you are working on.
101104

102105
## Laws
103106

@@ -142,7 +145,6 @@ The diagram below shows some examples of potential improvements in speed:
142145

143146
<img width="480px" alt="Diagram: Amdahl's Law" src="./images/amdahls_law.png" />
144147

145-
*(Image Reference: By Daniels219 at English Wikipedia, Creative Commons Attribution-Share Alike 3.0 Unported, https://en.wikipedia.org/wiki/File:AmdahlsLaw.svg)*
146148

147149
As can be seen, even a program which is 50% parallelisable will benefit very little beyond 10 processing units, whereas a program which is 95% parallelisable can still achieve significant speed improvements with over a thousand processing units.
148150

@@ -275,7 +277,6 @@ As a person's understanding and experience in a domain grows, they may well enco
275277

276278
Real-world examples:
277279

278-
* [Apple vs. FBI: Why This Anti-Terror Hawk Switched Sides](https://fortune.com/2016/03/10/apple-fbi-lindsay-graham/) - In 2016 Senator Lindsey Graham changed his stance on Apple creating a 'backdoor' in their encryption of devices. Initially Graham had been critical of Apple challenging a request to create a 'backdoor', which he saw as necessary to investigate potential terrorist plots. However, by Graham's own admission, as he learned more about the technical complexity of the domain, he realised that he had assumed it to be far more simple than he had realised, and that such a backdoor could have serious negative consequences. This could potentially be considered an example of the Dunning-Kruger effect - a cyber-security expert would likely understand immediately how such a backdoor could be exploited, as they have deep understanding of the domain, a layperson might assume that phone security is more similar to _physical security_ where the practice of having a 'master key' for law enforcement is possible, but this analogy does not apply sufficiently well to describe modern encryption in cyber-security.
279280

280281
### Fitts' Law
281282

@@ -285,7 +286,6 @@ Fitts' law predicts that the time required to move to a target area is a functio
285286

286287
<img width="300px" alt="Diagram: Fitts Law" src="./images/Fitts_Law.svg" />
287288

288-
*(Image Reference: By Foobar628 at English Wikipedia, Creative Commons Attribution-Share Alike 3.0 Unported, https://en.wikipedia.org/wiki/Fitts%27s_law#/media/File:Fitts_Law.svg)*
289289

290290
The consequences of this law dictate that when designing UX or UI, interactive elements should be as large as possible and the distance between the users attention area and interactive element should be as small as possible. This has consequences on design, such as grouping tasks that are commonly used with one another close.
291291

@@ -357,7 +357,6 @@ In the equation below, `T` is the time to make a decision, `n` is the number of
357357

358358
![Hicks law](./images/hicks_law.svg)
359359

360-
*(Image Reference: Creative Commons Attribution-Share Alike 3.0 Unported, https://en.wikipedia.org/wiki/Hick%27s_law)*
361360

362361
This law only applies when the number of options is _ordered_, for example, alphabetically. This is implied in the base two logarithm - which implies the decision maker is essentially performing a _binary search_. If the options are not well ordered, experiments show the time taken is linear.
363362

@@ -408,7 +407,6 @@ The Hype Cycle is a visual representation of the excitement and development of t
408407

409408
![The Hype Cycle](./images/gartner_hype_cycle.png)
410409

411-
*(Image Reference: By Jeremykemp at English Wikipedia, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=10547051)*
412410

413411
In short, this cycle suggests that there is typically a burst of excitement around new technology and its potential impact. Teams often jump into these technologies quickly, and sometimes find themselves disappointed with the results. This might be because the technology is not yet mature enough, or real-world applications are not yet fully realised. After a certain amount of time, the capabilities of the technology increase and practical opportunities to use it increase, and teams can finally become productive. Roy Amara's quote sums this up most succinctly - "We tend to overestimate the effect of a technology in the short run and underestimate in the long run".
414412

@@ -423,7 +421,6 @@ In short, this cycle suggests that there is typically a burst of excitement arou
423421
>
424422
> (Hyrum Wright)
425423
426-
Hyrum's Law states that when you have a _large enough number of consumers_ of an API, all behaviours of the API (even those not defined as part of a public contract) will eventually come to be depended on by someone. A trivial example may be non-functional elements such as the response time of an API. A more subtle example might be consumers who are relying on applying a regex to an error message to determine the *type* of error of an API. Even if the public contract of the API states nothing about the contents of the message, indicating users should use an associated error code, _some_ users may use the message, and changing the message essentially breaks the API for those users.
427424

428425
See also:
429426

@@ -550,7 +547,6 @@ Example:
550547
551548
In its original context, this Law was based on studies of bureaucracies. It may be pessimistically applied to software development initiatives, the theory being that teams will be inefficient until deadlines near, then rush to complete work by the deadline, thus making the actual deadline somewhat arbitrary.
552549

553-
If this law were combined with [Hofstadter's Law](#hofstadters-law), an even more pessimistic viewpoint is reached - work will expand to fill the time available for its completion and *still take longer than expected*.
554550

555551
See also:
556552

@@ -564,7 +560,6 @@ See also:
564560
>
565561
> [(Donald Knuth)](https://twitter.com/realdonaldknuth?lang=en)
566562
567-
In Donald Knuth's paper [Structured Programming With Go To Statements](http://wiki.c2.com/?StructuredProgrammingWithGoToStatements), he wrote: "Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: **premature optimization is the root of all evil**. Yet we should not pass up our opportunities in that critical 3%."
568563

569564
However, _Premature Optimization_ can be defined (in less loaded terms) as optimizing before we know that we need to.
570565

@@ -652,7 +647,6 @@ Following this principal limits the scope of changes, making them easier and saf
652647
653648
This law states that abstractions, which are generally used in computing to simplify working with complicated systems, will in certain situations 'leak' elements of the underlying system, this making the abstraction behave in an unexpected way.
654649

655-
An example might be loading a file and reading its contents. The file system APIs are an _abstraction_ of the lower level kernel systems, which are themselves an abstraction over the physical processes relating to changing data on a magnetic platter (or flash memory for an SSD). In most cases, the abstraction of treating a file like a stream of binary data will work. However, for a magnetic drive, reading data sequentially will be *significantly* faster than random access (due to increased overhead of page faults), but for an SSD drive, this overhead will not be present. Underlying details will need to be understood to deal with this case (for example, database index files are structured to reduce the overhead of random access), the abstraction 'leaks' implementation details the developer may need to be aware of.
656650

657651
The example above can become more complex when _more_ abstractions are introduced. The Linux operating system allows files to be accessed over a network but represented locally as 'normal' files. This abstraction will 'leak' if there are network failures. If a developer treats these files as 'normal' files, without considering the fact that they may be subject to network latency and failures, the solutions will be buggy.
658652

@@ -939,11 +933,6 @@ See Also:
939933

940934
This is an acronym, which refers to:
941935

942-
* S: [The Single Responsibility Principle](#the-single-responsibility-principle)
943-
* O: [The Open/Closed Principle](#the-openclosed-principle)
944-
* L: [The Liskov Substitution Principle](#the-liskov-substitution-principle)
945-
* I: [The Interface Segregation Principle](#the-interface-segregation-principle)
946-
* D: [The Dependency Inversion Principle](#the-dependency-inversion-principle)
947936

948937
These are key principles in [Object-Oriented Programming](#todo). Design principles such as these should be able to aid developers build more maintainable systems.
949938

@@ -1068,7 +1057,6 @@ See also:
10681057

10691058
[YAGNI on Wikipedia](https://en.wikipedia.org/wiki/You_ain%27t_gonna_need_it)
10701059

1071-
This is an acronym for _**Y**ou **A**in't **G**onna **N**eed **I**t_.
10721060

10731061
> Always implement things when you actually need them, never when you just foresee that you need them.
10741062
>
@@ -1155,47 +1143,3 @@ Hacker Laws has been featured in [The Changelog](https://changelog.com/podcast/4
11551143

11561144
<a href="https://changelog.com/podcast/403" target="_blank"><img src="./images/changelog-podcast.png" width="800px" alt="Changelog Podcast Image" /></a>
11571145

1158-
## Translations
1159-
1160-
Thanks to a number of wonderful contributors, Hacker Laws is available in a number of languages. Please consider sponsoring moderators!
1161-
1162-
| Language | Moderator | Status |
1163-
|----------|-----------|--------|
1164-
| [AR Arabic / Arabic](./translations/ar-AR.md) | [Abdurrahman Rajab - a0m0rajab](https://github.com/a0m0rajab) | . |
1165-
| [🇮🇩 Bahasa Indonesia / Indonesian](./translations/pt-BR.md) | [arywidiantara](https://github.com/arywidiantara) | [![gitlocalized ](https://gitlocalize.com/repo/2513/id/badge.svg)](https://gitlocalize.com/repo/2513/id?utm_source=badge) |
1166-
| [🇧🇷 Brasileiro / Brazilian](./translations/pt-BR.md) | [Eugênio Moreira](https://github.com/eugenioamn), [Leonardo Costa](https://github.com/leofc97) | [![gitlocalized ](https://gitlocalize.com/repo/2513/pt-BR/badge.svg)](https://gitlocalize.com/repo/2513/pt-BR?utm_source=badge) |
1167-
| [🇨🇳 中文 / Chinese](https://github.com/nusr/hacker-laws-zh) | [Steve Xu](https://github.com/nusr) | Partially complete |
1168-
| [🇩🇪 Deutsch / German](./translations/de.md) | [Vikto](https://github.com/viktodergunov) | [![gitlocalized ](https://gitlocalize.com/repo/2513/de/badge.svg)](https://gitlocalize.com/repo/2513/de?utm_source=badge) |
1169-
| [🇫🇷 Français / French](./translations/fr.md) | [Kevin Bockelandt](https://github.com/KevinBockelandt) | [![gitlocalized ](https://gitlocalize.com/repo/2513/fr/badge.svg)](https://gitlocalize.com/repo/2513/fr?utm_source=badge) |
1170-
| [🇬🇷 ελληνικά / Greek](./translations/el.md) | [Panagiotis Gourgaris](https://github.com/0gap) | [![gitlocalized ](https://gitlocalize.com/repo/2513/el/badge.svg)](https://gitlocalize.com/repo/2513/el?utm_source=badge) |
1171-
| [🇮🇹 Italiano / Italian](https://github.com/csparpa/hacker-laws-it) | [Claudio Sparpaglione](https://github.com/csparpa) | Partially complete |
1172-
| [🇯🇵 JP 日本語 / Japanese](./translations/jp.md) | [Fumikazu Fujiwara](https://github.com/freddiefujiwara)| [![gitlocalized ](https://gitlocalize.com/repo/2513/ja/badge.svg)](https://gitlocalize.com/repo/2513/ja?utm_source=badge) |
1173-
| [🇰🇷 한국어 / Korean](https://github.com/codeanddonuts/hacker-laws-kr) | [Doughnut](https://github.com/codeanddonuts) | Partially complete |
1174-
| [🇱🇻 Latviešu Valoda / Latvian](./translations/lv.md) | [Arturs Jansons](https://github.com/iegik) | [![gitlocalized ](https://gitlocalize.com/repo/2513/lv/badge.svg)](https://gitlocalize.com/repo/2513/lv?utm_source=badge) |
1175-
| [🇮🇷 فارسی / Persian](./translations/fa.md) | [MohammadErfan Gooneh](https://github.com/MEgooneh) | . |
1176-
| [🇵🇱 Polski / Polish](./translations/pl.md) | [Mariusz Kogen](https://github.com/k0gen) | [![gitlocalized ](https://gitlocalize.com/repo/2513/pl/badge.svg)](https://gitlocalize.com/repo/2513/pl?utm_source=badge) |
1177-
| [🇷🇺 Русская версия / Russian](https://github.com/solarrust/hacker-laws) | [Alena Batitskaya](https://github.com/solarrust) | Partially complete |
1178-
| [🇪🇸 Castellano / Spanish](./translations/es-ES.md) | [Manuel Rubio](https://github.com/manuel-rubio) ([Sponsor](https://github.com/sponsors/manuel-rubio)) | Partially complete |
1179-
| [🇹🇷 Türkçe / Turkish](https://github.com/umutphp/hacker-laws-tr) | [Umut Işık](https://github.com/umutphp) | [![gitlocalized ](https://gitlocalize.com/repo/2513/tr/badge.svg)](https://gitlocalize.com/repo/2513/tr?utm_source=badge) |
1180-
| [🇺🇦 українська мова / Ukrainian](./translations/uk.md) | [Nazar](https://github.com/troyane), [Helga Lastivka](https://github.com/HelgaLastivka) | [![gitlocalized ](https://gitlocalize.com/repo/2513/uk/badge.svg)](https://gitlocalize.com/repo/2513/uk?utm_source=badge) |
1181-
| [🇻🇳 Tiếng Việt / Vietnamese](./translations/vu.md) | [Nguyên](https://github.com/truonghoangnguyen), [Trương Hoàng](https://github.com/truonghoangnguyen) | [![gitlocalized ](https://gitlocalize.com/repo/2513/vi/badge.svg)](https://gitlocalize.com/repo/2513/vi?utm_source=badge) |
1182-
1183-
If you would like to update a translation, follow the [Translators Contributor Guide](https://github.com/dwmkerr/hacker-laws/blob/main/.github/contributing.md#translations).
1184-
1185-
## Related Projects
1186-
1187-
- [Tip of the Day](https://tips.darekkay.com/html/hacker-laws-en.html) - Receive a daily hacker law/principle.
1188-
- [Hacker Laws CLI](https://github.com/umutphp/hacker-laws-cli) - List, view and see random laws from the terminal!
1189-
- [Hacker Laws Action](https://github.com/marketplace/actions/hacker-laws-action) - Adds a random Hacker Law to a pull request as a small gift for the contributor, thanks [Umut Işık](https://github.com/umutphp)
1190-
1191-
## Contributing
1192-
1193-
Please do contribute! [Raise an issue](https://github.com/dwmkerr/hacker-laws/issues/new) if you'd like to suggest an addition or change, or [Open a pull request](https://github.com/dwmkerr/hacker-laws/compare) to propose your own changes.
1194-
1195-
Please be sure to read the [Contributing Guidelines](./.github/contributing.md) for requirements on text, style and so on. Please be aware of the [Code of Conduct](./.github/CODE_OF_CONDUCT.md) when engaging in discussions on the project.
1196-
1197-
## TODO
1198-
1199-
Hi! If you land here, you've clicked on a link to a topic I've not written up yet, sorry about this - this is work in progress!
1200-
1201-
Feel free to [Raise an Issue](https://github.com/dwmkerr/hacker-laws/issues) requesting more details, or [Open a Pull Request](https://github.com/dwmkerr/hacker-laws/pulls) to submit your proposed definition of the topic.

0 commit comments

Comments
 (0)