This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ConjugatedGradient { | |
private readonly float $tolerance; | |
private readonly int $maxIterations; | |
public function __construct(float $tolerance = 1e-6, int $maxIterations = 1000) { | |
$this->tolerance = $tolerance; | |
$this->maxIterations = $maxIterations; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ConjugatedGradient { | |
private readonly tolerance: number; | |
private readonly maxIterations: number; | |
constructor(tolerance: number = 1e-6, maxIterations: number = 1000) { | |
this.tolerance = tolerance; | |
this.maxIterations = maxIterations; | |
} | |
minimize( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////// | |
// Step 1: Identify the change point | |
export class Employee { | |
public timeCards: TimeCard[]; | |
public payPeriod: Date[]; | |
public date: Date; | |
public payRate: number; | |
public payDispatcher: PayDispatcher; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We also want to keep the original behavior (paying without logging) | |
////////////////////////////////////////////////// | |
// Step 1: Identify the change point | |
export class Employee { | |
public timeCards: TimeCard[]; | |
public payPeriod: Date[]; | |
public date: Date; | |
public payRate: number; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////// | |
// Step 1: Identify the change point | |
export class Employee { | |
public timeCards: TimeCard[]; | |
public payPeriod: Date[]; | |
public date: Date; | |
public payRate: number; | |
public payDispatcher: PayDispatcher; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////// | |
// Step 1: Identify the change point and determine the sprouted class interface | |
export class QuarterlyReportGenerator { | |
public readonly beginDate: Date; | |
public readonly endDate: Date; | |
public readonly database: Database; | |
constructor() { | |
// constructor with multiple side effects |