Loading...
(function(){<br />
let canvas = document.createElement('canvas'),<br />
ctx = canvas.getContext('2d'),<br />
w = canvas.width = innerWidth,<br />
h = canvas.height = innerHeight,<br />
particles = [],<br />
properties = {<br />
bgColor : 'rgba(17, 17, 19, 1)',<br />
particleColor : 'rgba(255, 40, 40, 1)',<br />
particleRadius : 3,<br />
particleCount : 60,<br />
particleMaxVelocity : 0.5,<br />
lineLength : 150,<br />
particleLife : 6,<br />
};<br />
<br />
document.querySelector('body').appendChild(canvas);<br />
<br />
window.onresize = function() {<br />
w = canvas.width = innerWidth;<br />
h = canvas.height = innerHeight;<br />
}<br />
<br />
class Particle {<br />
constructor() {<br />
this.x = Math.random()*w;<br />Loading...
The unit of reuse is the unit of release.
This is a software architecture principle (often associated with package/component design), meaning that the thing you reuse (library, module, package) should be versioned and released as a single unit.
Classes that change together should be packaged together.
Meaning: if several modules are usually modified for the same reason, keep them in the same package.
CCP is the SRP applied to components.
Classes that aren’t reused together should not be packaged together.
Meaning: don’t force consumers to depend on things they don’t use.
| Principle | Rule | Goal |
|---|---|---|
| REP | Unit of reuse = unit of release | Versioning |
| CCP | Things changing together stay together | Maintainability |
| CRP | Things reused separately stay separate | Lower coupling |