-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyagni.ts
More file actions
36 lines (27 loc) · 781 Bytes
/
yagni.ts
File metadata and controls
36 lines (27 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// YAGNI PRINCIPLE
/*
Fast Overview
- Y: You
- A: Aren't
- G: Goona
- N: Need
- I: It
*/
// Don't write functionality (code) that you THINK IT MIGHT gonna be useful in the future
// Implement just the code that you need RIGHT NOW
// A LOT OF TIMES, the things that you thought might be useful are not (don't waste your time!)
// ? Wrong Example
// This method will never be used (as now)
class AUser {
constructor(public name: string) {}
// Maybe someday i will send an SMS (not so important)
sendSMS(phoneNumber: string, message: string) {
console.log(`Sending to ${phoneNumber}: ${message}`)
}
}
// ? Correct Example
// Don't write things that you don't need
class User {
constructor(public name: string) {}
// When we're gonna need it, we're gonna write it
}