10th php indonesia surabaya meetup

25
PHP Project Management Pengenalan GIT Subtree Strategy Taufan Adhitya 2014-03-01 - Unitomo

description

PHP Project Management With Git Subtree Split strategy

Transcript of 10th php indonesia surabaya meetup

Page 1: 10th php indonesia surabaya meetup

PHP Project ManagementPengenalan GIT Subtree Strategy

Taufan Adhitya2014-03-01 - Unitomo

Page 2: 10th php indonesia surabaya meetup

● Full time Father● Part time Lead Developer @Bizgym● Heinekken Caffeine Fans● Enterpreneur wanna-be● https://github.com/toopay

who is this guy?

Page 3: 10th php indonesia surabaya meetup

Apa yang akan kita bahas?

1. Mengenali tanda-tanda Project/Aplikasi Monolitik

2. Penggunaan Git Subtree Dalam Project Berskala Besar

Page 4: 10th php indonesia surabaya meetup

Mengenali tanda-tanda Project/Aplikasi Monolitik

Page 5: 10th php indonesia surabaya meetup

Mono(poli)tik??

Generally, a monolithic design is given when a software provides its functionality centralised in one huge boilerplate.

Page 6: 10th php indonesia surabaya meetup

Masalah buat loe?

● However, in case of providing a lot of functionality such an approach may lead to unclear or sleazy code as there is no clear separation to other areas of the software.

Page 7: 10th php indonesia surabaya meetup

Masalah buat loe?

● It is hard to manipulate or change existing code, also extensions may be hard to realize. So, developers are well advised to implement more flexible code when a certain dimension of functionality is reached.

Page 8: 10th php indonesia surabaya meetup

Tendensi Monolitik yang umum

● analysis paralysis● cargo cult programming● death march

Page 9: 10th php indonesia surabaya meetup

Penggunaan Git Subtree Dalam Project Berskala Besar

Page 10: 10th php indonesia surabaya meetup

GIT : Global Information Tracker

CLONEPULLREBASE

MERGEDIFFCOMMITPUSH

Git For Dummy

Page 11: 10th php indonesia surabaya meetup

GIT Mantra :

Sekarang aku bisa meng-undo kesalahanAku adalah Time-Traveler

Page 12: 10th php indonesia surabaya meetup

Ketika project bertendensi monolitik

Apa yang bisa kita lakukan dengan GIT?

Page 13: 10th php indonesia surabaya meetup

Git Submodule To The Rescue

Submodules allow foreign repositories to be embedded within a dedicated subdirectory of the source tree, always pointed at a particular commit.

Page 14: 10th php indonesia surabaya meetup

ARRGGGHH!!! And you call this as helpful idea?

Page 15: 10th php indonesia surabaya meetup
Page 16: 10th php indonesia surabaya meetup

Kenapa Git Submodule bisa menjadi Ide yang buruk?● Submodule sejatinya adalah clone baru dari

repository● Artinya kita harus memastikan sub-module

selalu update● Perubahan pada submodule tidak dapat

mengikuti git workflow (push tidak dapat dilakukan secara langsung)

Page 17: 10th php indonesia surabaya meetup

GIT now become….

Goddamn Idiotic Truckload of sh*t

Page 18: 10th php indonesia surabaya meetup

Wait…. Wait…

Page 19: 10th php indonesia surabaya meetup

Apa itu Git Subtree

The idea of the subtree merge is that you have two projects, and one of the projects maps to a subdirectory of the other one and vice versa.

Page 20: 10th php indonesia surabaya meetup

GIT Subtree In 5 lines

$ git remote add -f Bproject /path/to/B <1>$ git merge -s ours --no-commit Bproject/master <2>$ git read-tree --prefix=dir-B/ -u Bproject/master <3>$ git commit -m "Merge B project as our subdirectory" <4>$ git pull -s subtree Bproject master <5>

Page 21: 10th php indonesia surabaya meetup

GIT Subtree In 5 lines ● Name the other project "Bproject", and fetch.● Prepare for the later step to record the result as a

merge.● Read "master" branch of Bproject to the subdirectory

"dir-B".● Record the merge result.● Maintain the result with subsequent merges using

"subtree"

Page 22: 10th php indonesia surabaya meetup
Page 23: 10th php indonesia surabaya meetup

Subtree Strategy Benefits

● Share code without hurt your current work-flow

● All revisions history are intact● Provide clean, two-way communication

between shared code/repo

Page 24: 10th php indonesia surabaya meetup

Who uses this strategy?

● Symfony2● Zend Framework2● Laravel4● … and many more

● And probably you, in the near future!

Page 25: 10th php indonesia surabaya meetup

Thats it!

Question Time!