참고 : http://yong27.biohackers.net/373 , http://blog.naver.com/ez_/140138625021
easy_install은 다른 패키지 설치를 하다가 설치되어 버렸다.
easy_install을 이용해 pip과 virtualenv를 설치
claztec:site-packages claztec$ sudo easy_install pip
Password:
Searching for pip
Reading http://pypi.python.org/simple/pip/
Reading http://pip.openplans.org
Reading http://www.pip-installer.org
Best match: pip 1.0.2
Downloading http://pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz#md5=47ec6ff3f6d962696fe08d4c8264ad49
Processing pip-1.0.2.tar.gz
Running pip-1.0.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-7gMJPa/pip-1.0.2/egg-dist-tmp-HW3PqS
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
Adding pip 1.0.2 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip-2.7 script to /usr/local/bin
Installed /Library/Python/2.7/site-packages/pip-1.0.2-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
claztec:site-packages claztec$ sudo pip
Usage: pip COMMAND [OPTIONS]
pip: error: You must give a command (use "pip help" to see a list of commands)
claztec:site-packages claztec$
claztec:site-packages claztec$
claztec:site-packages claztec$ sudo pip install virtualenv
Downloading/unpacking virtualenv
Downloading virtualenv-1.7.tar.gz (2.1Mb): 2.1Mb downloaded
Running setup.py egg_info for package virtualenv
warning: no previously-included files matching '*.*' found under directory 'docs/_templates'
Installing collected packages: virtualenv
Running setup.py install for virtualenv
warning: no previously-included files matching '*.*' found under directory 'docs/_templates'
Installing virtualenv script to /usr/local/bin
Successfully installed virtualenv
Cleaning up...
claztec:site-packages claztec$
필드로나타나는덩어리를찾아 Extract Class(179)를이용해클래스로만든다. 이후 Introduce Parameter Object(339)나 Preserve Whole Ojbect(331)을사용해메소드의시그니쳐를변경하여파라미터리스트를단순화한다.
기본타입에대한강박관념 (Primitive Obsession)
데이터를기본타입이아닌레코드타입(데이터를구조화하여의미있는그룹으로만듬)의이점을살리기위해
Data Value with Object(209)를사용한다.
데이터값이타입코드이고, 값이동작에영향을미치지않으면
Replace Type Code with Class(255)를사용한다.
타입코드에의존하는조건문이있는경우
Replace Type Code with Subclass(261) 또는 Replace Type Code with State/Strategy(265)를사용한다.
몰려다녀야하는필드그룹이있다면
Extract Class(179)를사용한다.
파라미터리스트에기본타입을사용한다면
Introduce Parameter Object(339)를사용한다.
배열을쪼개서쓰고있다면
Replace Array with Object(220)를사용한다.
Switch 문 (Switch Statements)
switch 문을본다면다형성을생각하라
Extract Method(136)을사용해 switch문을뽑아낸후 Move Method(170)를사용하여다형성이필요한클래스로옮긴다. 이시점에 Type Code with Subclasses(261)를사용할지, Replace Type Code with State/Strategy(265)를결정한다. 상속구조를결정했으면 Replace Conditional with Polymorphism(293)을사용할수있다.
만일하나의메소드에만영향을미치는미치는몇개의경우가있다면
굳이바꿀필요가없다. 이럴경우 Replace Parameter with Explict Methods(327)이좋은선택이다.