Presentation Outline
• AboutRuby
* Good Change, Bad Change (Matz)
* Gemification for Ruby 2.5 / 3.0 (Shibata Hiroshi)
• Git Driven Refactoring
• Augmenting Human decision making with data science
• What does GIL(Global Interpreter Lock) really guarantee you?
Good Change, BadChange (Matz)
Good changes?
* Performance, Productivity
* Excitement
10.
Good Change, BadChange (Matz)
Good changes?
* JIT(Just in time) Compiler
Ref: http://aroundck.tistory.com/1949
11.
Good Change, BadChange (Matz)
Good changes?
* Stack IR -> Register IR
12.
Good Change, BadChange (Matz)
• Ruby code (a = b+c)
* Stack based IR
b
c
Get local_OP__WC___0 <b index>
Get local_OP__WC___0 <c index>
Set local_OP__WC___0 <a index>
Opt_plus
Ref: https://markfaction.wordpress.com/2012/07/15/stack-based-vs-register-based-virtual-machine-architecture-and-the-dalvik-vm/
* operands are addressed implicitly by the stack pointer
13.
Good Change, BadChange (Matz)
• Ruby code (a = b+c)
* Register based IR
plus <b index>, <c index>, <a index>
* the operands for the instructions are explicitly addressed in the instruction, unlike the stack based model where we had a stack pointer
to point to the operand
In benchmark mode, 2.8 faster than Ruby 2.0!
14.
Good Change, BadChange (Matz)
• Ruby code (a = b+c)
* Register based IR
plus <b index>, <c index>, <a index>
* the operands for the instructions are explicitly addressed in the instruction, unlike the stack based model where we had a stack pointer
to point to the operand
In benchmark mode, 2.8 faster than Ruby 2.0!
15.
Good Change, BadChange (Matz)
Frozen String Literals by default
▪ String이 기본적으로 immutable이 됨
▪ Pros: 당연히 frozen이 되니까 같은 string을 참조. faster, les
▪ Cons: incompatible이 발생할 수 있음, break the code!
ref: https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3
16.
Good Change, BadChange (Matz)
Tail call optimization
ref: http://homoefficio.github.io/2015/07/27/재귀-반복-Tail-Recursion/
17.
Gemification for Ruby2.5 / 3.0
Standard libarary?
• FileUtils
• WEBrick
• TempFile
• Openssl
• Etc
18.
Gemification for Ruby2.5 / 3.0
Standard libarary?
• FileUtils
• WEBrick
• TempFile
• Openssl
• Etc
19.
Gemification for Ruby2.5 / 3.0
Gemification?
• Standard library -> Gemfile
• Ruby version과 관계없이 라이브러리를 독립적으로 업데이트 할 수 있다는 장
20.
Gemification for Ruby2.5 / 3.0
Gemification
• Pros
- Bugfix, new features 추가하는데 Ruby core와 별개로 진행이 가능
- Ruby를 업그레이드 안해도 되니까 stable하게 사용할 수 있음
• Cons
- Gem으로 분리되어지기 때문에 Maintainer들은 ruby core repository, github 이중으로 관리해야
한다는 어려움이 있음
- 다양한 라이브러리들이 공통적으로 참조하고 있는 라이브러리가 있고 그런데 그것의 version
conflict가 있으면 gemification 의 어려움이 있음
GIT DRIVEN REFACTORING
GitDriven Refactoring
특정 Refactoring technique를 다루는 것이 아니라,
Git이 가지고 있는 context를 통해 코드 구조 디자인을 변경해보자
23.
GIT DRIVEN REFACTORING
SOLIDprinciple
• Single responsibility principle
◦ 클래스는 반드시 하나의 책임만 가져야 한다. 또는 클래스는 반드시 변경해야할 이유가 하나만 있어야 한다.
• Open/Closed Principle
◦ 클래스는 확장에 열려있어야 하고, 수정에 대해서는 닫혀있어야 한다.
• Liskov Substitution Principle
◦ 프로그램의 객체는 프로그램의 정확성을 깨뜨리지 않으면서 하위 타입의 인스턴스로 바꿀 수 있어야 한다.
• Interface Segregation Principle
◦ 특정 클라이언트를 위한 인터페이스 여러 개가 범용 인터페이스 하나보다 낫다.
• Dependecy Inversion Principle
◦ 프로그래머는 추상화에 의존해야하고, 구체화에 의존하면 안된다.
참 쉽죠?
GIT DRIVEN REFACTORING
Itseems like there have been a lot of reasons this
class changed, mainly adding some new functionality.
35.
GIT DRIVEN REFACTORING
Poweroutput of engine Remote
you can group the commits into two logical groups.
you can see that the class has two reasons for change.
A change in the power output and
a change in the remote start functionality.
GIT DRIVEN REFACTORING
Open/ClosedPrinciple
그런데, 클래스를 수정하지 않고 어떻게 무언가를 확장시키지.
* 클래스는 확장에 열려있어야 하고, 수정에 대해서는 닫혀있어야 한다.
change this
13:17
thing without actually changing it.
AUGMENTING HUMAN DECISIONMAKING WITH DATA SCIENCE
• lower labor cost
• increased keep rate
• fewer mistakes from humans
• greater client satisfaction
* System 3 을 통해서 얻을 수 있는 장점