How To
Pull request(BitBucket) vs Merge request(Gitlab)
Pull request = Merge request
Projects(BitBucket) vs Groups(Gitlab)
Projects = Groups
Single Responsibility
class Order {
public calculateTotalSum() {...}
public getItems() {...}
}
Better
class OrderRepository {
public save() {...}
public update() {...}
public delete() {...}
}
class OrderView {
public printOrder() {...}
public showOrder() {...}
}
Single Responsibility
Enable two-factor authentication
Open/closed
abstract class Screening {
abstract getTitle(): string;
public getDescription(): string {
return "Get your Credit Score & Report. Do not worry";
}
}
Better
class TransUnion extends Screening {
public getTitle(): string {
return "TransUnion: Credit Scores, Credit Reports";
}
}
class RentPrep extends Screening {
public getTitle(): string {
return "RentPrep: Tenant Screening Services & Rental Background";
}
}
Open/closed
Add SSH key
In Terminal:
if you already have key start from step 5
Liskov Substitution
interface User {
getSessionID(): ID;
}
interface UserWithAccess {
hasAccess(action: Actions): boolean;
}
interface UserWithProfile {
updateProfile(data: Profile): CommandStatus;
}
class BaseUser implements User {
constructor() {
// ...
}
getSessionID(): ID {
return this.sessID;
}
}
Interfaces
Base class
Liskov Substitution
class RegularUser extends BaseUser implements UserWithAccess, UserWithProfile {
constructor() {
super();
}
hasAccess(action: Actions): boolean {
// ...
return access;
}
updateProfile(data: Profile): CommandStatus {
// ...
return status;
}
}
class Guest extends BaseUser implements UserWithAccess {
constructor() {
super();
}
hasAccess(action: Actions): boolean {
// ...
return access;
}
}
Liskov Substitution
CI and branch rules
Interface Segregation
interface CloudHostingProvider {
createServer(region: string);
listServers(region: string);
}
Better
class Dropbox implements CloudStorageProvider {
public storeFile(name: string) {...};
public getFile(name: string) {...};
}
class Amazon implements CloudStorageProvider, CloudHostingProvider,
CDNProvider {
public storeFile(name: string) {...};
public getFile(name: string) {...};
public createServer(region: string) {...};
public listServers(region: string) {...};
public getCDNAddress() {...};
}
interface CloudCDNProvider {
getCDNAddress();
}
interface CloudStorageProvider {
storeFile(name: string);
getFile(name: string);
}
Interface Segregation
Create test link
1. Від гілки стейж робим гілку testlink/назва(до 8 символів), слово testlink є обов'язковим, в іншому випадку лінк не створиться.
2. На сторінці проекту зліва в меню заходим CI/CD -> Pipelines, знаходим назву свого пайлайну по назві гілки, клікаєм на dropdown і вибираєм Create test link:
3. Щоб оновити тестовий лінк потрібно потрібно змерджити МР в гілку feature
Dependency Inversion
class Report {
private db: MongoDB; // private db: MySQL;
constructor(private MongoDB: MongoDB) { // private MySQL: MySQL
this.db = MongoDB; // this.db = MySQL;
}
public deleteItem(id: number) {
this.db.remove(id); // this.db.delete(id);
};
}
class MongoDB {
public update(id: number) {...};
public remove(id: number) {...};
}
Low level class
High level class
Dependency Inversion
class Report {
private db: DataBaseInterface;
constructor(private MongoDB: DataBaseInterface) {
this.db = MongoDB;
}
public deleteItem(id: number) {
this.db.delete(id);
};
}
class MongoDB implements DataBaseInterface {
public update(id: number) {...};
public delete(id: number) {...};
}
class MySQL implements DataBaseInterface {
public update(id: number) {...};
public delete(id: number) {...};
}
interface DataBaseInterface {
update(id: number): void;
delete(id: number): void;
}
Low level class
High level class
Abstraction
Dependency Inversion
Destroy test link
1. На сторінці проекту зліва в меню заходим в Deployments, далі Environments
2. Шукаєм назву своєї! гілки, далі кнопка Stop і Stop environment(confirmation)