Skip to content

Commit

Permalink
언어와 디자인
Browse files Browse the repository at this point in the history
  • Loading branch information
jojoldu committed Aug 22, 2024
1 parent 78852ae commit b6222e2
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions posts/TS를_만나고/1_getter_setter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 1. TS를 만나고 - 좋은 디자인

```java
public class Course {
private int price;

public int getPrice() {
return price;
}

public void setPrice(int price) {
if (price > 0) { // 간단한 검증 논리
this.price = price;
}
}
}
```

```ts
public class Course {
private int price;

public int getPrice() {
return price;
}

public void setPrice(int price) {
if (price > 0) { // 간단한 검증 논리
this.price = price;
}
}
}
```

```java
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class Course {

private int price;
...

public void setPrice(int price) {
if (price > 0) { // 간단한 검증 논리
this.price = price;
}
}
}
```

0 comments on commit b6222e2

Please sign in to comment.