팀 과제 리뷰

yun·2024년 7월 5일
post-thumbnail

어제 만든 팀 과제를 기반으로 팀원들과 회의하며 자신이 만든 코드를 리뷰하는 시간을 가졌다.

나는 주어진 요구사항대로만 만들었다면 더 효율적인 기능들을 추가한 팀원분들이 있었다. 그 내용은 다음과 같다.

첫번째


나는 이렇게 기본 구조만 만들어 터미널을 키면 바로 닉네임 입력하는 input 메시지가 나오고 입력하면 추가 되는 기능을 했다면

def menu():
    while True:
        print("\n메뉴를 선택하세요:")
        print("1. 회원 추가")
        print("2. 게시물 추가")
        print("3. 특정 작성자(ID)의 게시물 보기")
        print("4. 특정 단어가 포함된 게시물 보기")
        print("5. 종료")
        choice = input("선택: ")


        if choice == '1':
            create_member()
        elif choice == '2':
            create_post()
        elif choice == '3':
            author = input("작성자 ID를 입력하세요: ")
            display_posts_by_author(author)
        elif choice == '4':
            keyword = input("검색할 단어를 입력하세요: ")
            display_posts_by_keyword(keyword)
        elif choice == '5':
            print("프로그램을 종료합니다.")
            break
        else:
            print("잘못된 선택입니다. 다시 시도하세요.")

        print("member 리스트")
        for member in members:
            member.display()
        print("")

        print("post 리스트")
        for post in posts:
            post.display()

다른 팀원분은 이렇게 메뉴를 여러 가지 만들어 번호를 선택하면 나올 수 있도록 선택 기능을 넣었다.

두번째


나는 게시글을 만들면 그냥 기능이 꺼져버리고, 고유의 닉네임을 활용하지 못하는 반면

def create_post():
    username = write_username()

    for member in members:
        if username == member.username:
            while True:
                password = write_pwd()
                if password == member.password:
                    print("로그인 성공")
                    print(member.username)
                    title = input("작성할 post의 제목을 입력해 주세요.")
                    content = input("작성할 post의 내용을 입력해 주세요.")
                    author = member.username
                    new_post = Post(title, content, author)
                    print("post 작성이 완료 되었습니다.")
                    return
                else:
                    print("비밀번호가 일치하지 않습니다. 비밀번호를 재입력하세요.")
    print("일치하는 ID가 없습니다.")


def write_username():
    input_username = input("ID를 입력하세요.")
    return input_username

팀원분은 로그인과 비밀번호가 효과적으로 사용될 수 있게끔 코드를 구현하였다.

세번째


또한 내 해싱 기법은 코드를 넣어도 확인되지 않았던 반면,

def write_pwd():
    input_pwd = input("비밀번호를 입력하세요.")
    sha256_hash = hashlib.sha256()
    sha256_hash.update(input_pwd.encode('UTF-8'))
    hash_input_pwd = sha256_hash.hexdigest()
    return hash_input_pwd

이렇게 해싱이 되었는지 확인할 수 있는 코드도 넣은 걸 볼 수 있었다.

느낀점

다른 팀원분들과 내가 적은 코드를 비교하니 새로운 코드들을 더 알 수 있었고 다양한 방법으로 코드를 더 응용하여 사용할 수 있다는 것을 알게 되었다.
주어진 요건만 충족하는 것이 아니라 내가 적은 코드들이 좀 더 효과적인 방안으로 사용될 수 있을지 고민하고 연구하는 자세가 필요하다고 느꼈다.

0개의 댓글