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

First seminar 과제 제출 #3

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

First seminar 과제 제출 #3

wants to merge 6 commits into from

Conversation

jiyeoon00
Copy link
Member

🍕 기본과제
상속, AOP에 대한 실습을 진행하면서 객체 지향 개념을 공부하였습니다.

🍟 심화과제
추상클래스 Bank를 만들고 이를 구현한 ShinhanBank클래스를 만들었습니다.
은행 관련 서비스를 처리해주는 BankService에서 추상클래스 Bank를 의존하도록 하여 특정 은행에 의존하지 않도록 설계하였습니다.
이후 BankClient에서 BankService를 사용하여 계좌 만들기, 입금, 출금, 잔액확인 등의 기능을 이용해보며 마무리했습니다.

@jiyeoon00 jiyeoon00 added 🙂기본과제 기본과제 😎심화과제 심화과제 labels Apr 18, 2023
@jiyeoon00 jiyeoon00 linked an issue Apr 18, 2023 that may be closed by this pull request
3 tasks
}

@Override
public void sort() {
Copy link
Member

Choose a reason for hiding this comment

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

[P5] 저는 AOP 관련된 예제 코드는 작성을 못해봤었는데, 이렇게 직접 작성해보는 것도 도움이 될 것 같네요!! 참고해서 저도 직접 작성해보겠습니다 :)


Animal animal = new Cat("여자", 3, 6);
animal.eat("우유"); //자식클래스 Cat의 eat() 호출
//animal.superTest(); 상위클래스에서 하위클래스의 함수 알 수 없다!
Copy link
Member

Choose a reason for hiding this comment

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

[P5] 하위 클래스에서는 super 키워드를 통해서 상위 클래스의 메서드를 사용할 수 있지만, 상위 클래스에서는 하위 클래스의 메서드를 알 수 없기에 사용할 수 없다는 의미군요! 한번더 생각해볼 수 있어서 좋았습니다!

Copy link
Member

@ddongseop ddongseop left a comment

Choose a reason for hiding this comment

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

제가 지나친 부분들도 코드로 정리해주셔서 리뷰 하면서 도움이 많이 됐습니다!

Copy link

@YuSuhwa-ve YuSuhwa-ve left a comment

Choose a reason for hiding this comment

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

사실 제가 AOP를 잘 몰라서 언니 AOP 관련 코드를 잘 이해 못했는디...... 이번주 세미나 시간에 물어봐두 되나요..?

@Override
public void sort() {
long start = System.currentTimeMillis();
sortService.sort();

Choose a reason for hiding this comment

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

오옹 성능 테스트 좋아요~

Copy link
Member

Choose a reason for hiding this comment

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

AOP 실습에 성능 테스트까지..!!! 최고다...

public class SortServiceTime implements SortService {
private SortService sortService;

public SortServiceTime(final SortService sortService) {

Choose a reason for hiding this comment

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

DI 적용한 코드 좋아요

@@ -0,0 +1,8 @@
package sopt.org.firstSeminar.AOP;

Choose a reason for hiding this comment

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

저는 AOP에 대해 잘몰라서 이를 코드로 구현하는걸 생각치도 못했네요! AOP 공부해야겠다는 다짐하고 갑니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

사실 제가 AOP를 잘 몰라서 언니 AOP 관련 코드를 잘 이해 못했는디...... 이번주 세미나 시간에 물어봐두 되나요..?

SPRING AOP를 적용했다기보다는 부가기능(시간측정)을 분리한다는 개념으로 실습한거긴해!! 당근 세미나때 물어봐도 좋구..아니면 생각과제>AOP쪽에 저거 구현코드랑 같이 설명 적어놔서 그거 봐도 좋을 듯!!


public Animal(String gender, int age, int weight) {
//내부 생성자 호출로 중복 제거
this(gender, age);

Choose a reason for hiding this comment

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

깔끔하게 코드를 짰네요


public Cat(String gender, int age, int weight) {
//부모 클래스에서 매개변수 있는 생성자 만들어서 기본생성자가 자동으로 호출되지 X
//-> 부모 생성자 호출해줘야 한다.

Choose a reason for hiding this comment

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

자세히 정리해주는거 좋아요

Copy link
Member

Choose a reason for hiding this comment

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

자식 클래스에서 매개변수 있는 생성자를 만들면, 부모 클래스의 기본 생성자가 자동으로 호출되지 않아서 부모 클래스에서 매개변수가 있는 생성자를 만들어준 경우에는 자식 클래스에서 부모 클래스의 생성자를 명시적으로 호출해주어야 하는것..!!!!! 덕분에 다시 되새겨볼수 있어서 좋았습니다.

@@ -0,0 +1,17 @@
package sopt.org.firstSeminar.BankProgram;

public abstract class Bank {

Choose a reason for hiding this comment

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

[P4] 이 코드에서는 Bank를 Sinhan이 상속하는게 변할일이 없지만, 상속을 사용하기보다는 인터페이스 구현을 사용하는게 수정의 용이함과 다중 구현이 가능하다는 점에서 더 좋을것같아요!

Copy link
Member Author

Choose a reason for hiding this comment

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

난 진자 추상클래스 VS 인터페이스를 뭘 선택해야할지 잘 모르겠드라,,일단 이 경우는 클로징멘트를 모든 Bank의 하위클래스에서 고정하고 싶어서 일반메소드를 가질 수 있는 추상클래스를 사용하긴 했는데,, 셤기간 끝나고 좀 더 자세히 파보고 다시 답변할게잉

{
    //클로징 멘트는 고정
    public void printClosingComment() {
        System.out.println("이용해주셔서 감사합니다.");
    }

import java.util.ArrayList;

public class BankClient {
public static ArrayList<Account> accountArrayList;

Choose a reason for hiding this comment

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

[P4] 계좌리스트가 은행안에 있으면 좀더 좋을것아요!. 각 은행당 계좌가 있으니까

public class BankClient {
public static ArrayList<Account> accountArrayList;

public static void main(String[] args) {

Choose a reason for hiding this comment

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

은행 사용자입장에서의 실행이 좋은것같아요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
😎심화과제 심화과제 🙂기본과제 기본과제
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1주차 세미나
4 participants