Comments (1)
-
null을 반환하지 않도록 한다.
- String, Collection의 경우 → 빈 String, 빈 Collection을 리턴한다.
- 빈 String과 빈 Collection을 리턴할 수 없는 경우 → 도메인에 맞는 기본값을 리턴한다.
- 도메인에 맞는 기본값이 없는 경우 → null 대신 예외를 던진다.
-
null을 전달하지 않도록 한다.
- 메서드의 인자를 받을 때, null이 오면 에러를 던져주는 코드를 작성한다.
from cleancode.
Related Issues (16)
- 함수당 추상화 수준은 하나로! HOT 5
- 수직 거리 - protected 변수를 피해야 하는 이유 HOT 1
- DTO를 사용하는 이유 HOT 3
- checked exception이 필요한 경우 HOT 1
- [Effective Java] Exception에 관한 규약 HOT 1
- 예외(null) 대신 기본값을 리턴 HOT 3
- checked exception과 unchecked exception (feat. roll-back) HOT 1
- SpringBoot의 다양한 예외 처리 방법 HOT 10
- SpringBoot 예외처리의 내부 구현 HOT 1
- 애초에 null을 넘기지 못하도록 금지하는 정책 HOT 1
- 도메인 특화된 언어 사용 HOT 1
- 프로세스가 동기화하는 기본 알고리즘과 해법
- Servlet 동시성의 내부 구현
- 공유 객체 하나에 여러 메서드가 필요한 상황에는 3가지 방법을 고려
- Thread Safe한 collection
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cleancode.