Software Development Principles

 

Andrii Kucherenko

2

Baby Steps

 

YAGNI

 

KISS

 

DRY

 

Worse is better

 

OOP

 

Инкапсуляция
НаследованиеПолиморфизм

var animal = {
  jumps: null
};

function Rabbit(name) {
    this.name = name
}

Rabbit.prototype = animal;
function Animal() {

}

function Rabbit(name) {
    this.name = name
}

Rabbit.prototype 
    = Object.create(Animal.prototype);
class Animal { 
  constructor(name) {
    this.name = name;
  }
  
  speak() {
    console.log(this.name + ' makes a noise.');
  }
}

class Rabbit extends Animal {
  speak() {
    console.log(this.name + ' makes not a noise.');
  }
}

S.O.L.I.D.
Patterns

 

Functional

 

Like Math
Immutable
Stateless

let numbers = [1, 2, 3, 4, 5];
let sumOfEvenSquares = _.chain(numbers)
    .filter(n => n % 2 === 0)
    .map(n => n * n)
    .sum()
    .value();

// sumOfEvenSquares: 20

let x = [1, 2, 2];

_(x)
    .uniq()
    .map(function(i) { return i + 10 })
    .reverse()
    .value() 

// => [12, 11]

AOP

 

Advice
Pointcut

Aspect

function Class(){}
Class.prototype.__name = "MyClass"; // The attribute
Class.prototype.method1 = function(param1) {
  return param1 + "-method1";
};

var beforeAdviceBehaviour = function(context) {
   console.log("Trace:", context.target.__name,
     "-->", context.method.name, " with parameter");
   console.log(context.method.arguments);
};
new jsAspect.Aspect(
  new jsAspect.Advice.Before(beforeAdviceBehaviour)
).applyTo(Class);

var class = new Class();
class.method1("ParamValue");

//this will log:
/**
Trace: MyClass --> method1 with parameter
["ParamValue"]
*/

Isomorphic

 

Client
Server

 

TRIZ

 

Решение творческих и изобретательских задач
 

Прогнозирование развития технических систем
 

Развитие качеств творческой личности

 

Противоречия
ИКР
АРИЗ

 

Questions?

 

Software development principles

By Andrey Kucherenko

Software development principles

  • 1,330