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
<h4align="center">🧠 Laws, Theories, Principles and Patterns for developers and technologists.</h4>
3
10
@@ -86,18 +93,14 @@
86
93
-[Online Resources](#online-resources)
87
94
-[PDF eBook](#pdf-ebook)
88
95
-[Podcast](#podcast)
89
-
-[Translations](#translations)
90
-
-[Related Projects](#related-projects)
91
-
-[Contributing](#contributing)
92
-
-[TODO](#todo)
93
96
94
97
<!-- vim-markdown-toc -->
95
98
96
99
## Introduction
97
100
98
101
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!
99
102
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.
101
104
102
105
## Laws
103
106
@@ -142,7 +145,6 @@ The diagram below shows some examples of potential improvements in speed:
*(Image Reference: By Daniels219 at English Wikipedia, Creative Commons Attribution-Share Alike 3.0 Unported, https://en.wikipedia.org/wiki/File:AmdahlsLaw.svg)*
146
148
147
149
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.
148
150
@@ -275,7 +277,6 @@ As a person's understanding and experience in a domain grows, they may well enco
275
277
276
278
Real-world examples:
277
279
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.
279
280
280
281
### Fitts' Law
281
282
@@ -285,7 +286,6 @@ Fitts' law predicts that the time required to move to a target area is a functio
*(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)*
289
289
290
290
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.
291
291
@@ -357,7 +357,6 @@ In the equation below, `T` is the time to make a decision, `n` is the number of
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.
363
362
@@ -408,7 +407,6 @@ The Hype Cycle is a visual representation of the excitement and development of t
*(Image Reference: By Jeremykemp at English Wikipedia, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=10547051)*
412
410
413
411
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".
414
412
@@ -423,7 +421,6 @@ In short, this cycle suggests that there is typically a burst of excitement arou
423
421
>
424
422
> (Hyrum Wright)
425
423
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.
427
424
428
425
See also:
429
426
@@ -550,7 +547,6 @@ Example:
550
547
551
548
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.
552
549
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*.
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%."
568
563
569
564
However, _Premature Optimization_ can be defined (in less loaded terms) as optimizing before we know that we need to.
570
565
@@ -652,7 +647,6 @@ Following this principal limits the scope of changes, making them easier and saf
652
647
653
648
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.
654
649
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.
656
650
657
651
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.
658
652
@@ -939,11 +933,6 @@ See Also:
939
933
940
934
This is an acronym, which refers to:
941
935
942
-
* S: [The Single Responsibility Principle](#the-single-responsibility-principle)
These are key principles in [Object-Oriented Programming](#todo). Design principles such as these should be able to aid developers build more maintainable systems.
949
938
@@ -1068,7 +1057,6 @@ See also:
1068
1057
1069
1058
[YAGNI on Wikipedia](https://en.wikipedia.org/wiki/You_ain%27t_gonna_need_it)
1070
1059
1071
-
This is an acronym for _**Y**ou **A**in't **G**onna **N**eed **I**t_.
1072
1060
1073
1061
> Always implement things when you actually need them, never when you just foresee that you need them.
1074
1062
>
@@ -1155,47 +1143,3 @@ Hacker Laws has been featured in [The Changelog](https://changelog.com/podcast/4
|[🇮🇩 Bahasa Indonesia / Indonesian](./translations/pt-BR.md)|[arywidiantara](https://github.com/arywidiantara)|[](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)|[](https://gitlocalize.com/repo/2513/pt-BR?utm_source=badge)|
|[🇰🇷 한국어 / 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)|[](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)|[](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 |
|[🇹🇷 Türkçe / Turkish](https://github.com/umutphp/hacker-laws-tr)|[Umut Işık](https://github.com/umutphp)|[](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)|[](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)|[](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