Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿš€ 2๋‹จ๊ณ„ - ์ˆ˜๊ฐ•์‹ ์ฒญ(๋„๋ฉ”์ธ ๋ชจ๋ธ) #627

Open
wants to merge 23 commits into
base: mingulee-devel
Choose a base branch
from

Conversation

mingulee-devel
Copy link

์•ˆ๋…•ํ•˜์„ธ์š”!
์ง€๋‚œ๋ฒˆ์— ํ”ผ๋“œ๋ฐฑ ์ฃผ์…จ๋˜ ๋‚ด์šฉ๊ณผ ํ•จ๊ป˜ 2๋‹จ๊ณ„ PR ๋“œ๋ฆฝ๋‹ˆ๋‹ค
์ง„์˜๋‹˜์ด ๋ง์”€ํ•ด์ฃผ์‹  ๋Œ€๋กœ ์‚ฌ๋‹ค๋ฆฌ ๊ฒŒ์ž„์ด ๋๋‚˜๊ณ  PR๋“œ๋ฆด๊นŒ ํ•˜๋‹ค๊ฐ€ ๋ฆฌ๋ทฐ ๊ธฐ๋‹ค๋ฆฌ๋Š” ๋™์•ˆ ์˜ฌ๋ ค๋ด…๋‹ˆ๋‹ค!

์š”๊ตฌ์‚ฌํ•ญ์— ์ ํžŒ๋Œ€๋กœ ํ•œ๋‹ค๊ณ  ํ–ˆ๋Š”๋ฐ ์ œ๊ฐ€ ๊ฐ์ฒด๋ฅผ ์ž˜ ๋‚˜๋ˆˆ๊ฑด์ง€ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค
์Šค์Šค๋กœ ํ•ด๋ณด๊ณ  ์‹ถ์–ด์„œ ์ตœ๋Œ€ํ•œ ๋‹ค๋ฅธ ๋ถ„๋“ค์˜ ์ฝ”๋“œ๋ฅผ ํ™•์ธํ•˜์ง€ ์•Š๊ณ  ํ–ˆ๋Š”๋ฐ
์ง„์ „์ด ์—†์–ด์„œ PR ๋“œ๋ฆฝ๋‹ˆ๋‹ค!

ํ˜น์‹œ ๋ณด์‹œ๊ณ  ํžŒํŠธ๋ฅผ ์ฃผ์‹ค ์ˆ˜ ์žˆ์„๊นŒ์š”?!

์ฝ”๋“œ์—์„œ todo๋ฅผ ๋‹ฌ์•„๋†“์•˜๋Š”๋ฐ์š”
SessionStrategy๋ฅผ ์ƒ์†๋ฐ›๋Š” FreeSession์ด๋ž‘ PaidSession ๋‚˜๋ˆ„์–ด์„œ PaidSession์— canEnroll์ด true์ผ ๋•Œ payment๋ฅผ ๋”ํ•ด์ฃผ๋ ค๊ณ  ํ–ˆ๋Š”๋ฐ ๋ญ”๊ฐ€ ์ด ๋ถ€๋ถ„์ด ์–ด์ƒ‰ํ•˜๊ฒŒ ๋Š๊ปด์ง‘๋‹ˆ๋‹ค... ๐Ÿ˜ข

์˜ค๋Š˜๋„ ์ž˜ ๋ถ€ํƒ ๋“œ๋ฆฝ๋‹ˆ๋‹ค ๐Ÿ˜„


1๋‹จ๊ณ„ ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜

  • ๋ถˆํ•„์š” setDeleted ์‚ฌ์šฉ ์ œ๊ฑฐ
  • DeleteHistory ์ƒ์„ฑ์ž๊ฐ€ ์•„๋‹Œ ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ๋กœ ์ƒ์„ฑํ•˜๋„๋ก ์ˆ˜์ •
  • QuestionBody, Deleted, Answers ๋ถ„๋ฆฌ

Copy link
Member

@jinyoungchoi95 jinyoungchoi95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•ˆ๋…•ํ•˜์„ธ์š” ๋ฏผ์„ ๋‹˜ ๐Ÿ˜„

๋ช‡๊ฐ€์ง€ ์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ฒจ๋‘์—ˆ๋Š”๋ฐ ํ™•์ธ๋ถ€ํƒ๋“œ๋ ค์š” :)

๊ถ๊ธˆํ•˜๊ฑฐ๋‚˜ ๊ณ ๋ฏผ์ด ๋˜๋Š” ๋ถ€๋ถ„์ด ์žˆ์œผ์‹œ๋‹ค๋ฉด ์–ธ์ œ๋“  pr ์ฝ”๋ฉ˜ํŠธ ๋˜๋Š” dm์œผ๋กœ ์š”์ฒญ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.
๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค ๐Ÿ™‡โ€โ™‚๏ธ


import nextstep.payments.domain.Payment;

public class FreeSession implements SessionStrategy {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Session์ด๋ผ๋Š” ๋„๋ฉ”์ธ์ด ์ด๋ฏธ ์žˆ๊ณ  ํ˜„์žฌ ๊ตฌํ˜„์ฒด๋Š” Session์— ๋”ฐ๋ฅธ ๊ฒฐ์ œ ์ „๋žต์ด๊ธฐ ๋•Œ๋ฌธ์— ๋„ค์ด๋ฐ์ด FreeSessionEnrollStrategy์™€ ๊ฐ™์ด ์กฐ๊ธˆ ๋” ๋ช…ํ™•ํ•˜๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š” :)

Comment on lines +25 to +34
public void enroll(Payment payment){ //todo
if(canEnroll(payment)){
payments.add(payment);
}
}

@Override
public boolean canEnroll(Payment payment) {
return !isFull() && payment.isTuitionPaid(tuitionFee);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ตฌ์กฐ๊ฐ€ ์–ด์ƒ‰ํ•ด๋ณด์ด๋Š” ์ด์œ ๋Š” PaidSessionEnrollStrategy๋ฅผ ์–ด๋–ป๊ฒŒ ํ™œ์šฉํ• ๊ฑด์ง€ ๋ช…ํ™•ํ•˜์ง€ ์•Š์•„์„œ์ธ ๊ฒƒ ๊ฐ™์•„์š”. ์ง€๊ธˆ ์„ค๊ณ„ํ•œ ๊ฐ์ฒด์˜ ์—ญํ• ๋กœ๋ณด๋ฉด,

  • ๊ฐ•์˜๊ฐ€ ๊ฒฐ์ œ๊ฐ€๋Šฅํ•œ ์ƒํ™ฉ์ธ์ง€ ํ™•์ธํ•ด์ค€๋‹ค.
    • ์ด๋ฅผ ์œ„ํ•ด ํ˜„์žฌ ์ˆ˜๊ฐ•์ƒ ์ˆ˜, ์ตœ๋Œ€ ์ˆ˜๊ฐ•์ƒ ์ˆ˜, ๊ฐ•์˜๋ฃŒ๋ฅผ ๊ฐ€์ง„๋‹ค.
  • ๊ฒฐ์ œ๋ฅผ ๋ฐ›์•„ ์ˆ˜๊ฐ•๋“ฑ๋กํ•œ๋‹ค.

๋ผ๊ณ  ๋ฐ”๋ผ๋ณธ๋‹ค๋ฉด SessionEnrollStrategy๋Š” "์ˆ˜๊ฐ• ๋“ฑ๋ก"์ด๋ผ๋Š” ๋ช…์ œ๋งŒ ๋™์ž‘ํ•ด์ฃผ๋ฉด๋˜๊ณ , canEnroll์ด ๋˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ์˜ˆ์™ธ๋ฅผ ํ„ฐํŠธ๋ฆฌ๋Š” ๋“ฑ๊ณผ ๊ฐ™์€ ํ–‰์œ„๋กœ ์ƒ๊ฐํ•ด๋ณผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”.

public interface SessionEnrollStrategy {    
    void enroll(Payment payment);
}

๊ฐ€ ๋˜์–ด์•ผํ•˜๊ณ ,

public class PaidSessionEnrollStrategy {
   // ..
   public void enroll(Payment payment) {
        // canEnroll์ด ์•„๋‹Œ ๊ฒฝ์šฐ ์˜ˆ์™ธ
        // count๋ฅผ ์˜ฌ๋ฆฌ๊ณ  ๊ฒฐ์ œ์ •๋ณด ์ €์žฅ

์ด ๋  ์ˆ˜ ์žˆ๊ฒ ์ฃ . ๋‹ค๋งŒ ํ•ด๋‹น ํด๋ž˜์Šค๋„ ์ „๋žต์œผ๋กœ ๋ถˆ๋ฆฌ๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ํ˜ผ๋™์„ ์ค„ ์ˆ˜ ์žˆ๋Š”๋ฐ์š”. "์ „๋žต"์ด๋ผ๋Š” ๊ฒƒ์€ ์–ด๋–ค ํ–‰์œ„๋ฅผ ์–ด๋–ป๊ฒŒ ์‹คํ–‰ํ•˜๋Š๋ƒ๊ฐ€ ์ฃผ์š” ๊ด€์‹ฌ์‚ฌ์ด์ง€ ์ƒํƒœ๋ฅผ ๋“ค๊ณ  ๊ด€๋ฆฌํ•˜๋ฉด์„œ ์ „๋žต์„ ์ถ”๊ตฌํ•˜๋Š”๊ฑด ์ „๋žต์ž์ฒด์˜ ์ฑ…์ž„์„ ํ™•์žฅ์‹œ์ผœ๋ฒ„๋ฆด ์ˆ˜ ์žˆ์–ด์š”. ์ถ”์ƒํ™”๋ฅผ ํ†ตํ•œ ์ ‘๊ทผ์€ ๋งž์ง€๋งŒ ์ „๋žต์ด๋ƒ๋Š” ๊ณ ๋ฏผํ•ด๋ณด์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™๋„ค์š” :)

Comment on lines +5 to +7
public class Sessions {
private List<Session> values;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ฐœ์ธ์ ์œผ๋กœ ๋‹จ์ˆœํžˆ ๋ž˜ํ•‘๋งŒํ•˜๋Š” ํด๋ž˜์Šค๋Š” ์ผ๊ธ‰์ปฌ๋ž™์…˜์œผ๋กœ ๋ฌถ์„ ํ•„์š”๋Š” ์—†๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ํŠน์ • ๋„๋ฉ”์ธ ์ฑ…์ž„ ์—†์ด ๋ฆฌ์ŠคํŠธ์ด๊ธฐ ๋•Œ๋ฌธ์— ์ผ๊ธ‰์ปฌ๋ž™์…˜์œผ๋กœ ๋‘”๋‹ค๋Š” ๊ฒƒ์€ ๊ณผํ•œ ๋ž˜ํ•‘์ด ๋  ์ˆ˜ ์žˆ์–ด์š”.

Comment on lines +12 to +17
public ImageDimensions(int width, int height) {
this.width = width;
this.height = height;
}

public boolean validDimensions() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ƒ์„ฑ์ž์—์„œ validation์„ ํ•˜์ง€ ์•Š์œผ์‹œ๋Š” ์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”? ๊ฐ์ฒด์˜ ์ƒ์„ฑ์€ ๊ฐ์ฒด๊ฐ€ ๋‹ด๋‹นํ•˜๋Š” ๊ฒƒ์ด ๊ฐ์ฒด ์ƒ์„ฑ์˜ ์•ˆ์ •์„ฑ์„ ๋ณด์žฅํ•ด์š” :)

BMP;

public static boolean validExtension(ImageExtension extension) {
if (!Arrays.asList(GIF, JPG, JPEG, PNG, SVG).contains(extension)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํŠน์ • ํ™•์žฅ์ž๋งŒ ๊ด€๋ฆฌํ•˜๊ณ ์‹ถ๋‹ค๋ฉด ์ƒ์ˆ˜๋กœ ๋นผ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™๋„ค์š” :)

package nextstep.courses.domain.session.coverImage;

public class ImageSize {
private int size;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ถˆ๋ณ€์ผ ์ˆ˜ ์žˆ๋Š” ํ•„๋“œ๋“ค์€ ๋ชจ๋‘ ๋ถˆ๋ณ€์œผ๋กœ ์ˆ˜์ •ํ•ด์ฃผ์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š” :)


import java.time.LocalDate;

public class Session {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SessionService๋ฅผ ํ†ตํ•ด enroll ๋กœ์ง์„ ๊ตฌํ˜„ํ•˜๋Š”๊ฒƒ๊นŒ์ง€๊ฐ€ ๋ฏธ์…˜์˜ ์š”๊ตฌ์‚ฌํ•ญ์ด์—์š” :)

private SessionStrategy sessionStrategy;

public Session(SessionCoverImage sessionCoverImage, SessionStatus sessionStatus, SessionStrategy sessionStrategy) {
this(null, null, sessionCoverImage, sessionStatus, sessionStrategy);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋‘˜๋‹ค null์ธ ์ผ€์ด์Šค๋ฅผ ์ƒ์„ฑ์ž์—์„œ ์ง€์›ํ•˜๋Š” ์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”?

Comment on lines +11 to +15
private FreeSession freeSession;

@Test
void ์ˆ˜๊ฐ•์‹ ์ฒญ_๊ฐ€๋Šฅ์—ฌ๋ถ€_ํ™•์ธ() {
freeSession = new FreeSession();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ•„๋“œ๋“ค์„ ๋ถˆ๋ณ€ํ•˜๊ฒŒ ๊ฐ€์ ธ๊ฐ€์ฃผ์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š” :) ๊ฐ€๋ณ€์ ์ธ ํ•„๋“œ๋Š” ๊ฐ€๋ณ€์ ์ผ ์ˆ˜ ์žˆ๋‹ค๋ผ๋Š” ์ปจํ…์ŠคํŠธ๋ฅผ ๊ณ„์† ์•ˆ๊ณ  ์ฝ”๋“œ๋ฅผ ์ฝ๊ฒŒ ๋งŒ๋“ค๊ธฐ ๋•Œ๋ฌธ์— ๊ฐ€๋Šฅํ•˜๋ฉด ์ง€์–‘ํ•ด์ฃผ์‹œ๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

Comment on lines +14 to +29
@Test
void ์ˆ˜๊ฐ•์‹ ์ฒญ_๊ฐ€๋Šฅ์—ฌ๋ถ€_ํ™•์ธ__๊ฐ•์˜_์ˆ˜๊ฐ•๋ฃŒ_ํ™•์ธ() {
paidSession = new PaidSession(3, 2, 20000);
assertTrue(paidSession.canEnroll(new Payment(20000L)));
paidSession = new PaidSession(3, 2, 20000);
assertFalse(paidSession.canEnroll(new Payment(15000L)));
}

@Test
void ์ˆ˜๊ฐ•์‹ ์ฒญ_๊ฐ€๋Šฅ์—ฌ๋ถ€_ํ™•์ธ__์ธ์›์ดˆ๊ณผ_ํ™•์ธ() {

paidSession = new PaidSession(3, 2, 20000);
assertTrue(paidSession.canEnroll(new Payment(20000L)));
paidSession = new PaidSession(2, 2, 20000);
assertFalse(paidSession.canEnroll(new Payment(20000L)));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ „๋ฐ˜์ ์œผ๋กœ ํ…Œ์ŠคํŠธ์—์„œ ์–ด๋–ค๊ฒƒ์„ ํ…Œ์ŠคํŠธํ•˜๊ณ ์žํ•˜๋Š”์ง€๊ฐ€ ๋ช…ํ™•ํ•˜์ง€ ์•Š์€ ๊ฒƒ ๊ฐ™์•„์š”. ํ…Œ์ŠคํŠธ๋‹น ๊ฒ€์ฆํ•˜๊ณ ์žํ•˜๋Š” ๋Œ€์ƒ์€ ๋ช…ํ™•ํ•˜์—ฌ์•ผํ•˜๊ณ , ์ด ๊ธฐ์ค€์ด ์–ด๋ ต๋‹ค๊ณ  ๋Š๋ผ์‹ ๋‹ค๋ฉด assertion์ด ํ•˜๋‚˜์—ฌ์•ผ๋œ๋‹ค๊ณ  ์ƒ๊ฐํ•ด๋ณด์‹œ๋ฉด ํŽธํ•  ๊ฒƒ ๊ฐ™์•„์š”.

์˜ˆ๋ฅผ๋“ค๋ฉด ๊ฐ•์˜ ์ˆ˜๊ฐ•๋ฃŒํ™•์ธ์—์„œ ๊ฒ€์ฆํ•˜๊ณ ์žํ•˜๋Š” ๊ฒƒ์€ canEnroll์ด true์ด๋‹ค์ธ๋ฐ false์ธ๊ฑธ ํ…Œ์ŠคํŠธํ•  ํ•„์š”๊ฐ€ ์žˆ์„๊นŒ์š”? ๋˜ ์ธ์›์ดˆ๊ณผ ํ™•์ธ์ธ๋ฐ canEnroll์ด true์ด๋‹ค์ธ๊ฑธ ํ…Œ์ŠคํŠธํ•  ํ•„์š”๊ฐ€ ์žˆ์„๊นŒ์š”?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants