-
Notifications
You must be signed in to change notification settings - Fork 0
실전 자바 소프트웨어 개발 Chapter4 학습 #1
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
Open
HDPark95
wants to merge
1
commit into
main
Choose a base branch
from
topic/realworld-chatper4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| ## 문서 관리 시스템 | ||
|
|
||
| ### 요구사항 | ||
|
|
||
| 기존 환자 정보 파일을 읽어 색인을 추가하고 검색할 수 있는 형태의 정보로 변환 | ||
|
|
||
| 문서의 형태 : 리포트, 우편물, 이미지 | ||
|
|
||
| 각각의 문서는 관리 대상 파일의 경로와 어떤 환자의 기록물인지 나타내는 정보도 포함 | ||
| 다양한 종류의 문서에서 특정 정보를 포함하는 문서를 검색해 찾기를 원함 | ||
| ex) Joe Bloggs를 포함하는 우편물 문서를 검색하면 그 결과를 반환해야한다. | ||
|
|
||
| 다른 종류의 문서도 추가할 수 있어야한다. | ||
|
|
||
|
|
||
| ### 설계 작업 | ||
|
|
||
| 스위치 문의 문제점 | ||
| - 확장성 낮음, 다른 종류가 추가 될 때 마다 스위치문을 추가해야함. | ||
|
|
||
| 강한 형식의 원칙 | ||
| - 데이터 사용 방법을 규제함 | ||
| - 불변 객체를 활용하면, 오류가 발생 했을 때 오류가 발생하는 원인을 좁힐 수 있고, 불변성 덕분에 안전하게 문서를 색인하거나 캐싱할 수 있따. | ||
|
|
||
| 도메인 클래스 활용 | ||
| - 개념에 이름을 붙이고 수행할 수 있는 동작과 값을 제한함. | ||
| - 발견성을 개선하고 버그 발생 범위를 줄일 수 있다. | ||
|
|
||
| Map의 문제점 | ||
| - 유지보수성과 가독성을 떨어뜨림 | ||
|
|
||
| 유비쿼터스 언어 | ||
| - 훌륭한 소프트웨어 개발팀은 유비쿼터스언어로 소프트웨어를 개발함. | ||
| - 고객과 대화할 때 사용하는 용어를 응용프로그램의 코드와 같은 의미로 사용함. | ||
|
|
||
| 문자화 형식 | ||
|
|
||
| KISS 원칙 | ||
|
|
||
| 리스코프 치환 원칙 : 클래스의 상속과 인터페이스 구현을 올바르게 사용하도록 도와줌. | ||
|
|
||
| 형식 : 클래스나 인터페이스 | ||
| 하위 형식 : 두 형식이 부모와 자식 관계를 이룸 | ||
|
|
||
| 1. 하위 형식에서 선행조건을 더할 수 없음. 부모가 지정한 것보다 더 많은 선행조건을 요구할 수 없음. | ||
| 2. 하위 형식에서 후행조건을 약화시킬 수 없음. | ||
| 3. 슈퍼 형식의 불변자는 하위 형식에서 보존됨. | ||
| 4. 히스토리 규칙 | ||
|
|
||
| is a 규칙 | ||
|
|
||
| 코드를 재사용하기 위한 방법 세가지 | ||
|
|
||
| 1. 유틸클래스 | ||
| 2. 상속 | ||
| 3. 도메인클래스 | ||
|
|
||
| 유틸리티 클래스 | ||
| 장점 : 가장 간단한다 | ||
| 단점 : 시간이 흐를 수록 갓 클래스의 모양을 갖춰진다. | ||
|
|
||
| 상속 사용 | ||
| 일반적으로 상속 관계를 통해 코드를 재사용하는 것은 올바른 방향이 아님. | ||
| 실제 관계를 반영한게 아니라 상속이 쉽게 깨질 수 있음. | ||
|
|
||
| 도메인 클래스 사용 |
25 changes: 25 additions & 0 deletions
25
book/real-world-software-development/chapter4/document-management/build.gradle.kts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| plugins { | ||
| id("java") | ||
| } | ||
|
|
||
| group = "project" | ||
| version = "1.0-SNAPSHOT" | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| dependencies { | ||
| testImplementation(platform("org.junit:junit-bom:5.10.0")) | ||
| testImplementation("org.junit.jupiter:junit-jupiter") | ||
|
|
||
| // JUnit 4 | ||
| testImplementation("junit:junit:4.13.2") | ||
|
|
||
| // Hamcrest | ||
| testImplementation("org.hamcrest:hamcrest:2.2") | ||
| } | ||
|
|
||
| tasks.test { | ||
| useJUnit() | ||
| } | ||
Binary file added
BIN
+594 Bytes
...development/chapter4/document-management/build/classes/java/main/project/Attributes.class
Binary file not shown.
Binary file added
BIN
+815 Bytes
...e-development/chapter4/document-management/build/classes/java/main/project/Document.class
Binary file not shown.
Binary file added
BIN
+3.38 KB
...apter4/document-management/build/classes/java/main/project/DocumentManagementSystem.class
Binary file not shown.
Binary file added
BIN
+1.31 KB
...elopment/chapter4/document-management/build/classes/java/main/project/ImageImporter.class
Binary file not shown.
Binary file added
BIN
+211 Bytes
...e-development/chapter4/document-management/build/classes/java/main/project/Importer.class
Binary file not shown.
Binary file added
BIN
+1.23 KB
...opment/chapter4/document-management/build/classes/java/main/project/InvoiceImporter.class
Binary file not shown.
Binary file added
BIN
+2.05 KB
...lopment/chapter4/document-management/build/classes/java/main/project/LetterImporter.class
Binary file not shown.
Binary file added
BIN
+3.31 KB
...ware-development/chapter4/document-management/build/classes/java/main/project/Query.class
Binary file not shown.
Binary file added
BIN
+1.88 KB
...lopment/chapter4/document-management/build/classes/java/main/project/ReportImporter.class
Binary file not shown.
Binary file added
BIN
+2.8 KB
...e-development/chapter4/document-management/build/classes/java/main/project/TextFile.class
Binary file not shown.
Binary file added
BIN
+387 Bytes
...apter4/document-management/build/classes/java/main/project/UnknownFileTypeException.class
Binary file not shown.
Binary file added
BIN
+4.87 KB
...4/document-management/build/classes/java/test/chpater4/DocumentManagementSystemTest.class
Binary file not shown.
484 changes: 484 additions & 0 deletions
484
...nt-management/build/reports/tests/test/classes/chpater4.DocumentManagementSystemTest.html
Large diffs are not rendered by default.
Oops, something went wrong.
179 changes: 179 additions & 0 deletions
179
...ware-development/chapter4/document-management/build/reports/tests/test/css/base-style.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,179 @@ | ||
|
|
||
| body { | ||
| margin: 0; | ||
| padding: 0; | ||
| font-family: sans-serif; | ||
| font-size: 12pt; | ||
| } | ||
|
|
||
| body, a, a:visited { | ||
| color: #303030; | ||
| } | ||
|
|
||
| #content { | ||
| padding-left: 50px; | ||
| padding-right: 50px; | ||
| padding-top: 30px; | ||
| padding-bottom: 30px; | ||
| } | ||
|
|
||
| #content h1 { | ||
| font-size: 160%; | ||
| margin-bottom: 10px; | ||
| } | ||
|
|
||
| #footer { | ||
| margin-top: 100px; | ||
| font-size: 80%; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| #footer, #footer a { | ||
| color: #a0a0a0; | ||
| } | ||
|
|
||
| #line-wrapping-toggle { | ||
| vertical-align: middle; | ||
| } | ||
|
|
||
| #label-for-line-wrapping-toggle { | ||
| vertical-align: middle; | ||
| } | ||
|
|
||
| ul { | ||
| margin-left: 0; | ||
| } | ||
|
|
||
| h1, h2, h3 { | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| h2 { | ||
| font-size: 120%; | ||
| } | ||
|
|
||
| ul.tabLinks { | ||
| padding-left: 0; | ||
| padding-top: 10px; | ||
| padding-bottom: 10px; | ||
| overflow: auto; | ||
| min-width: 800px; | ||
| width: auto !important; | ||
| width: 800px; | ||
| } | ||
|
|
||
| ul.tabLinks li { | ||
| float: left; | ||
| height: 100%; | ||
| list-style: none; | ||
| padding-left: 10px; | ||
| padding-right: 10px; | ||
| padding-top: 5px; | ||
| padding-bottom: 5px; | ||
| margin-bottom: 0; | ||
| -moz-border-radius: 7px; | ||
| border-radius: 7px; | ||
| margin-right: 25px; | ||
| border: solid 1px #d4d4d4; | ||
| background-color: #f0f0f0; | ||
| } | ||
|
|
||
| ul.tabLinks li:hover { | ||
| background-color: #fafafa; | ||
| } | ||
|
|
||
| ul.tabLinks li.selected { | ||
| background-color: #c5f0f5; | ||
| border-color: #c5f0f5; | ||
| } | ||
|
|
||
| ul.tabLinks a { | ||
| font-size: 120%; | ||
| display: block; | ||
| outline: none; | ||
| text-decoration: none; | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|
|
||
| ul.tabLinks li h2 { | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|
|
||
| div.tab { | ||
| } | ||
|
|
||
| div.selected { | ||
| display: block; | ||
| } | ||
|
|
||
| div.deselected { | ||
| display: none; | ||
| } | ||
|
|
||
| div.tab table { | ||
| min-width: 350px; | ||
| width: auto !important; | ||
| width: 350px; | ||
| border-collapse: collapse; | ||
| } | ||
|
|
||
| div.tab th, div.tab table { | ||
| border-bottom: solid #d0d0d0 1px; | ||
| } | ||
|
|
||
| div.tab th { | ||
| text-align: left; | ||
| white-space: nowrap; | ||
| padding-left: 6em; | ||
| } | ||
|
|
||
| div.tab th:first-child { | ||
| padding-left: 0; | ||
| } | ||
|
|
||
| div.tab td { | ||
| white-space: nowrap; | ||
| padding-left: 6em; | ||
| padding-top: 5px; | ||
| padding-bottom: 5px; | ||
| } | ||
|
|
||
| div.tab td:first-child { | ||
| padding-left: 0; | ||
| } | ||
|
|
||
| div.tab td.numeric, div.tab th.numeric { | ||
| text-align: right; | ||
| } | ||
|
|
||
| span.code { | ||
| display: inline-block; | ||
| margin-top: 0em; | ||
| margin-bottom: 1em; | ||
| } | ||
|
|
||
| span.code pre { | ||
| font-size: 11pt; | ||
| padding-top: 10px; | ||
| padding-bottom: 10px; | ||
| padding-left: 10px; | ||
| padding-right: 10px; | ||
| margin: 0; | ||
| background-color: #f7f7f7; | ||
| border: solid 1px #d0d0d0; | ||
| min-width: 700px; | ||
| width: auto !important; | ||
| width: 700px; | ||
| } | ||
|
|
||
| span.wrapped pre { | ||
| word-wrap: break-word; | ||
| white-space: pre-wrap; | ||
| word-break: break-all; | ||
| } | ||
|
|
||
| label.hidden { | ||
| display: none; | ||
| } |
84 changes: 84 additions & 0 deletions
84
...-software-development/chapter4/document-management/build/reports/tests/test/css/style.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
|
|
||
| #summary { | ||
| margin-top: 30px; | ||
| margin-bottom: 40px; | ||
| } | ||
|
|
||
| #summary table { | ||
| border-collapse: collapse; | ||
| } | ||
|
|
||
| #summary td { | ||
| vertical-align: top; | ||
| } | ||
|
|
||
| .breadcrumbs, .breadcrumbs a { | ||
| color: #606060; | ||
| } | ||
|
|
||
| .infoBox { | ||
| width: 110px; | ||
| padding-top: 15px; | ||
| padding-bottom: 15px; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .infoBox p { | ||
| margin: 0; | ||
| } | ||
|
|
||
| .counter, .percent { | ||
| font-size: 120%; | ||
| font-weight: bold; | ||
| margin-bottom: 8px; | ||
| } | ||
|
|
||
| #duration { | ||
| width: 125px; | ||
| } | ||
|
|
||
| #successRate, .summaryGroup { | ||
| border: solid 2px #d0d0d0; | ||
| -moz-border-radius: 10px; | ||
| border-radius: 10px; | ||
| } | ||
|
|
||
| #successRate { | ||
| width: 140px; | ||
| margin-left: 35px; | ||
| } | ||
|
|
||
| #successRate .percent { | ||
| font-size: 180%; | ||
| } | ||
|
|
||
| .success, .success a { | ||
| color: #008000; | ||
| } | ||
|
|
||
| div.success, #successRate.success { | ||
| background-color: #bbd9bb; | ||
| border-color: #008000; | ||
| } | ||
|
|
||
| .failures, .failures a { | ||
| color: #b60808; | ||
| } | ||
|
|
||
| .skipped, .skipped a { | ||
| color: #c09853; | ||
| } | ||
|
|
||
| div.failures, #successRate.failures { | ||
| background-color: #ecdada; | ||
| border-color: #b60808; | ||
| } | ||
|
|
||
| ul.linkList { | ||
| padding-left: 0; | ||
| } | ||
|
|
||
| ul.linkList li { | ||
| list-style: none; | ||
| margin-bottom: 5px; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider using JUnit Platform for test execution.
The build file configures JUnit 4 for test execution with
useJUnit(), but the primary dependency is JUnit 5 (Jupiter). This may prevent you from using JUnit 5 features.tasks.test { - useJUnit() + useJUnitPlatform() }This change allows you to utilize JUnit 5 features while maintaining backward compatibility with JUnit 4 tests through Jupiter's vintage engine.
📝 Committable suggestion
🤖 Prompt for AI Agents