Skip to Content
실무로 통하는 클린 코드
book

실무로 통하는 클린 코드

by 막시밀리아노 콘티에리, 이태영
August 2024
Beginner to intermediate
488 pages
11h 1m
Korean
Hanbit Media, Inc.
Content preview from 실무로 통하는 클린 코드
419
22
예외
ioException.printStackTrace();
}
}
}
}
새로운 예외는 동작 메서드를 오버라이드해야 합니다. 코드, 설명, 재실행 등을 갖는 것은 동작
이 아닙니다. 모든
Person
인스턴스에서 서로 다른 이름을 반환하는 것은 원하지 않을 것입니
다. 그렇다면 예외에서는 왜 이렇게 하는 걸까요? 특정한 예외를 얼마나 자주 잡아내나요? 코
드를 확인해보세요. 반드시 클래스여야 할 필요가 있을까요? 이미 클래스에 결합되어 있습니
다. 그렇다면 설명에 대신 결합하세요. 예외 인스턴스는 싱글턴이 되어서는 안 됩니다.
관련 레시피
3
.
1
절 ‘빈약한 객체를 풍성한 객체로 변환하기’
19
.
9
절 ‘비어 있는 클래스 마이그레이션하기’
22.3
예상 가능한 상황을 위한 예외 재작성하기
문제
예상되고 유효한 비즈니스 사례에 대해 예외를 사용합니다.
해결
제어 흐름에 예외를 사용하지 마세요.
설명
예외는
goto
, 플래그와 유사하며 (
18
.
3
절 ‘
goto
를 구조화된 코드로 대체하기’ 참조), 일
반적인 경우에 사용하면 가독성이 떨어지며 놀람 최소화 원칙을 위반합니다 (
5
.
6
절 ‘변경 가능
한 상수 고정하기’ 참조 ). 예외는 예상치 못한 상황에만 사용해야 하며 계약 위반만을 처리해야
합니다 (
13
.
2
절 ‘전제 조건 적용하기’ 참조 ).
다음은 무한 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

데이터 과학을 위한 통계(2판)

데이터 과학을 위한 통계(2판)

이준용, 피터 브루스, 앤드루 브루스, 피터 게데크
클라우드 네이티브 애플리케이션 디자인 패턴

클라우드 네이티브 애플리케이션 디자인 패턴

카순 인드라시리, 스리스칸다라자 수호티얀
데이터 엔지니어를 위한 97가지 조언

데이터 엔지니어를 위한 97가지 조언

Tobias Macey, 임혜연(Lim Hye Yeon)

Publisher Resources

ISBN: 9791169212779