Skip to content

Commit f33f395

Browse files
iluwatarwebpro
authored andcommitted
Add robustness principle
1 parent d23120c commit f33f395

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The list was inspired by [The Principles of Good Programming](http://www.artima.
2323
* [Law of Demeter](#law-of-demeter)
2424
* [Composition Over Inheritance](#composition-over-inheritance)
2525
* [Orthogonality](#orthogonality)
26+
* [Robustness Principle](#robustness-principle)
2627

2728
### Module/Class
2829

@@ -250,6 +251,25 @@ Source: [Be Orthogonal](http://www.artima.com/intv/dry3.html)
250251
251252
Source: [Orthogonality](http://en.wikipedia.org/wiki/Orthogonality_(programming))
252253

254+
## Robustness Principle
255+
256+
> Be conservative in what you do, be liberal in what you accept from others
257+
258+
Collaborating services depend on each others interfaces. Often the interfaces need to evolve causing the other end to receive unspecified data. A naive implementation refuses to collaborate if the received data does not strictly follow the specification. A more sophisticated implementation will still work ignoring the data it does not recognize.
259+
260+
Why
261+
262+
* In order to be able to evolve services you need to ensure that a provider can make changes to support new demands while causing minimal breakage to their existing clients.
263+
264+
How
265+
266+
* Code that sends commands or data to other machines (or to other programs on the same machine) should conform completely to the specifications, but code that receives input should accept non-conformant input as long as the meaning is clear.
267+
268+
Resources
269+
270+
* [Robustness Principle in Wikipedia](https://en.wikipedia.org/wiki/Robustness_principle)
271+
* [Tolerant Reader](http://martinfowler.com/bliki/TolerantReader.html)
272+
253273
## Maximise Cohesion
254274

255275
Cohesion of a single module/component is the degree to which its responsibilities form a meaningful unit; higher cohesion is better.

index.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ The list was inspired by [The Principles of Good Programming](http://www.artima.
3030
* [Law of Demeter](#law-of-demeter)
3131
* [Composition Over Inheritance](#composition-over-inheritance)
3232
* [Orthogonality](#orthogonality)
33+
* [Robustness Principle](#robustness-principle)
3334

3435
### Module/Class
3536

3637
* [Maximise Cohesion](#maximise-cohesion)
3738
* [Liskov Substitution Principle](#liskov-substitution-principle)
38-
* [Open/Closed Principle](#open-closed-principle)
39+
* [Open/Closed Principle](#openclosed-principle)
3940
* [Single Responsibility Principle](#single-responsibility-principle)
4041
* [Hide Implementation Details](#hide-implementation-details)
4142
* [Curly's Law](#curlys-law)
@@ -257,6 +258,25 @@ Source: [Be Orthogonal](http://www.artima.com/intv/dry3.html)
257258
258259
Source: [Orthogonality](http://en.wikipedia.org/wiki/Orthogonality_(programming))
259260

261+
## Robustness Principle
262+
263+
> Be conservative in what you do, be liberal in what you accept from others
264+
265+
Collaborating services depend on each others interfaces. Often the interfaces need to evolve causing the other end to receive unspecified data. A naive implementation refuses to collaborate if the received data does not strictly follow the specification. A more sophisticated implementation will still work ignoring the data it does not recognize.
266+
267+
Why
268+
269+
* In order to be able to evolve services you need to ensure that a provider can make changes to support new demands while causing minimal breakage to their existing clients.
270+
271+
How
272+
273+
* Code that sends commands or data to other machines (or to other programs on the same machine) should conform completely to the specifications, but code that receives input should accept non-conformant input as long as the meaning is clear.
274+
275+
Resources
276+
277+
* [Robustness Principle in Wikipedia](https://en.wikipedia.org/wiki/Robustness_principle)
278+
* [Tolerant Reader](http://martinfowler.com/bliki/TolerantReader.html)
279+
260280
## Maximise Cohesion
261281

262282
Cohesion of a single module/component is the degree to which its responsibilities form a meaningful unit; higher cohesion is better.

0 commit comments

Comments
 (0)