05. Practice :: 2021/11/17 17:49
개발자를 위한
Java Programming Style Guide (ref. Google style guide)
6. 프로그래밍 실습 (Programming practices)
6.1 @Override: always used
메서드(method)는 합법적일 때마다 @Override 어노테이션(annotation)으로 표시됩니다. 여기에는 슈퍼클래스(super class)의 메서드를 재정의(override)하는 클래스 메서드, 슈퍼인터페이스(super interface)의 메서드를 재지정(respecifying)하는 인터페이스 메서드를 포함합니다.
예외(Exception) : @Deprecared일 경우에는 @Override를 생략할 수 있습니다.
6.2 Caught exceptions: not ignored (예외가 발생했을 때, 무시하지 말 것)
아래 언급된 경우를 제외하고, 예외가 발생했을 때(caught exception) 아무런 응답을 하지 않는 것은 매우 드문 경우입니다. (일반적으로 응답(response)은 기록해야 합니다. 만약 기록이 불가능(“impossible”)하다고 여겨지는 경우에는 AssertionError를 다시 발생(rethrow)시킵니다.)
Catch 블록에서 아무 조치도 취하지 않는 것이 정말 적합할 경우, 정당화되는 이유가 코멘트로 설명되어 있습니다.
try {
int i = Integer.parseInt(response);
return handleNumericResponse(i);
} catch (NumberFormatException ok) {
// it's not numeric; that's fine, just continue
}
return handleTextResponse(response);
예외(Exception) : 테스트에서 발견된 예외는 이름이 기대되는 예외일 경우, 주석없이 무시될 수 있습니다. 다음 코드는 예상되는 예외를 확인하기 위한 아주 일반적인 관용구이기 때문에 주석이 필요하지 않습니다.
try {
emptyStack.pop();
fail();
} catch (NoSuchElementException expected) {
}
6.3 정적 멤버(static members): 클래스를 사용하여 한정(qualified using class)
정적 클래스 멤버(static class member)에 대한 참조(reference)가 규정되어야 하는 경우, 클래스 유형(class type)의 참조나 표현식이 아니라 해당 클래스 이름으로 규정되어야 합니다.
Foo aFoo = ...;
Foo.aStaticMethod(); // good
aFoo.aStaticMethod(); // bad
somethingThatYieldsAFoo().aStaticMethod(); // very bad
6.4 종료자(finalizers) : 사용하지 않음(not used)
Object.finalize를 재정의(override)하는 것은 극히 드문 경우입니다. 사용하지 않습니다.
Tip : 사용하지 마십시오. 반드시 사용해야 할 것 같으면, 먼저 Effective Java 항목 7 “종료자 피하기(Avoid Finalizers)”를 매우 주의 깊에 읽고 이해한 다음에 사용하지 마세요.
-
immediate profit erfahrungen
Tracked from immediate profit erfahrungen | 2023/03/01 15:16 | DELGreat Architect & Artist -
-
kraken2trfqodidvlh4aa337cpzfrhdlfldhve5nf7njhumwr7instad.onion
Tracked from kraken2trfqodidvlh4aa337cpzfrhdlfldhve5nf7njhumwr7instad.onion | 2023/03/02 14:30 | DELGreat Architect & Artist -
-
skin moles pics
Tracked from skin moles pics | 2023/03/03 16:56 | DELGreat Architect & Artist -
-
hemorrhoids oil
Tracked from hemorrhoids oil | 2023/03/03 18:24 | DELGreat Architect & Artist -
-
mole removal tips
Tracked from mole removal tips | 2023/03/03 19:33 | DELGreat Architect & Artist -
-
Best Crypto ranking platform
Tracked from Best Crypto ranking platform | 2023/03/04 19:00 | DELGreat Architect & Artist -
-
Cryptocurrency list
Tracked from Cryptocurrency list | 2023/03/05 00:19 | DELGreat Architect & Artist -
-
Best Crypto ranking platform
Tracked from Best Crypto ranking platform | 2023/03/05 03:11 | DELGreat Architect & Artist -
-
new cryptocurrencies
Tracked from new cryptocurrencies | 2023/03/05 03:59 | DELGreat Architect & Artist -
-
LuckyCrush
Tracked from LuckyCrush | 2023/03/07 17:16 | DELGreat Architect & Artist -
-
sumseltoto
Tracked from sumseltoto | 2023/03/07 21:18 | DELGreat Architect & Artist -
-
maltipoo puppies for sale in canada
Tracked from maltipoo puppies for sale in canada | 2023/03/08 19:36 | DELGreat Architect & Artist -
-
alpilean reviews
Tracked from alpilean reviews | 2023/03/10 14:39 | DELGreat Architect & Artist -
-
alpilean customer reviews
Tracked from alpilean customer reviews | 2023/03/10 20:18 | DELGreat Architect & Artist -
-
twitter trend saudi
Tracked from twitter trend saudi | 2023/03/10 23:26 | DELGreat Architect & Artist -
-
Supplements
Tracked from Supplements | 2023/03/11 17:15 | DELGreat Architect & Artist -
-
SEO 악성 스팸 백링크 제거 서비스
Tracked from SEO 악성 스팸 백링크 제거 서비스 | 2023/03/16 10:50 | DELGreat Architect & Artist -
-
teak outdoor table
Tracked from teak outdoor table | 2023/03/16 14:34 | DELGreat Architect & Artist -
-
Ark 2 Release date
Tracked from Ark 2 Release date | 2023/03/19 18:40 | DELGreat Architect & Artist -
-
Utah Real Estate
Tracked from Utah Real Estate | 2023/03/20 23:53 | DELGreat Architect & Artist -
-
Skiing In Utah
Tracked from Skiing In Utah | 2023/03/21 00:23 | DELGreat Architect & Artist -
-
Have you thought about moving to Utah?
Tracked from Have you thought about moving to Utah? | 2023/03/21 01:02 | DELGreat Architect & Artist -
-
Female private yoga teacher Cape Town
Tracked from Female private yoga teacher Cape Town | 2023/03/21 04:45 | DELGreat Architect & Artist -
-
Yoga personal trainer Cape Town
Tracked from Yoga personal trainer Cape Town | 2023/03/21 05:56 | DELGreat Architect & Artist -
-
Have you thought about moving to Utah?
Tracked from Have you thought about moving to Utah? | 2023/03/21 10:28 | DELGreat Architect & Artist -
-
Skiing In Utah
Tracked from Skiing In Utah | 2023/03/21 12:25 | DELGreat Architect & Artist -
-
Utah Real Estate
Tracked from Utah Real Estate | 2023/03/21 14:42 | DELGreat Architect & Artist -
-
Things to do in Utah
Tracked from Things to do in Utah | 2023/03/21 15:38 | DELGreat Architect & Artist -
-
Hawaii liveview
Tracked from Hawaii liveview | 2023/03/21 17:47 | DELGreat Architect & Artist -