Giter VIP home page Giter VIP logo

refactoringkotlin's Introduction

RefactoringKotlin

  • 「パラメータへの代入の除去 Remove Assignment to Parameters」は、パラメータへの代入がそもそも不可能。
  • 「アルゴリズムの取り替え Substitute Algorithm」は、単純にアルゴリズムを変更するだけなので、ここではとりあげない。
  • 「外部メソッドの導入 Introduce Foreign Method」は、Extensionで提供されているので不要。
  • 「局所的拡張の導入 Introduce Local Extension」は、サブクラスかラッパーを作って既存のクラスの拡張をする方法。
  • 「自己カプセル化フィールド Self Encapsulate Field」は、プロパティが提供されているので不要。
  • 「オブジェクトによる配列の置き換え Replace Array with Object」は、もはやありえないのでやらない。配列の要素番号で区別されているものを治す方法なので。
  • 「シンボリック定数によるマジックナンバーの置き換え Replace Magic Number with Symbolic Constant」かんたんすぎるので採用しない。
  • 「フィールドのカプセル化 Encapsulate Field」プロパティを公開するのと同じ。
  • 「データクラスによるレコードの置き換え Replace Record with Data Class」構造体のようなものをデータクラスに一旦置き換えるだけ。
  • 「表明の導入 Introduce Assertion」Assertionを入れることでコミュニケーションとデバッグに使うことができる。
  • 「メソッド名の変更 Rename Method」
  • 「パラメータの追加 Add Parameter」
  • 「パラメータの削除 Remove Parameter」
  • 「setメソッドの削除 Remove Setting Method」コンストラクタでしか設定できないようにするだけ。kotlinはコンストラクタに強いためそこまで問題にはならないかと。
  • 「メソッドの隠蔽 Hide Method」カプセル化するだけ。
  • 「ダウンキャストのカプセル化 Encapsulate Downcast」ダウンキャストはカプセル化しろということだけ。
  • 「条件判定による例外の置き換え Replace Exception with Test」例外の使いすぎがよくないよねってだけ
  • 「フィールドの引き上げ Pull Up Field」サブクラスにあるフィールドをスーパークラスに移動する。
  • 「メソッドの引き上げ Pull Up Method」サブクラスにあるフィールドをスーパークラスに移動する。
  • 「メソッドの引き下げ Push Down Method」
  • 「フィールドの引き下げ Push Down Field」

refactoringkotlin's People

Contributors

konabe avatar

Watchers

James Cloos avatar  avatar

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.