2021.11.15
before
class Employee {
/*...*/
}
class Salesperson extends Employee {
get name() {
/*...*/
}
}
class Engineer extends Employee {
get name() {
/*...*/
}
}
after
class Employee {
get name() {
/*...*/
}
}
class Salesperson extends Employee {
/*...*/
}
class Engineer extends Employee {
/*...*/
}
before
class Employee {/*...*/}
class Salesperson extends Employee {
private String name;
}
class Engineer extends Employee {
private String name;
}
after
// after
class Employee {
private String name;
}
class Salesperson extends Employee {/*...*/}
class Engineer extends Employee {/*...*/}
before
class Party {
/*...*/
}
class Employee extends Party {
constructor(name, id, monthlyCost) {
super();
this._id = id;
this._name = name;
this._monthlyCost = monthlyCost;
}
}
after
class Party {
constructor(name) {
this._name = name;
}
}
class Employee extends Party {
constructor(name, id, monthlyCost) {
super(name);
this._id = id;
this._monthlyCost = monthlyCost;
}
}
before
class Employee {
get quota {/*...*/}
}
class Engineer extends Employee {/*...*/}
class Salesperson extends Employee {/*...*/}
after
class Employee {/*...*/}
class Engineer extends Employee {/*...*/}
class Salesperson extends Employee {
get quota {/*...*/}
}
before
class Employee {
private String quota;
}
class Engineer extends Employee {/*..*/}
class Salesperson extends Employee {/*..*/}
after
class Employee {/*..*/}
class Engineer extends Employee {/*..*/}
class Salesperson extends Employee {
protected String quota;
}
before
function createEmployee(name, type) {
return new Employee(name, type);
}
after
function createEmployee(name, type) {
switch (type) {
case 'engineer':
return new Engineer(name);
case 'salesperson':
return new Salesperson(name);
case 'manager':
return new Manager(name);
}
}
before
class Person {
get genderCode() {
return 'X';
}
}
class Male extends Person {
get genderCode() {
return 'M';
}
}
class Female extends Person {
get genderCode() {
return 'F';
}
}
after
class Person {
get genderCode() {
return this._genderCode;
}
}
before
class Department {
get totalAnnualCost() {
/*..*/
}
get name() {
/*..*/
}
get headCount() {
/*..*/
}
}
class Employee {
get annualCost() {
/*..*/
}
get name() {
/*..*/
}
get id() {
/*..*/
}
}
after
class Party {
get name() {
/*..*/
}
get annualCost() {
/*..*/
}
}
class Department extends Party {
get annualCost() {
/*..*/
}
get headCount() {
/*..*/
}
}
class Employee extends Party {
get annualCost() {
/*..*/
}
get id() {
/*..*/
}
}
before
class Employee {
/*..*/
}
class Salesperson extends Employee {
/*..*/
}
after
class Employee {
/*..*/
}
before
class Order {
get daysToShip() {
return this._warehouse.daysToShip;
}
}
class PriorityOrder extends Order {
get daysToShip() {
return this._priorityPlan_.daysToShip;
}
}
after
class Order {
get daysToShip() {
return this._priorityDelegate ? this._priorityDelegate.daysToShip : this._warehouse.daysToShip;
}
}
class PriorityOrder extends Order {
get daysToShip() {
return this._priorityPlan_.daysToShip;
}
}
before
class List {
/*..*/
}
class Stack extends List {
/*..*/
}
after
class Stack {
constructor() {
this._storage = new List();
}
}
class List {
/*..*/
}