Giter Club home page Giter Club logo

java-refactoring-to-patterns's Introduction

java-refactoring-to-patterns


Table-of-Contents

💡 Markdown style 의미

  • 리팩터링 방향 - 목표, 지향, 제거
Chapter Contents Code smell
06.creation Replace Constructors with Creation Methods
Move Creation Knowledge to Factory 문어발 솔루션
Encapsulate Classes with Factory 추잡한 노출
Introduce Polymorphic Creation with Factory Method 중복된 코드
Encapsulate Composite with Builder 기본 타입 강박관념
Inline Singleton 게으른 클래스
07.simplification Compose Method 긴 메서드
Replace Conditional Logic with Strategy 복잡한 조건문
기본 타입 강박관념
긴 메서드
Move Embellishment to Decorator 복잡한 조건문
기본 타입 강박관념
Replace State-Altering Conditionals with State 복잡한 조건문
Replace Implicit Tree with Composite 기본 타입 강박관념
🚧 Replace Conditional Dispatcher with Command 거대한 클래스
긴 메서드
Switch문
08.generalization Form Template Method 중복된 코드
09.protection Replace Type Code with Class 기본 타입 강박관념
Limit Instantiation with Singleton
Introduce Null Object 복잡한 조건문
중복된 코드

Note

  • 이 예제 코드는 책을 기반으로 하였으나 책에서 나오지 않은 부분은 개인의 생각대로 stub 구현되었습니다.
  • 좀 더 편한 검색과 비교를 위해 코드 들여쓰기 및 변수, 메서드 네이밍 등 최대한 책과 동일하게 작성하려 했습니다.
  • shell script를 실행하여 연습용 디렉토리(exercise)를 생성할 수 있습니다.

Shell-script-descriptions

  • ❓ 이 스크립트가 하는 일
    • exercise 패키지가 없으면, 생성하여 example 패키지 하위 파일을 모두 복사
  • ⚠️ 주의
    • macOS Monterey 12.1에서만 테스트 됨
    • 저의 초급 수준으로 작성됐으므로 이미 작업 중이었다면 git으로 이력 관리 후 스크립트를 실행하는 것을 권장
      • 뭔가 잘못됐을 시 git clean -fdUntracked files를 제거
  • 실행 방법
    • ./copy_directory_example_to_exercise.sh
  • 패키지명이 마음에 들지 않음
    • 패키지명은 오름차순을 고려하여 지었음. 변경을 원하는 경우 이 부분 을 수정

Other-package-descriptions

  • completion - 작성할 코드가 긴 경우 등의 이유로 완성된 코드가 있음
  • dummy - 불필요한 라이브러리 추가를 피하기 위해 dummy 작성된 코드가 있음

오타 및 책과 다른 부분 등 언제든 제보주시면 감사하겠습니다.

java-refactoring-to-patterns's People

Contributors

viiviii avatar

Stargazers

 avatar choerp avatar

Watchers

 avatar

java-refactoring-to-patterns's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.