Philosophy + JavaScript
"organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations"
Seneca, Lucius Annaeus - Letters from a stoic
control those things that are within our power (namely our beliefs, judgments, desires , and attitudes) and be indifferent or apathetic to those things which are not in our power (namely, things external to us)
Nicolas Taleb
Always
Starting point
var aDependency = "I'm a dependency";
var module = (function (publicModule, myDependency) {
var somethingPrivate = "I'm private";
publicModule.somethingPublic = aDependency;
return publicModule;
}(module || {}, aDependency));
var output = module.somethingPublic;
output;
Repl
var aDependency = "I'm a dependency";
var myModule = function (myDependency) {
var publicModule = {};
publicModule.somethingPublic = aDependency;
return publicModule;
};
Repl
Single truth
var aTruth = function () {
var publicModule = {};
publicModule.number = 0;
publicModule.ChangeState = function(aNumber) {
publicModule.number = aNumber;
//Publish
};
return publicModule;
};
var aSubscriber = function()
{
//Subscribe to change
return {};
}
Repl
var longRunning = function()
{
window.setTimeout(function() { logger("Work done") },2000)
}
var yetAnotherLongRunning = function()
{
window.setTimeout(function() {logger("Work done") },1000)
}
longRunning();
yetAnotherLongRunning();
logger("All done!");
JsFiddler
describe("First state", function() {
it("contains spec with an expectation", function() {
expect(true).toBe(true);
});
describe("Something else is going on", function() {
it("contains spec with an expectation", function() {
expect(true).toBe(true);
});
});
});
control those things that are within our power (namely our beliefs, judgments, desires , and attitudes) and be indifferent or apathetic to those things which are not in our power (namely, things external to us)
@emilcardell