Slide 1

Slide 1 text

@fredwu Development Team Lead 1 Saturday, 17 November 12

Slide 2

Slide 2 text

“BECOME A BETTER DEVELOPER YOU CAN” - Yoda 2 Saturday, 17 November 12

Slide 3

Slide 3 text

MY BACKGROUND 3 Saturday, 17 November 12

Slide 4

Slide 4 text

4 Saturday, 17 November 12

Slide 5

Slide 5 text

4 Saturday, 17 November 12

Slide 6

Slide 6 text

• 1997 Got my first computer (Intel Pentium MMX 166Mhz) 4 Saturday, 17 November 12

Slide 7

Slide 7 text

• 1997 Got my first computer (Intel Pentium MMX 166Mhz) • 1997 Started using BBS (上海热线) and the Internet via 33.6Kbps modem 4 Saturday, 17 November 12

Slide 8

Slide 8 text

• 1997 Got my first computer (Intel Pentium MMX 166Mhz) • 1997 Started using BBS (上海热线) and the Internet via 33.6Kbps modem • 1997 Made my first ever HTML web page in Microsoft Frontpage Express 4 Saturday, 17 November 12

Slide 9

Slide 9 text

• 1997 Got my first computer (Intel Pentium MMX 166Mhz) • 1997 Started using BBS (上海热线) and the Internet via 33.6Kbps modem • 1997 Made my first ever HTML web page in Microsoft Frontpage Express • 1998 Moved to Australia 4 Saturday, 17 November 12

Slide 10

Slide 10 text

• 1997 Got my first computer (Intel Pentium MMX 166Mhz) • 1997 Started using BBS (上海热线) and the Internet via 33.6Kbps modem • 1997 Made my first ever HTML web page in Microsoft Frontpage Express • 1998 Moved to Australia • 2001 Started playing with Perl (雷傲), ASP (动⺴⽹网) and PHP (Discuz!) forum software 4 Saturday, 17 November 12

Slide 11

Slide 11 text

• 1997 Got my first computer (Intel Pentium MMX 166Mhz) • 1997 Started using BBS (上海热线) and the Internet via 33.6Kbps modem • 1997 Made my first ever HTML web page in Microsoft Frontpage Express • 1998 Moved to Australia • 2001 Started playing with Perl (雷傲), ASP (动⺴⽹网) and PHP (Discuz!) forum software • 2004 Started learning PHP and JavaScript in TAFE (pre-university bridge) 4 Saturday, 17 November 12

Slide 12

Slide 12 text

• 1997 Got my first computer (Intel Pentium MMX 166Mhz) • 1997 Started using BBS (上海热线) and the Internet via 33.6Kbps modem • 1997 Made my first ever HTML web page in Microsoft Frontpage Express • 1998 Moved to Australia • 2001 Started playing with Perl (雷傲), ASP (动⺴⽹网) and PHP (Discuz!) forum software • 2004 Started learning PHP and JavaScript in TAFE (pre-university bridge) • 2006 Started working part-time as a junior developer whilst studying in university 4 Saturday, 17 November 12

Slide 13

Slide 13 text

• 1997 Got my first computer (Intel Pentium MMX 166Mhz) • 1997 Started using BBS (上海热线) and the Internet via 33.6Kbps modem • 1997 Made my first ever HTML web page in Microsoft Frontpage Express • 1998 Moved to Australia • 2001 Started playing with Perl (雷傲), ASP (动⺴⽹网) and PHP (Discuz!) forum software • 2004 Started learning PHP and JavaScript in TAFE (pre-university bridge) • 2006 Started working part-time as a junior developer whilst studying in university • 2006 Discovered Ruby and Ruby on Rails, and switched to OS X because of Textmate 4 Saturday, 17 November 12

Slide 14

Slide 14 text

• 1997 Got my first computer (Intel Pentium MMX 166Mhz) • 1997 Started using BBS (上海热线) and the Internet via 33.6Kbps modem • 1997 Made my first ever HTML web page in Microsoft Frontpage Express • 1998 Moved to Australia • 2001 Started playing with Perl (雷傲), ASP (动⺴⽹网) and PHP (Discuz!) forum software • 2004 Started learning PHP and JavaScript in TAFE (pre-university bridge) • 2006 Started working part-time as a junior developer whilst studying in university • 2006 Discovered Ruby and Ruby on Rails, and switched to OS X because of Textmate • 2008 Started professionally as a web developer (HTML, CSS, PHP and JavaScript) 4 Saturday, 17 November 12

Slide 15

Slide 15 text

• 1997 Got my first computer (Intel Pentium MMX 166Mhz) • 1997 Started using BBS (上海热线) and the Internet via 33.6Kbps modem • 1997 Made my first ever HTML web page in Microsoft Frontpage Express • 1998 Moved to Australia • 2001 Started playing with Perl (雷傲), ASP (动⺴⽹网) and PHP (Discuz!) forum software • 2004 Started learning PHP and JavaScript in TAFE (pre-university bridge) • 2006 Started working part-time as a junior developer whilst studying in university • 2006 Discovered Ruby and Ruby on Rails, and switched to OS X because of Textmate • 2008 Started professionally as a web developer (HTML, CSS, PHP and JavaScript) • 2010 Started programming in Ruby full time (mostly) 4 Saturday, 17 November 12

Slide 16

Slide 16 text

• 1997 Got my first computer (Intel Pentium MMX 166Mhz) • 1997 Started using BBS (上海热线) and the Internet via 33.6Kbps modem • 1997 Made my first ever HTML web page in Microsoft Frontpage Express • 1998 Moved to Australia • 2001 Started playing with Perl (雷傲), ASP (动⺴⽹网) and PHP (Discuz!) forum software • 2004 Started learning PHP and JavaScript in TAFE (pre-university bridge) • 2006 Started working part-time as a junior developer whilst studying in university • 2006 Discovered Ruby and Ruby on Rails, and switched to OS X because of Textmate • 2008 Started professionally as a web developer (HTML, CSS, PHP and JavaScript) • 2010 Started programming in Ruby full time (mostly) • 2010 Started contributing to many open source ruby projects, including Ruby on Rails 4 Saturday, 17 November 12

Slide 17

Slide 17 text

2004 2005 2006 2007 2008 2009 2010 2011 2012 JavaScript PHP Ruby AREAS OF FOCUS 5 Saturday, 17 November 12

Slide 18

Slide 18 text

AUSTRALIA HAS A STRONG RUBY COMMUNITY 6 Saturday, 17 November 12

Slide 19

Slide 19 text

7 Saturday, 17 November 12

Slide 20

Slide 20 text

Dr Nic Williams Author of Rails Textmate bundle, works at Engine Yard Ryan Bigg Author of Rails 3 in Action, 2011 Ruby Hero Pat Allan Author of Thinking Sphinx, 2009 Ruby Hero Xavier Shay Author of Cane and Enki, works at Square Ben Schwarz Member of W3C’s CSS Working Group Darcy Laycock Author of API Smith, 2011 Ruby Hero Justin French Author of Formtastic Daniel Neighman Author of Warden, works at Square Ben Hoskings Author of Babushka Marcus Crafter Author of Sprinkle Charlie Somerville Author of Slash language, a talented 18 year old! Jack Chen (Chendo) Contributor to iTerm2 Mikel Lindsaar Author of Mail, rails core committer John Barton Cofounder of Goodfil.ms, dev manager of Envato for 3+ years Paul Annesley Built 99designs, works at SitePoint Gareth Townsend Founder of Melbourne Cocoaheads Ivan Vanderbyl Founder of Crashlog Glen Maddern Cofounder of Goodfil.ms Alan Harper Author of Rubyzip James Healy Author of PDF::Reader, maintainer of Prawn Florian Hanke Author of Picky 7 Saturday, 17 November 12

Slide 21

Slide 21 text

• General Tips and Thoughts • Code Tips and Examples • Q & A (提问时间,中⽂文) ABOUT THIS TALK 8 Saturday, 17 November 12

Slide 22

Slide 22 text

THREE STAGES OF ... 9 Saturday, 17 November 12

Slide 23

Slide 23 text

THREE STAGES OF PHOTOGRAPHY 10 Saturday, 17 November 12

Slide 24

Slide 24 text

THREE STAGES OF PHOTOGRAPHY 1. You discuss camera equipment. 三流摄影师谈器材。 10 Saturday, 17 November 12

Slide 25

Slide 25 text

THREE STAGES OF PHOTOGRAPHY 1. You discuss camera equipment. 三流摄影师谈器材。 2. You discuss shooting techniques. ⼆二流摄影师谈技术。 10 Saturday, 17 November 12

Slide 26

Slide 26 text

THREE STAGES OF PHOTOGRAPHY 1. You discuss camera equipment. 三流摄影师谈器材。 2. You discuss shooting techniques. ⼆二流摄影师谈技术。 3. You discuss creative and thought processes. ⼀一流摄影师谈思想。 10 Saturday, 17 November 12

Slide 27

Slide 27 text

THREE STAGES OF PROGRAMMERS 11 Saturday, 17 November 12

Slide 28

Slide 28 text

THREE STAGES OF PROGRAMMERS 1. You discuss tools and editors. 三流程序员谈⼯工具。 11 Saturday, 17 November 12

Slide 29

Slide 29 text

THREE STAGES OF PROGRAMMERS 1. You discuss tools and editors. 三流程序员谈⼯工具。 2. You discuss programming techniques. ⼆二流程序员谈技术。 11 Saturday, 17 November 12

Slide 30

Slide 30 text

THREE STAGES OF PROGRAMMERS 1. You discuss tools and editors. 三流程序员谈⼯工具。 2. You discuss programming techniques. ⼆二流程序员谈技术。 3. You discuss creative and thought processes. ⼀一流程序员谈思想。 11 Saturday, 17 November 12

Slide 31

Slide 31 text

THREE STAGES OF SOFTWARE DEVELOPMENT 12 Saturday, 17 November 12

Slide 32

Slide 32 text

THREE STAGES OF SOFTWARE DEVELOPMENT 1. You are being paid for what you do. 三流程序员提供汗⽔水。 12 Saturday, 17 November 12

Slide 33

Slide 33 text

THREE STAGES OF SOFTWARE DEVELOPMENT 1. You are being paid for what you do. 三流程序员提供汗⽔水。 2. You are being paid for what you know. ⼆二流程序员提供脑⼒力。 12 Saturday, 17 November 12

Slide 34

Slide 34 text

THREE STAGES OF SOFTWARE DEVELOPMENT 1. You are being paid for what you do. 三流程序员提供汗⽔水。 2. You are being paid for what you know. ⼆二流程序员提供脑⼒力。 3. You are being paid for your experience. ⼀一流程序员提供经验。 12 Saturday, 17 November 12

Slide 35

Slide 35 text

DISCLAIMER I am still a n00b. ⼩小⼩小菜⻦鸟。 But I care, so I share. 抛砖引⽟玉。 13 Saturday, 17 November 12

Slide 36

Slide 36 text

WHERE TO START 14 Saturday, 17 November 12

Slide 37

Slide 37 text

• What interests you? WHERE TO START 14 Saturday, 17 November 12

Slide 38

Slide 38 text

• What interests you? • Product? 产品控 WHERE TO START 14 Saturday, 17 November 12

Slide 39

Slide 39 text

• What interests you? • Product? 产品控 • Technology? 技术控 WHERE TO START 14 Saturday, 17 November 12

Slide 40

Slide 40 text

• What interests you? • Product? 产品控 • Technology? 技术控 • Maths and algorithm? 算法控 WHERE TO START 14 Saturday, 17 November 12

Slide 41

Slide 41 text

• What interests you? • Product? 产品控 • Technology? 技术控 • Maths and algorithm? 算法控 • Money? ⾦金钱控 WHERE TO START 14 Saturday, 17 November 12

Slide 42

Slide 42 text

• What interests you? • Product? 产品控 • Technology? 技术控 • Maths and algorithm? 算法控 • Money? ⾦金钱控 • Choose where to work wisely WHERE TO START 14 Saturday, 17 November 12

Slide 43

Slide 43 text

• What interests you? • Product? 产品控 • Technology? 技术控 • Maths and algorithm? 算法控 • Money? ⾦金钱控 • Choose where to work wisely • But it probably doesn’t matter (as much) for the first year or two WHERE TO START 14 Saturday, 17 November 12

Slide 44

Slide 44 text

THE ART OF ASKING QUESTIONS 15 Saturday, 17 November 12

Slide 45

Slide 45 text

THE ART OF ASKING QUESTIONS • Don’t be vague (“Can I use Rails for XYZ?” is not a good question). 模棱两可惹⼈人厌。 15 Saturday, 17 November 12

Slide 46

Slide 46 text

THE ART OF ASKING QUESTIONS • Don’t be vague (“Can I use Rails for XYZ?” is not a good question). 模棱两可惹⼈人厌。 • Give context and details (e.g. error stack trace). 提供上下⽂文与出错报告。 15 Saturday, 17 November 12

Slide 47

Slide 47 text

THE ART OF ASKING QUESTIONS • Don’t be vague (“Can I use Rails for XYZ?” is not a good question). 模棱两可惹⼈人厌。 • Give context and details (e.g. error stack trace). 提供上下⽂文与出错报告。 • Show that you’ve done your research. 必要的功课先做好。 15 Saturday, 17 November 12

Slide 48

Slide 48 text

THE ART OF ASKING QUESTIONS • Don’t be vague (“Can I use Rails for XYZ?” is not a good question). 模棱两可惹⼈人厌。 • Give context and details (e.g. error stack trace). 提供上下⽂文与出错报告。 • Show that you’ve done your research. 必要的功课先做好。 • Respect the answers and comments offered to you. 尊重别⼈人给出的答案和意⻅见。 15 Saturday, 17 November 12

Slide 49

Slide 49 text

THE ART OF ASKING QUESTIONS • Don’t be vague (“Can I use Rails for XYZ?” is not a good question). 模棱两可惹⼈人厌。 • Give context and details (e.g. error stack trace). 提供上下⽂文与出错报告。 • Show that you’ve done your research. 必要的功课先做好。 • Respect the answers and comments offered to you. 尊重别⼈人给出的答案和意⻅见。 • Be mindful of how many questions you ask. 短时间内不要提⼤大量的问题。 15 Saturday, 17 November 12

Slide 50

Slide 50 text

THE ART OF ASKING QUESTIONS • Don’t be vague (“Can I use Rails for XYZ?” is not a good question). 模棱两可惹⼈人厌。 • Give context and details (e.g. error stack trace). 提供上下⽂文与出错报告。 • Show that you’ve done your research. 必要的功课先做好。 • Respect the answers and comments offered to you. 尊重别⼈人给出的答案和意⻅见。 • Be mindful of how many questions you ask. 短时间内不要提⼤大量的问题。 • Don’t be a Help Vampire! http://slash7.com/2006/12/22/vampires/ 15 Saturday, 17 November 12

Slide 51

Slide 51 text

BE MINDFUL WHAT YOU SAY 16 Saturday, 17 November 12

Slide 52

Slide 52 text

BE MINDFUL WHAT YOU SAY • Be nice! Attacking people on Twitter or Weibo is not cool. 基本道德:不攻击他⼈人。 16 Saturday, 17 November 12

Slide 53

Slide 53 text

BE MINDFUL WHAT YOU SAY • Be nice! Attacking people on Twitter or Weibo is not cool. 基本道德:不攻击他⼈人。 • Make sure you checked your facts. 事实胜于雄辩。 16 Saturday, 17 November 12

Slide 54

Slide 54 text

BE MINDFUL WHAT YOU SAY • Be nice! Attacking people on Twitter or Weibo is not cool. 基本道德:不攻击他⼈人。 • Make sure you checked your facts. 事实胜于雄辩。 • Deflect office politics. 规避办公室政治。 16 Saturday, 17 November 12

Slide 55

Slide 55 text

BE MINDFUL WHAT YOU SAY • Be nice! Attacking people on Twitter or Weibo is not cool. 基本道德:不攻击他⼈人。 • Make sure you checked your facts. 事实胜于雄辩。 • Deflect office politics. 规避办公室政治。 • Don’t spread pirate links! 不散播盗版链接。 16 Saturday, 17 November 12

Slide 56

Slide 56 text

BE MINDFUL WHAT YOU SAY • Be nice! Attacking people on Twitter or Weibo is not cool. 基本道德:不攻击他⼈人。 • Make sure you checked your facts. 事实胜于雄辩。 • Deflect office politics. 规避办公室政治。 • Don’t spread pirate links! 不散播盗版链接。 • Don’t waste energy in endless debates. 不参与⽆无谓的争辩。 Credit: xkcd.com 16 Saturday, 17 November 12

Slide 57

Slide 57 text

ADJUST CONFIDENCE LEVEL 17 Saturday, 17 November 12

Slide 58

Slide 58 text

ADJUST CONFIDENCE LEVEL • Aim too low you’ll never improve. ⺫⽬目标定太低,难以进步。 17 Saturday, 17 November 12

Slide 59

Slide 59 text

ADJUST CONFIDENCE LEVEL • Aim too low you’ll never improve. ⺫⽬目标定太低,难以进步。 • Aim too high you’ll be depressed. ⺫⽬目标定太⾼高,永追不上。 17 Saturday, 17 November 12

Slide 60

Slide 60 text

ADJUST CONFIDENCE LEVEL • Aim too low you’ll never improve. ⺫⽬目标定太低,难以进步。 • Aim too high you’ll be depressed. ⺫⽬目标定太⾼高,永追不上。 • So make your goals @variables rather than CONSTANTS. 把⺫⽬目标设为变量,⽽而⾮非常量。 17 Saturday, 17 November 12

Slide 61

Slide 61 text

THOUGHTS ON SOFTWARE DEVELOPMENT 18 Saturday, 17 November 12

Slide 62

Slide 62 text

THOUGHTS ON SOFTWARE DEVELOPMENT • Second system syndrome - avoid total rewrites. 第⼆二系统综合症——避免重写。 18 Saturday, 17 November 12

Slide 63

Slide 63 text

THOUGHTS ON SOFTWARE DEVELOPMENT • Second system syndrome - avoid total rewrites. 第⼆二系统综合症——避免重写。 • Software engineering is like playing Starcraft - always check your mini-map. 软件⼯工程有如星际争霸——需经常关注迷你地图,以⼤大局为重。 18 Saturday, 17 November 12

Slide 64

Slide 64 text

THOUGHTS ON SOFTWARE DEVELOPMENT • Second system syndrome - avoid total rewrites. 第⼆二系统综合症——避免重写。 • Software engineering is like playing Starcraft - always check your mini-map. 软件⼯工程有如星际争霸——需经常关注迷你地图,以⼤大局为重。 • Experience is as important as talent, if not more important. 经验与天赋同重要。 18 Saturday, 17 November 12

Slide 65

Slide 65 text

THOUGHTS ON SOFTWARE DEVELOPMENT • Second system syndrome - avoid total rewrites. 第⼆二系统综合症——避免重写。 • Software engineering is like playing Starcraft - always check your mini-map. 软件⼯工程有如星际争霸——需经常关注迷你地图,以⼤大局为重。 • Experience is as important as talent, if not more important. 经验与天赋同重要。 • Technical debt is a debt, the longer you wait, the more interests you pay. 技术债务——拖⽋欠越久,偿还越多。 18 Saturday, 17 November 12

Slide 66

Slide 66 text

THOUGHTS ON SOFTWARE DEVELOPMENT • Second system syndrome - avoid total rewrites. 第⼆二系统综合症——避免重写。 • Software engineering is like playing Starcraft - always check your mini-map. 软件⼯工程有如星际争霸——需经常关注迷你地图,以⼤大局为重。 • Experience is as important as talent, if not more important. 经验与天赋同重要。 • Technical debt is a debt, the longer you wait, the more interests you pay. 技术债务——拖⽋欠越久,偿还越多。 • Choose the application architecture wisely. 谨慎选择软件架构。 18 Saturday, 17 November 12

Slide 67

Slide 67 text

APPLICATION ARCHITECTURE SHOWCASE 19 Saturday, 17 November 12

Slide 68

Slide 68 text

APPLICATION ARCHITECTURE SHOWCASE • We need a profile system to hold user data. ⽤用户帐户系统。 19 Saturday, 17 November 12

Slide 69

Slide 69 text

APPLICATION ARCHITECTURE SHOWCASE • We need a profile system to hold user data. ⽤用户帐户系统。 • The profile system will potentially be used standalone. ⽤用户帐户系统未来可能会被独⽴立使⽤用。 19 Saturday, 17 November 12

Slide 70

Slide 70 text

APPLICATION ARCHITECTURE SHOWCASE • We need a profile system to hold user data. ⽤用户帐户系统。 • The profile system will potentially be used standalone. ⽤用户帐户系统未来可能会被独⽴立使⽤用。 • We need plugin-able “modules”. 需可插⼊入式模块系统。 19 Saturday, 17 November 12

Slide 71

Slide 71 text

APPLICATION ARCHITECTURE SHOWCASE • We need a profile system to hold user data. ⽤用户帐户系统。 • The profile system will potentially be used standalone. ⽤用户帐户系统未来可能会被独⽴立使⽤用。 • We need plugin-able “modules”. 需可插⼊入式模块系统。 • There will potentially be 3rd party modules. 未来可能会有第三⽅方开发的模块。 19 Saturday, 17 November 12

Slide 72

Slide 72 text

APPLICATION ARCHITECTURE SHOWCASE • We need a profile system to hold user data. ⽤用户帐户系统。 • The profile system will potentially be used standalone. ⽤用户帐户系统未来可能会被独⽴立使⽤用。 • We need plugin-able “modules”. 需可插⼊入式模块系统。 • There will potentially be 3rd party modules. 未来可能会有第三⽅方开发的模块。 • Of course, the development timeline is tight. 开发周期很紧凑。 19 Saturday, 17 November 12

Slide 73

Slide 73 text

SOLUTION I THE PERFECT WAY Profile (API) Platform Module Module Module 20 Saturday, 17 November 12

Slide 74

Slide 74 text

PERFECT? NO! 21 Saturday, 17 November 12

Slide 75

Slide 75 text

PERFECT? NO! • Longer development time. 开发周期过⻓长。 21 Saturday, 17 November 12

Slide 76

Slide 76 text

PERFECT? NO! • Longer development time. 开发周期过⻓长。 • Can’t guarantee the usefulness of the API layer for 3rd party developers. 不可预知 API 层在未来是否还可有效利⽤用。 21 Saturday, 17 November 12

Slide 77

Slide 77 text

PERFECT? NO! • Longer development time. 开发周期过⻓长。 • Can’t guarantee the usefulness of the API layer for 3rd party developers. 不可预知 API 层在未来是否还可有效利⽤用。 • More complexity == more chances to screw up. 系统越复杂,越容易出错。 21 Saturday, 17 November 12

Slide 78

Slide 78 text

SOLUTION II THE EASY WAY Platform Profile Module Module Module 22 Saturday, 17 November 12

Slide 79

Slide 79 text

EASY, BUT FOR HOW LONG? 23 Saturday, 17 November 12

Slide 80

Slide 80 text

EASY, BUT FOR HOW LONG? • One app is more difficult to scale out. 单⼀一系统相对较难向外扩展。 23 Saturday, 17 November 12

Slide 81

Slide 81 text

EASY, BUT FOR HOW LONG? • One app is more difficult to scale out. 单⼀一系统相对较难向外扩展。 • It is also more difficult to assign tasks. 单⼀一系统相对较难安排团队成员任务。 23 Saturday, 17 November 12

Slide 82

Slide 82 text

EASY, BUT FOR HOW LONG? • One app is more difficult to scale out. 单⼀一系统相对较难向外扩展。 • It is also more difficult to assign tasks. 单⼀一系统相对较难安排团队成员任务。 • It is more likely to have leaky code. 单⼀一系统相对更难有效封装。 23 Saturday, 17 November 12

Slide 83

Slide 83 text

SOLUTION III THE CHOSEN WAY Profile (API) Platform Module Module Module 24 Saturday, 17 November 12

Slide 84

Slide 84 text

A BALANCED SOLUTION IS A GOOD SOLUTION 25 Saturday, 17 November 12

Slide 85

Slide 85 text

A BALANCED SOLUTION IS A GOOD SOLUTION • Don’t over-engineer. 避免过度⼯工程。 25 Saturday, 17 November 12

Slide 86

Slide 86 text

A BALANCED SOLUTION IS A GOOD SOLUTION • Don’t over-engineer. 避免过度⼯工程。 • Good degree of separation of concern. 注重关注点分离。 25 Saturday, 17 November 12

Slide 87

Slide 87 text

A BALANCED SOLUTION IS A GOOD SOLUTION • Don’t over-engineer. 避免过度⼯工程。 • Good degree of separation of concern. 注重关注点分离。 • Internal interfaces are easier than external APIs: 内部接⼝口相对外部 API 更易开发: ‣ @gateway ||= PlatformModuleGateway.new(args) ‣ mod = module_controller(module_name).new(args) ‣ mod.validate_input ‣ mod.render_view 25 Saturday, 17 November 12

Slide 88

Slide 88 text

OOPS! 26 Saturday, 17 November 12

Slide 89

Slide 89 text

OOPS! 27 Saturday, 17 November 12

Slide 90

Slide 90 text

Rackspace Private Cloud VM External Providers NGINX Front End HTTP SERVER (Long-polling, Cache, SSL) UNICORN Worker 1 Worker 2 Worker 3 Worker N Request Router Auth Admin Controller Workflow Controler User Data Source (Rails engine modules) Gateway M V C M V C M V C M V C M V C Mailer MySQL Application Server Master Sendmail Active Record ORM UNICORN Worker 1 Worker 2 Worker N Application Server Master Group Manager Roles Manager User Profile Manager Authentication System Permissions Management CRON DFAT Scraper Master Worker Event Machine Country Scraper Regional Scraper Local DB Server Active Record ORM Data Mapper ORM Profile TMP Firewall Firewall UNIX Socket HTTP JSON HTTPS UNIX Socket Client HART Aviation API JSON (SSL) CDC VISA Link 28 Saturday, 17 November 12

Slide 91

Slide 91 text

Rackspace Private Cloud VM External Providers NGINX Front End HTTP SERVER (Long-polling, Cache, SSL) UNICORN Worker 1 Worker 2 Worker 3 Worker N Request Router Auth Admin Controller Workflow Controler User Data Source (Rails engine modules) Gateway M V C M V C M V C M V C M V C Mailer MySQL Application Server Master Sendmail Active Record ORM UNICORN Worker 1 Worker 2 Worker N Application Server Master Group Manager Roles Manager User Profile Manager Authentication System Permissions Management CRON DFAT Scraper Master Worker Event Machine Country Scraper Regional Scraper Local DB Server Active Record ORM Data Mapper ORM Profile TMP Firewall Firewall UNIX Socket HTTP JSON HTTPS UNIX Socket Client HART Aviation API JSON (SSL) CDC VISA Link 28 Saturday, 17 November 12

Slide 92

Slide 92 text

Rackspace Private Cloud VM External Providers NGINX Front End HTTP SERVER (Long-polling, Cache, SSL) UNICORN Worker 1 Worker 2 Worker 3 Worker N Request Router Auth Admin Controller Workflow Controler User Data Source (Rails engine modules) Gateway M V C M V C M V C M V C M V C Mailer MySQL Application Server Master Sendmail Active Record ORM UNICORN Worker 1 Worker 2 Worker N Application Server Master Group Manager Roles Manager User Profile Manager Authentication System Permissions Management CRON DFAT Scraper Master Worker Event Machine Country Scraper Regional Scraper Local DB Server Active Record ORM Data Mapper ORM Profile TMP Firewall Firewall UNIX Socket HTTP JSON HTTPS UNIX Socket Client HART Aviation API JSON (SSL) CDC VISA Link 28 Saturday, 17 November 12

Slide 93

Slide 93 text

Rackspace Private Cloud VM External Providers NGINX Front End HTTP SERVER (Long-polling, Cache, SSL) UNICORN Worker 1 Worker 2 Worker 3 Worker N Request Router Auth Admin Controller Workflow Controler User Data Source (Rails engine modules) Gateway M V C M V C M V C M V C M V C Mailer MySQL Application Server Master Sendmail Active Record ORM UNICORN Worker 1 Worker 2 Worker N Application Server Master Group Manager Roles Manager User Profile Manager Authentication System Permissions Management CRON DFAT Scraper Master Worker Event Machine Country Scraper Regional Scraper Local DB Server Active Record ORM Data Mapper ORM Profile TMP Firewall Firewall UNIX Socket HTTP JSON HTTPS UNIX Socket Client HART Aviation API JSON (SSL) CDC VISA Link 28 Saturday, 17 November 12

Slide 94

Slide 94 text

Rackspace Private Cloud VM External Providers NGINX Front End HTTP SERVER (Long-polling, Cache, SSL) UNICORN Worker 1 Worker 2 Worker 3 Worker N Request Router Auth Admin Controller Workflow Controler User Data Source (Rails engine modules) Gateway M V C M V C M V C M V C M V C Mailer MySQL Application Server Master Sendmail Active Record ORM UNICORN Worker 1 Worker 2 Worker N Application Server Master Group Manager Roles Manager User Profile Manager Authentication System Permissions Management CRON DFAT Scraper Master Worker Event Machine Country Scraper Regional Scraper Local DB Server Active Record ORM Data Mapper ORM Profile TMP Firewall Firewall UNIX Socket HTTP JSON HTTPS UNIX Socket Client HART Aviation API JSON (SSL) CDC VISA Link 28 Saturday, 17 November 12

Slide 95

Slide 95 text

Rackspace Private Cloud VM External Providers NGINX Front End HTTP SERVER (Long-polling, Cache, SSL) UNICORN Worker 1 Worker 2 Worker 3 Worker N Request Router Auth Admin Controller Workflow Controler User Data Source (Rails engine modules) Gateway M V C M V C M V C M V C M V C Mailer MySQL Application Server Master Sendmail Active Record ORM UNICORN Worker 1 Worker 2 Worker N Application Server Master Group Manager Roles Manager User Profile Manager Authentication System Permissions Management CRON DFAT Scraper Master Worker Event Machine Country Scraper Regional Scraper Local DB Server Active Record ORM Data Mapper ORM Profile TMP Firewall Firewall UNIX Socket HTTP JSON HTTPS UNIX Socket Client HART Aviation API JSON (SSL) CDC VISA Link 28 Saturday, 17 November 12

Slide 96

Slide 96 text

Rackspace Private Cloud VM External Providers NGINX Front End HTTP SERVER (Long-polling, Cache, SSL) UNICORN Worker 1 Worker 2 Worker 3 Worker N Request Router Auth Admin Controller Workflow Controler User Data Source (Rails engine modules) Gateway M V C M V C M V C M V C M V C Mailer MySQL Application Server Master Sendmail Active Record ORM UNICORN Worker 1 Worker 2 Worker N Application Server Master Group Manager Roles Manager User Profile Manager Authentication System Permissions Management CRON DFAT Scraper Master Worker Event Machine Country Scraper Regional Scraper Local DB Server Active Record ORM Data Mapper ORM Profile TMP Firewall Firewall UNIX Socket HTTP JSON HTTPS UNIX Socket Client HART Aviation API JSON (SSL) CDC VISA Link 28 Saturday, 17 November 12

Slide 97

Slide 97 text

Rackspace Private Cloud VM External Providers NGINX Front End HTTP SERVER (Long-polling, Cache, SSL) UNICORN Worker 1 Worker 2 Worker 3 Worker N Request Router Auth Admin Controller Workflow Controler User Data Source (Rails engine modules) Gateway M V C M V C M V C M V C M V C Mailer MySQL Application Server Master Sendmail Active Record ORM UNICORN Worker 1 Worker 2 Worker N Application Server Master Group Manager Roles Manager User Profile Manager Authentication System Permissions Management CRON DFAT Scraper Master Worker Event Machine Country Scraper Regional Scraper Local DB Server Active Record ORM Data Mapper ORM Profile TMP Firewall Firewall UNIX Socket HTTP JSON HTTPS UNIX Socket Client HART Aviation API JSON (SSL) CDC VISA Link 28 Saturday, 17 November 12

Slide 98

Slide 98 text

CRAP PRINCIPLES 29 Saturday, 17 November 12

Slide 99

Slide 99 text

30 Saturday, 17 November 12

Slide 100

Slide 100 text

Contrast 对⽐比度 30 Saturday, 17 November 12

Slide 101

Slide 101 text

Contrast 对⽐比度 Repetition 重复度 30 Saturday, 17 November 12

Slide 102

Slide 102 text

Contrast 对⽐比度 Repetition 重复度 Alignment 排列度 30 Saturday, 17 November 12

Slide 103

Slide 103 text

Contrast 对⽐比度 Repetition 重复度 Alignment 排列度 Proximity 接近度 30 Saturday, 17 November 12

Slide 104

Slide 104 text

SOLID PRINCIPLES 31 Saturday, 17 November 12

Slide 105

Slide 105 text

32 Saturday, 17 November 12

Slide 106

Slide 106 text

Single responsibility 单⼀一责任 32 Saturday, 17 November 12

Slide 107

Slide 107 text

Single responsibility 单⼀一责任 Open/close 开闭 32 Saturday, 17 November 12

Slide 108

Slide 108 text

Single responsibility 单⼀一责任 Open/close 开闭 Liskov substitution ⾥里⽒氏替换 32 Saturday, 17 November 12

Slide 109

Slide 109 text

Single responsibility 单⼀一责任 Open/close 开闭 Liskov substitution ⾥里⽒氏替换 Interface segregation 接⼝口分离 32 Saturday, 17 November 12

Slide 110

Slide 110 text

Single responsibility 单⼀一责任 Open/close 开闭 Liskov substitution ⾥里⽒氏替换 Interface segregation 接⼝口分离 Dependency inversion 依赖倒置 32 Saturday, 17 November 12

Slide 111

Slide 111 text

FOUR SIMPLE RULES 33 Saturday, 17 November 12

Slide 112

Slide 112 text

34 Saturday, 17 November 12

Slide 113

Slide 113 text

Passes all the tests. 34 Saturday, 17 November 12

Slide 114

Slide 114 text

Passes all the tests. Contains no duplication. 34 Saturday, 17 November 12

Slide 115

Slide 115 text

Passes all the tests. Contains no duplication. Expresses the intent. 34 Saturday, 17 November 12

Slide 116

Slide 116 text

Passes all the tests. Contains no duplication. Expresses the intent. Minimises the number of classes and methods. 34 Saturday, 17 November 12

Slide 117

Slide 117 text

Until you have learnt Ruby first. DO NOT LEARN RAILS 35 Saturday, 17 November 12

Slide 118

Slide 118 text

AGILE? TDD? 36 Saturday, 17 November 12

Slide 119

Slide 119 text

ONE SIZE FITS ALL? 37 Saturday, 17 November 12

Slide 120

Slide 120 text

ONE SIZE FITS ALL? • Scrum, Kanban, XP, Lean, Crystal... whatever... 37 Saturday, 17 November 12

Slide 121

Slide 121 text

ONE SIZE FITS ALL? • Scrum, Kanban, XP, Lean, Crystal... whatever... • TDD? BDD? Test first, or verify later? 37 Saturday, 17 November 12

Slide 122

Slide 122 text

ONE SIZE FITS ALL? • Scrum, Kanban, XP, Lean, Crystal... whatever... • TDD? BDD? Test first, or verify later? • If no one shoe/shirt/hat size can fit all, then why should development processes be any different? 37 Saturday, 17 November 12

Slide 123

Slide 123 text

ONE SIZE FITS ALL? • Scrum, Kanban, XP, Lean, Crystal... whatever... • TDD? BDD? Test first, or verify later? • If no one shoe/shirt/hat size can fit all, then why should development processes be any different? • There will always be people trying to sell you something. 37 Saturday, 17 November 12

Slide 124

Slide 124 text

ONE SIZE FITS ALL? • Scrum, Kanban, XP, Lean, Crystal... whatever... • TDD? BDD? Test first, or verify later? • If no one shoe/shirt/hat size can fit all, then why should development processes be any different? • There will always be people trying to sell you something. • Use whatever works for your team, your project and your culture! 37 Saturday, 17 November 12

Slide 125

Slide 125 text

Practice, Practice and Practice FAST TRACK 38 Saturday, 17 November 12

Slide 126

Slide 126 text

CONTRIBUTE TO OPEN SOURCE PROJECTS 39 Saturday, 17 November 12

Slide 127

Slide 127 text

CONTRIBUTE TO OPEN SOURCE PROJECTS • Reading code is just as important as writing code. 阅读代码与编写代码同重要。 39 Saturday, 17 November 12

Slide 128

Slide 128 text

CONTRIBUTE TO OPEN SOURCE PROJECTS • Reading code is just as important as writing code. 阅读代码与编写代码同重要。 • Learn from the masters. 向⼤大师们学习。 39 Saturday, 17 November 12

Slide 129

Slide 129 text

CONTRIBUTE TO OPEN SOURCE PROJECTS • Reading code is just as important as writing code. 阅读代码与编写代码同重要。 • Learn from the masters. 向⼤大师们学习。 • Take some, give some - sharing is awesome. 不断收获的同时,别忘了付出。 39 Saturday, 17 November 12

Slide 130

Slide 130 text

CONTRIBUTE TO OPEN SOURCE PROJECTS • Reading code is just as important as writing code. 阅读代码与编写代码同重要。 • Learn from the masters. 向⼤大师们学习。 • Take some, give some - sharing is awesome. 不断收获的同时,别忘了付出。 • Make things more useful for yourself therefore for others too. 对⾃自⼰己有⽤用的东⻄西,也许对他⼈人也有⽤用。 39 Saturday, 17 November 12

Slide 131

Slide 131 text

CONTRIBUTE TO OPEN SOURCE PROJECTS 39 Saturday, 17 November 12

Slide 132

Slide 132 text

CONTRIBUTE TO OPEN SOURCE PROJECTS 40 Saturday, 17 November 12

Slide 133

Slide 133 text

CONTRIBUTE TO OPEN SOURCE PROJECTS PHP CodeIgniter PHP Kohana PHP Vanilla Forums PHP Yii Framework JAVASCRIPT AutoSuggest RUBY Ruby on Rails RUBY RailsConfig RUBY Slim RUBY ORM Adapter RUBY Delayed Job RUBY Parallel Tests 40 Saturday, 17 November 12

Slide 134

Slide 134 text

OPEN SOURCE YOUR OWN WORK 41 Saturday, 17 November 12

Slide 135

Slide 135 text

OPEN SOURCE YOUR OWN WORK • Made something useful? Release it! 写了有⽤用的好玩意⼉儿?发布吧,勇敢的少年! 41 Saturday, 17 November 12

Slide 136

Slide 136 text

OPEN SOURCE YOUR OWN WORK • Made something useful? Release it! 写了有⽤用的好玩意⼉儿?发布吧,勇敢的少年! • Be critisied of your work, and learn from mistakes. 虚⼼心接受意⻅见与批评,由错误中学习。 41 Saturday, 17 November 12

Slide 137

Slide 137 text

OPEN SOURCE YOUR OWN WORK • Made something useful? Release it! 写了有⽤用的好玩意⼉儿?发布吧,勇敢的少年! • Be critisied of your work, and learn from mistakes. 虚⼼心接受意⻅见与批评,由错误中学习。 • Be proud of your work, and be recognised. 为⾃自⼰己的⾟辛苦成果感到⾃自豪。 41 Saturday, 17 November 12

Slide 138

Slide 138 text

OPEN SOURCE YOUR OWN WORK • Made something useful? Release it! 写了有⽤用的好玩意⼉儿?发布吧,勇敢的少年! • Be critisied of your work, and learn from mistakes. 虚⼼心接受意⻅见与批评,由错误中学习。 • Be proud of your work, and be recognised. 为⾃自⼰己的⾟辛苦成果感到⾃自豪。 • Make a little dent in the universe. ⼀一点⼩小⼩小的贡献的话,可以哟〜~ 41 Saturday, 17 November 12

Slide 139

Slide 139 text

OPEN SOURCE YOUR OWN WORK 41 Saturday, 17 November 12

Slide 140

Slide 140 text

OPEN SOURCE YOUR OWN WORK 42 Saturday, 17 November 12

Slide 141

Slide 141 text

OPEN SOURCE YOUR OWN WORK RUBY Action Throttler Throttle actions based on configurable duration and limit. RUBY Angel Nest An open source 'clone' of AngelList. RUBY API Taster Visually test your Rails application's API. RUBY AppReset Resets (and if available, seeds) your databases. RUBY Bustle Activities recording and retrieving using a simple Pub/Sub-like interface. RUBY Datamappify Turn ActiveRecord into DataMapper (sort of)! RUBY Haml2Slim Convert Haml templates to Slim templates. RUBY Inherited Resources Views DRY your view files! RUBY Ruby Decorators Ruby method decorators inspired by Python. RUBY Security Guard A collection of useful tools for auditing data. RUBY Slim Bundle A Textmate / Sublime Text bundle for Slim. PHP Authlite A lightweight, flexible Auth module for Kohana. PHP KThrottler Throttle actions based on configurable duration and limit. PHP PHamlP A bridge between Kohana and PHamlP. JAVASCRIPT Endless Scroll Endless / infinite scrolling solution for jQuery. JAVASCRIPT Inline Confirmation Less obtrusive confirmation dialogues. JAVASCRIPT Skinny Coffee Machine A simple state machine with observers. JAVASCRIPT Slideshow Lite A lightweight slideshow plugin for jQuery. 42 Saturday, 17 November 12

Slide 142

Slide 142 text

ISSUES AND CONVERSATIONS 43 Saturday, 17 November 12

Slide 143

Slide 143 text

44 Saturday, 17 November 12

Slide 144

Slide 144 text

Credit: travis-ci.com 44 Saturday, 17 November 12

Slide 145

Slide 145 text

ANGEL NEST A real world example of a Rails project 45 Saturday, 17 November 12

Slide 146

Slide 146 text

MADE HEADLINE NEWS 46 Saturday, 17 November 12

Slide 147

Slide 147 text

47 Saturday, 17 November 12

Slide 148

Slide 148 text

PUBLIC REACTIONS What did people say about this project? 47 Saturday, 17 November 12

Slide 149

Slide 149 text

48 Saturday, 17 November 12

Slide 150

Slide 150 text

Holy shit the code is clean. Good job dude. I'm impressed by your SCSS too. Good quality dev right here. -- dfischer (via Hacker News) 48 Saturday, 17 November 12

Slide 151

Slide 151 text

49 Saturday, 17 November 12

Slide 152

Slide 152 text

50 Saturday, 17 November 12

Slide 153

Slide 153 text

51 Saturday, 17 November 12

Slide 154

Slide 154 text

52 Saturday, 17 November 12

Slide 155

Slide 155 text

... he's turned a negative event (getting stiffed) into positive exposure for his work with hundreds of HN readers. At least at a glance, it seems like solid and clean Rails / Ruby code ... -- tomkarlo (via Hacker News) 52 Saturday, 17 November 12

Slide 156

Slide 156 text

53 Saturday, 17 November 12

Slide 157

Slide 157 text

I reviewed the angel_nest code and I must say it has the best implementation. Thank you very much for releasing angel_nest as open source. -- Firoz A. (via Email) 53 Saturday, 17 November 12

Slide 158

Slide 158 text

https://github.com/fredwu/angel_nest 54 Saturday, 17 November 12

Slide 159

Slide 159 text

SLIM A Case Study 55 Saturday, 17 November 12

Slide 160

Slide 160 text

56 Saturday, 17 November 12

Slide 161

Slide 161 text

57 Saturday, 17 November 12

Slide 162

Slide 162 text

57 Saturday, 17 November 12

Slide 163

Slide 163 text

57 Saturday, 17 November 12

Slide 164

Slide 164 text

58 Saturday, 17 November 12

Slide 165

Slide 165 text

59 Saturday, 17 November 12

Slide 166

Slide 166 text

60 Saturday, 17 November 12

Slide 167

Slide 167 text

61 Saturday, 17 November 12

Slide 168

Slide 168 text

62 Saturday, 17 November 12

Slide 169

Slide 169 text

63 Saturday, 17 November 12

Slide 170

Slide 170 text

64 Saturday, 17 November 12

Slide 171

Slide 171 text

65 Saturday, 17 November 12

Slide 172

Slide 172 text

66 Saturday, 17 November 12

Slide 173

Slide 173 text

67 Saturday, 17 November 12

Slide 174

Slide 174 text

68 Saturday, 17 November 12

Slide 175

Slide 175 text

69 Saturday, 17 November 12

Slide 176

Slide 176 text

70 Saturday, 17 November 12

Slide 177

Slide 177 text

71 Saturday, 17 November 12

Slide 178

Slide 178 text

72 Saturday, 17 November 12

Slide 179

Slide 179 text

73 Saturday, 17 November 12

Slide 180

Slide 180 text

... you have an impressive collection of open source contributions, and it would be great to keep in touch ... -- Tom Preston-Werner (CEO, GitHub) 73 Saturday, 17 November 12

Slide 181

Slide 181 text

DO FREELANCE WORK 74 Saturday, 17 November 12

Slide 182

Slide 182 text

DO FREELANCE WORK • Like open source work, but with deadlines and pressure. 截⽌止期限与压⼒力。 74 Saturday, 17 November 12

Slide 183

Slide 183 text

DO FREELANCE WORK • Like open source work, but with deadlines and pressure. 截⽌止期限与压⼒力。 • Like open source work, but with some $$$. 赚点外快。 74 Saturday, 17 November 12

Slide 184

Slide 184 text

DO FREELANCE WORK • Like open source work, but with deadlines and pressure. 截⽌止期限与压⼒力。 • Like open source work, but with some $$$. 赚点外快。 • Be involved in projects different to those at your day job. 不同的项⺫⽬目体验与经验。 74 Saturday, 17 November 12

Slide 185

Slide 185 text

DO FREELANCE WORK • Like open source work, but with deadlines and pressure. 截⽌止期限与压⼒力。 • Like open source work, but with some $$$. 赚点外快。 • Be involved in projects different to those at your day job. 不同的项⺫⽬目体验与经验。 • Communication skills with your clients. 客户沟通经验。 74 Saturday, 17 November 12

Slide 186

Slide 186 text

DO FREELANCE WORK • Like open source work, but with deadlines and pressure. 截⽌止期限与压⼒力。 • Like open source work, but with some $$$. 赚点外快。 • Be involved in projects different to those at your day job. 不同的项⺫⽬目体验与经验。 • Communication skills with your clients. 客户沟通经验。 • Communication skills with your remote team members. 远程团队沟通经验。 74 Saturday, 17 November 12

Slide 187

Slide 187 text

DO FREELANCE WORK 74 Saturday, 17 November 12

Slide 188

Slide 188 text

DO FREELANCE WORK 75 Saturday, 17 November 12

Slide 189

Slide 189 text

DO FREELANCE WORK PHP ESTILE (eCommerce) PHP P1.CN (social network) RUBY 2Threads (eCommerce) RUBY AppHelp! (web + mobile app) RUBY 500 Startups (online portal) RUBY TED City 2.0 (content platform) 75 Saturday, 17 November 12

Slide 190

Slide 190 text

AND LASTLY, YOUR DAY JOB 76 Saturday, 17 November 12

Slide 191

Slide 191 text

AND LASTLY, YOUR DAY JOB • You spend most of your hours awake at your day job, make it count! 76 Saturday, 17 November 12

Slide 192

Slide 192 text

AND LASTLY, YOUR DAY JOB • You spend most of your hours awake at your day job, make it count! • Know what you are looking for. 知道⾃自⼰己想要什么。 76 Saturday, 17 November 12

Slide 193

Slide 193 text

AND LASTLY, YOUR DAY JOB • You spend most of your hours awake at your day job, make it count! • Know what you are looking for. 知道⾃自⼰己想要什么。 • What can you get out of working at the company? 在这家公司⼯工作,能学习到什么? 76 Saturday, 17 November 12

Slide 194

Slide 194 text

AND LASTLY, YOUR DAY JOB • You spend most of your hours awake at your day job, make it count! • Know what you are looking for. 知道⾃自⼰己想要什么。 • What can you get out of working at the company? 在这家公司⼯工作,能学习到什么? • What did you get out of working at the company? 在这家公司⼯工作,学习到了什么? 76 Saturday, 17 November 12

Slide 195

Slide 195 text

AND LASTLY, YOUR DAY JOB 76 Saturday, 17 November 12

Slide 196

Slide 196 text

AND LASTLY, YOUR DAY JOB ‣ Small web agency ‣ Mostly static websites ‣ Mostly small clients ‣ Mostly small projects 77 Saturday, 17 November 12

Slide 197

Slide 197 text

AND LASTLY, YOUR DAY JOB • My first real job (part time) ‣ Small web agency ‣ Mostly static websites ‣ Mostly small clients ‣ Mostly small projects 77 Saturday, 17 November 12

Slide 198

Slide 198 text

AND LASTLY, YOUR DAY JOB • My first real job (part time) • HTML, CSS, PHP and JavaScript! ‣ Small web agency ‣ Mostly static websites ‣ Mostly small clients ‣ Mostly small projects 77 Saturday, 17 November 12

Slide 199

Slide 199 text

AND LASTLY, YOUR DAY JOB • My first real job (part time) • HTML, CSS, PHP and JavaScript! • Mostly worked by myself ‣ Small web agency ‣ Mostly static websites ‣ Mostly small clients ‣ Mostly small projects 77 Saturday, 17 November 12

Slide 200

Slide 200 text

AND LASTLY, YOUR DAY JOB • My first real job (part time) • HTML, CSS, PHP and JavaScript! • Mostly worked by myself • Learnt a thing or two about SEO ‣ Small web agency ‣ Mostly static websites ‣ Mostly small clients ‣ Mostly small projects 77 Saturday, 17 November 12

Slide 201

Slide 201 text

AND LASTLY, YOUR DAY JOB • My first real job (part time) • HTML, CSS, PHP and JavaScript! • Mostly worked by myself • Learnt a thing or two about SEO • I’m not as good as I thought I was ‣ Small web agency ‣ Mostly static websites ‣ Mostly small clients ‣ Mostly small projects 77 Saturday, 17 November 12

Slide 202

Slide 202 text

AND LASTLY, YOUR DAY JOB ‣ Small agency (print + web) ‣ Small to mid-sized projects ‣ Household name clients ‣ Meetings with clients 78 Saturday, 17 November 12

Slide 203

Slide 203 text

AND LASTLY, YOUR DAY JOB • My first full time job ‣ Small agency (print + web) ‣ Small to mid-sized projects ‣ Household name clients ‣ Meetings with clients 78 Saturday, 17 November 12

Slide 204

Slide 204 text

AND LASTLY, YOUR DAY JOB • My first full time job • Mostly PHP and JavaScript ‣ Small agency (print + web) ‣ Small to mid-sized projects ‣ Household name clients ‣ Meetings with clients 78 Saturday, 17 November 12

Slide 205

Slide 205 text

AND LASTLY, YOUR DAY JOB • My first full time job • Mostly PHP and JavaScript • Kohana, Zend Framework and Yii ‣ Small agency (print + web) ‣ Small to mid-sized projects ‣ Household name clients ‣ Meetings with clients 78 Saturday, 17 November 12

Slide 206

Slide 206 text

AND LASTLY, YOUR DAY JOB • My first full time job • Mostly PHP and JavaScript • Kohana, Zend Framework and Yii • Team environment ‣ Small agency (print + web) ‣ Small to mid-sized projects ‣ Household name clients ‣ Meetings with clients 78 Saturday, 17 November 12

Slide 207

Slide 207 text

AND LASTLY, YOUR DAY JOB • My first full time job • Mostly PHP and JavaScript • Kohana, Zend Framework and Yii • Team environment • Learnt things I didn’t know (print) ‣ Small agency (print + web) ‣ Small to mid-sized projects ‣ Household name clients ‣ Meetings with clients 78 Saturday, 17 November 12

Slide 208

Slide 208 text

AND LASTLY, YOUR DAY JOB ‣ Well-known startup ‣ Great platforms and websites ‣ Online education! ‣ High traffic ‣ Ruby shop 79 Saturday, 17 November 12

Slide 209

Slide 209 text

• Hired as a PHP developer AND LASTLY, YOUR DAY JOB ‣ Well-known startup ‣ Great platforms and websites ‣ Online education! ‣ High traffic ‣ Ruby shop 79 Saturday, 17 November 12

Slide 210

Slide 210 text

• Hired as a PHP developer • Became a Ruby developer AND LASTLY, YOUR DAY JOB ‣ Well-known startup ‣ Great platforms and websites ‣ Online education! ‣ High traffic ‣ Ruby shop 79 Saturday, 17 November 12

Slide 211

Slide 211 text

• Hired as a PHP developer • Became a Ruby developer • Learnt heaps from senior devs AND LASTLY, YOUR DAY JOB ‣ Well-known startup ‣ Great platforms and websites ‣ Online education! ‣ High traffic ‣ Ruby shop 79 Saturday, 17 November 12

Slide 212

Slide 212 text

• Hired as a PHP developer • Became a Ruby developer • Learnt heaps from senior devs • Manage stakeholder expectations AND LASTLY, YOUR DAY JOB ‣ Well-known startup ‣ Great platforms and websites ‣ Online education! ‣ High traffic ‣ Ruby shop 79 Saturday, 17 November 12

Slide 213

Slide 213 text

• Hired as a PHP developer • Became a Ruby developer • Learnt heaps from senior devs • Manage stakeholder expectations • Online education AND LASTLY, YOUR DAY JOB ‣ Well-known startup ‣ Great platforms and websites ‣ Online education! ‣ High traffic ‣ Ruby shop 79 Saturday, 17 November 12

Slide 214

Slide 214 text

• Hired as a PHP developer • Became a Ruby developer • Learnt heaps from senior devs • Manage stakeholder expectations • Online education • Recognisable brand AND LASTLY, YOUR DAY JOB ‣ Well-known startup ‣ Great platforms and websites ‣ Online education! ‣ High traffic ‣ Ruby shop 79 Saturday, 17 November 12

Slide 215

Slide 215 text

AND LASTLY, YOUR DAY JOB ‣ Well funded startup ($50M+) ‣ Large teams ‣ Multiple projects 80 Saturday, 17 November 12

Slide 216

Slide 216 text

• Hired as a senior developer AND LASTLY, YOUR DAY JOB ‣ Well funded startup ($50M+) ‣ Large teams ‣ Multiple projects 80 Saturday, 17 November 12

Slide 217

Slide 217 text

• Hired as a senior developer • 40+ developers AND LASTLY, YOUR DAY JOB ‣ Well funded startup ($50M+) ‣ Large teams ‣ Multiple projects 80 Saturday, 17 November 12

Slide 218

Slide 218 text

• Hired as a senior developer • 40+ developers • My first agile environment! AND LASTLY, YOUR DAY JOB ‣ Well funded startup ($50M+) ‣ Large teams ‣ Multiple projects 80 Saturday, 17 November 12

Slide 219

Slide 219 text

• Hired as a senior developer • 40+ developers • My first agile environment! • Multiple teams and projects AND LASTLY, YOUR DAY JOB ‣ Well funded startup ($50M+) ‣ Large teams ‣ Multiple projects 80 Saturday, 17 November 12

Slide 220

Slide 220 text

• Hired as a senior developer • 40+ developers • My first agile environment! • Multiple teams and projects • Made lots of friends :-) AND LASTLY, YOUR DAY JOB ‣ Well funded startup ($50M+) ‣ Large teams ‣ Multiple projects 80 Saturday, 17 November 12

Slide 221

Slide 221 text

AND LASTLY, YOUR DAY JOB ‣ Well-known company ‣ Respected in the industry ‣ Online education! ‣ High traffic 81 Saturday, 17 November 12

Slide 222

Slide 222 text

• Hired as a development team lead AND LASTLY, YOUR DAY JOB ‣ Well-known company ‣ Respected in the industry ‣ Online education! ‣ High traffic 81 Saturday, 17 November 12

Slide 223

Slide 223 text

• Hired as a development team lead • Tech leadership and management AND LASTLY, YOUR DAY JOB ‣ Well-known company ‣ Respected in the industry ‣ Online education! ‣ High traffic 81 Saturday, 17 November 12

Slide 224

Slide 224 text

• Hired as a development team lead • Tech leadership and management • Great industry connections AND LASTLY, YOUR DAY JOB ‣ Well-known company ‣ Respected in the industry ‣ Online education! ‣ High traffic 81 Saturday, 17 November 12

Slide 225

Slide 225 text

• Hired as a development team lead • Tech leadership and management • Great industry connections • Online education AND LASTLY, YOUR DAY JOB ‣ Well-known company ‣ Respected in the industry ‣ Online education! ‣ High traffic 81 Saturday, 17 November 12

Slide 226

Slide 226 text

• Hired as a development team lead • Tech leadership and management • Great industry connections • Online education • Recognisable brand AND LASTLY, YOUR DAY JOB ‣ Well-known company ‣ Respected in the industry ‣ Online education! ‣ High traffic 81 Saturday, 17 November 12

Slide 227

Slide 227 text

AND LASTLY, YOUR DAY JOB ‣ Well-funded startup ‣ Unique industry connections ‣ Early stage ‣ Big opportunities 82 Saturday, 17 November 12

Slide 228

Slide 228 text

• Hired as a development team lead AND LASTLY, YOUR DAY JOB ‣ Well-funded startup ‣ Unique industry connections ‣ Early stage ‣ Big opportunities 82 Saturday, 17 November 12

Slide 229

Slide 229 text

• Hired as a development team lead • Design and architect systems AND LASTLY, YOUR DAY JOB ‣ Well-funded startup ‣ Unique industry connections ‣ Early stage ‣ Big opportunities 82 Saturday, 17 November 12

Slide 230

Slide 230 text

• Hired as a development team lead • Design and architect systems • Build champion teams AND LASTLY, YOUR DAY JOB ‣ Well-funded startup ‣ Unique industry connections ‣ Early stage ‣ Big opportunities 82 Saturday, 17 November 12

Slide 231

Slide 231 text

• Hired as a development team lead • Design and architect systems • Build champion teams • Enterprise products + startup spirits AND LASTLY, YOUR DAY JOB ‣ Well-funded startup ‣ Unique industry connections ‣ Early stage ‣ Big opportunities 82 Saturday, 17 November 12

Slide 232

Slide 232 text

• Hired as a development team lead • Design and architect systems • Build champion teams • Enterprise products + startup spirits • Be part of something big (potentially) AND LASTLY, YOUR DAY JOB ‣ Well-funded startup ‣ Unique industry connections ‣ Early stage ‣ Big opportunities 82 Saturday, 17 November 12

Slide 233

Slide 233 text

PERSONAL BRANDING 83 Saturday, 17 November 12

Slide 234

Slide 234 text

PERSONAL BRANDING • Designers have online portfolios, what about us developers? 83 Saturday, 17 November 12

Slide 235

Slide 235 text

PERSONAL BRANDING • Designers have online portfolios, what about us developers? • Blog - show me your thoughts! 83 Saturday, 17 November 12

Slide 236

Slide 236 text

PERSONAL BRANDING • Designers have online portfolios, what about us developers? • Blog - show me your thoughts! • Twitter/Weibo - show me your passion! 83 Saturday, 17 November 12

Slide 237

Slide 237 text

PERSONAL BRANDING • Designers have online portfolios, what about us developers? • Blog - show me your thoughts! • Twitter/Weibo - show me your passion! • GitHub - show me your code! 83 Saturday, 17 November 12

Slide 238

Slide 238 text

PERSONAL BRANDING • Designers have online portfolios, what about us developers? • Blog - show me your thoughts! • Twitter/Weibo - show me your passion! • GitHub - show me your code! • LinkedIn - show me your resume! 83 Saturday, 17 November 12

Slide 239

Slide 239 text

PERSONAL BRANDING 84 Saturday, 17 November 12

Slide 240

Slide 240 text

PERSONAL BRANDING • Build up your network 拓展交际圈 • Establish your reputation 树⽴立好名声 • People will endorse your work 让更多⼈人赞誉你的成果 84 Saturday, 17 November 12

Slide 241

Slide 241 text

85 Saturday, 17 November 12

Slide 242

Slide 242 text

Most importantly... 85 Saturday, 17 November 12

Slide 243

Slide 243 text

LET PEOPLE REMEMBER YOU! Most importantly... 85 Saturday, 17 November 12

Slide 244

Slide 244 text

86 Saturday, 17 November 12

Slide 245

Slide 245 text

We can talk the talk 86 Saturday, 17 November 12

Slide 246

Slide 246 text

LET’S WALK THE WALK We can talk the talk 86 Saturday, 17 November 12

Slide 247

Slide 247 text

GIT 87 Saturday, 17 November 12

Slide 248

Slide 248 text

GIT • Merge vs Rebase vs Squash • GitHub 87 Saturday, 17 November 12

Slide 249

Slide 249 text

PRETTIFY YOUR COMMAND PROMPT 88 Saturday, 17 November 12

Slide 250

Slide 250 text

PRETTIFY YOUR COMMAND PROMPT 88 Saturday, 17 November 12

Slide 251

Slide 251 text

PRETTIFY YOUR COMMAND PROMPT 88 Saturday, 17 November 12

Slide 252

Slide 252 text

PRETTIFY YOUR COMMAND PROMPT 88 Saturday, 17 November 12

Slide 253

Slide 253 text

PRETTIFY YOUR COMMAND PROMPT 88 Saturday, 17 November 12

Slide 254

Slide 254 text

PRETTIFY YOUR COMMAND PROMPT 88 Saturday, 17 November 12

Slide 255

Slide 255 text

OH-MY-ZSH HTTPS://GITHUB.COM/ROBBYRUSSELL/OH-MY-ZSH 89 Saturday, 17 November 12

Slide 256

Slide 256 text

90 Saturday, 17 November 12

Slide 257

Slide 257 text

PLEASE MAKE USE OF ALIASES 91 Saturday, 17 November 12

Slide 258

Slide 258 text

JANUS - VIM FOR THE REST OF US https://github.com/carlhuda/janus 92 Saturday, 17 November 12

Slide 259

Slide 259 text

OUR GIT WORKFLOW 93 Saturday, 17 November 12

Slide 260

Slide 260 text

OUR GIT WORKFLOW • Two deployable branches - “master” and “develop” 93 Saturday, 17 November 12

Slide 261

Slide 261 text

OUR GIT WORKFLOW • Two deployable branches - “master” and “develop” • Both branches connect to CI (Jenkins + Travis) 93 Saturday, 17 November 12

Slide 262

Slide 262 text

OUR GIT WORKFLOW • Two deployable branches - “master” and “develop” • Both branches connect to CI (Jenkins + Travis) • Small tweaks and hot-fixes push to deployable branches directly 93 Saturday, 17 November 12

Slide 263

Slide 263 text

OUR GIT WORKFLOW • Two deployable branches - “master” and “develop” • Both branches connect to CI (Jenkins + Travis) • Small tweaks and hot-fixes push to deployable branches directly • Disposable feature branches 93 Saturday, 17 November 12

Slide 264

Slide 264 text

OUR GIT WORKFLOW • Two deployable branches - “master” and “develop” • Both branches connect to CI (Jenkins + Travis) • Small tweaks and hot-fixes push to deployable branches directly • Disposable feature branches • Pull requests (w/ Travis) 93 Saturday, 17 November 12

Slide 265

Slide 265 text

OUR GIT WORKFLOW • Two deployable branches - “master” and “develop” • Both branches connect to CI (Jenkins + Travis) • Small tweaks and hot-fixes push to deployable branches directly • Disposable feature branches • Pull requests (w/ Travis) • Pull requests get reviewed 93 Saturday, 17 November 12

Slide 266

Slide 266 text

OUR GIT WORKFLOW • Two deployable branches - “master” and “develop” • Both branches connect to CI (Jenkins + Travis) • Small tweaks and hot-fixes push to deployable branches directly • Disposable feature branches • Pull requests (w/ Travis) • Pull requests get reviewed • Pull requests get merged 93 Saturday, 17 November 12

Slide 267

Slide 267 text

OUR GIT WORKFLOW • Two deployable branches - “master” and “develop” • Both branches connect to CI (Jenkins + Travis) • Small tweaks and hot-fixes push to deployable branches directly • Disposable feature branches • Pull requests (w/ Travis) • Pull requests get reviewed • Pull requests get merged • Release and profit! 93 Saturday, 17 November 12

Slide 268

Slide 268 text

CODE REVIEW 94 Saturday, 17 November 12

Slide 269

Slide 269 text

CODE REVIEW • Test coverage - SimpleCov https://github.com/colszowka/simplecov 94 Saturday, 17 November 12

Slide 270

Slide 270 text

CODE REVIEW • Test coverage - SimpleCov https://github.com/colszowka/simplecov • Code quality measurement - Cane https://github.com/square/cane 94 Saturday, 17 November 12

Slide 271

Slide 271 text

CODE REVIEW 95 Saturday, 17 November 12

Slide 272

Slide 272 text

CODE REVIEW • Pairing 95 Saturday, 17 November 12

Slide 273

Slide 273 text

CODE REVIEW • Pairing • GitHub pull requests 95 Saturday, 17 November 12

Slide 274

Slide 274 text

CONTINUOUS INTEGRATION AND DEPLOYMENT 96 Saturday, 17 November 12

Slide 275

Slide 275 text

CONTINUOUS INTEGRATION AND DEPLOYMENT Profile Repo Git Push 96 Saturday, 17 November 12

Slide 276

Slide 276 text

CONTINUOUS INTEGRATION AND DEPLOYMENT Profile Repo Git Push Profile CI 96 Saturday, 17 November 12

Slide 277

Slide 277 text

CONTINUOUS INTEGRATION AND DEPLOYMENT Profile Repo Git Push Platform Repo Git Push Profile CI 96 Saturday, 17 November 12

Slide 278

Slide 278 text

CONTINUOUS INTEGRATION AND DEPLOYMENT Profile Repo Git Push Platform Repo Git Push Profile CI Platform CI 96 Saturday, 17 November 12

Slide 279

Slide 279 text

CONTINUOUS INTEGRATION AND DEPLOYMENT Profile Repo Git Push Platform Repo Git Push Profile CI Platform CI Integration CI 96 Saturday, 17 November 12

Slide 280

Slide 280 text

CONTINUOUS INTEGRATION AND DEPLOYMENT Profile Repo Git Push Platform Repo Git Push Profile CI Platform CI Integration CI Profile Staging Platform Staging 96 Saturday, 17 November 12

Slide 281

Slide 281 text

CONTINUOUS INTEGRATION AND DEPLOYMENT Profile Repo Git Push Platform Repo Git Push Profile CI Platform CI Integration CI Scraper Repo Git Push Profile Staging Platform Staging 96 Saturday, 17 November 12

Slide 282

Slide 282 text

CONTINUOUS INTEGRATION AND DEPLOYMENT Profile Repo Git Push Platform Repo Git Push Profile CI Platform CI Integration CI Scraper Repo Git Push Scraper CI Profile Staging Platform Staging 96 Saturday, 17 November 12

Slide 283

Slide 283 text

CONTINUOUS INTEGRATION AND DEPLOYMENT Profile Repo Git Push Platform Repo Git Push Profile CI Platform CI Integration CI Scraper Repo Git Push Scraper Cron Job Scraper CI Profile Staging Platform Staging 96 Saturday, 17 November 12

Slide 284

Slide 284 text

CONTINUOUS INTEGRATION AND DEPLOYMENT Profile Repo Git Push Platform Repo Git Push Profile CI Platform CI Integration CI Scraper Repo Git Push Scraper Cron Job Scraper Staging Scraper CI Profile Staging Platform Staging 96 Saturday, 17 November 12

Slide 285

Slide 285 text

QUICK START 97 Saturday, 17 November 12

Slide 286

Slide 286 text

QUICK START • Start developing should be simple: 97 Saturday, 17 November 12

Slide 287

Slide 287 text

QUICK START • Start developing should be simple: • git checkout url_to_the_repo 97 Saturday, 17 November 12

Slide 288

Slide 288 text

QUICK START • Start developing should be simple: • git checkout url_to_the_repo • bundle 97 Saturday, 17 November 12

Slide 289

Slide 289 text

QUICK START • Start developing should be simple: • git checkout url_to_the_repo • bundle • rake app:reset 97 Saturday, 17 November 12

Slide 290

Slide 290 text

QUICK START • Start developing should be simple: • git checkout url_to_the_repo • bundle • rake app:reset • rails server 97 Saturday, 17 November 12

Slide 291

Slide 291 text

QUICK START • Start developing should be simple: • git checkout url_to_the_repo • bundle • rake app:reset • rails server • Use Foreman for processes https://github.com/ddollar/foreman 97 Saturday, 17 November 12

Slide 292

Slide 292 text

QUICK START 97 Saturday, 17 November 12

Slide 293

Slide 293 text

QUICK START 98 Saturday, 17 November 12

Slide 294

Slide 294 text

QUICK START 98 Saturday, 17 November 12

Slide 295

Slide 295 text

WHEN IN DOUBT READ THE SOURCE CODE 99 Saturday, 17 November 12

Slide 296

Slide 296 text

WHEN IN DOUBT READ THE SOURCE CODE 100 Saturday, 17 November 12

Slide 297

Slide 297 text

WHEN IN DOUBT READ THE SOURCE CODE 100 Saturday, 17 November 12

Slide 298

Slide 298 text

101 Saturday, 17 November 12

Slide 299

Slide 299 text

How about a fun little task... 101 Saturday, 17 November 12

Slide 300

Slide 300 text

A SMALL CODE TEST How about a fun little task... 101 Saturday, 17 November 12

Slide 301

Slide 301 text

102 Saturday, 17 November 12

Slide 302

Slide 302 text

102 Saturday, 17 November 12

Slide 303

Slide 303 text

102 Saturday, 17 November 12

Slide 304

Slide 304 text

102 Saturday, 17 November 12

Slide 305

Slide 305 text

A BAD SOLUTION 103 Saturday, 17 November 12

Slide 306

Slide 306 text

A BAD SOLUTION 104 Saturday, 17 November 12

Slide 307

Slide 307 text

ANOTHER BAD SOLUTION 105 Saturday, 17 November 12

Slide 308

Slide 308 text

ANOTHER BAD SOLUTION 106 Saturday, 17 November 12

Slide 309

Slide 309 text

A GOOD SOLUTION 107 Saturday, 17 November 12

Slide 310

Slide 310 text

A GOOD SOLUTION 108 Saturday, 17 November 12

Slide 311

Slide 311 text

ANOTHER GOOD SOLUTION 109 Saturday, 17 November 12

Slide 312

Slide 312 text

ANOTHER GOOD SOLUTION 110 Saturday, 17 November 12

Slide 313

Slide 313 text

111 Saturday, 17 November 12

Slide 314

Slide 314 text

And behold, for a solution that... 111 Saturday, 17 November 12

Slide 315

Slide 315 text

BLOWS YOUR MIND ޵䙽੧໨ʂ And behold, for a solution that... 111 Saturday, 17 November 12

Slide 316

Slide 316 text

A 坑爹 SOLUTION 112 Saturday, 17 November 12

Slide 317

Slide 317 text

A 坑爹 SOLUTION 113 Saturday, 17 November 12

Slide 318

Slide 318 text

A 坑爹 SOLUTION 113 Saturday, 17 November 12

Slide 319

Slide 319 text

A 坑爹 SOLUTION 114 Saturday, 17 November 12

Slide 320

Slide 320 text

A 坑爹 SOLUTION 你妹啊! 114 Saturday, 17 November 12

Slide 321

Slide 321 text

115 Saturday, 17 November 12

Slide 322

Slide 322 text

WTF?! And, sometimes you’ll get a weird one ... 115 Saturday, 17 November 12

Slide 323

Slide 323 text

“THIS IS A WELL-KNOWN MARS ROVER QUESTION.” 116 Saturday, 17 November 12

Slide 324

Slide 324 text

“THIS IS A WELL-KNOWN MARS ROVER QUESTION.” 你妹啊! 116 Saturday, 17 November 12

Slide 325

Slide 325 text

117 Saturday, 17 November 12

Slide 326

Slide 326 text

CHEAT And, once in a while, someone will attempt to ... 117 Saturday, 17 November 12

Slide 327

Slide 327 text

118 Saturday, 17 November 12

Slide 328

Slide 328 text

Thank you for informed me. I am writing to apologise the sloppy code. There was an unexpected house selling emergency last weekend. I was unable to spent enough time on the test. Your Agency is important to me, I value each opportunity you brought and always prepare it seriously. Please accept my sincere apology for missing this valuable job opportunity. -- Candidate who cheats 118 Saturday, 17 November 12

Slide 329

Slide 329 text

Thank you for informed me. I am writing to apologise the sloppy code. There was an unexpected house selling emergency last weekend. I was unable to spent enough time on the test. Your Agency is important to me, I value each opportunity you brought and always prepare it seriously. Please accept my sincere apology for missing this valuable job opportunity. -- Candidate who cheats 118 Saturday, 17 November 12

Slide 330

Slide 330 text

Thank you for informed me. I am writing to apologise the sloppy code. There was an unexpected house selling emergency last weekend. I was unable to spent enough time on the test. Your Agency is important to me, I value each opportunity you brought and always prepare it seriously. Please accept my sincere apology for missing this valuable job opportunity. -- Candidate who cheats 118 Saturday, 17 November 12

Slide 331

Slide 331 text

Thank you for informed me. I am writing to apologise the sloppy code. There was an unexpected house selling emergency last weekend. I was unable to spent enough time on the test. Your Agency is important to me, I value each opportunity you brought and always prepare it seriously. Please accept my sincere apology for missing this valuable job opportunity. -- Candidate who cheats 118 Saturday, 17 November 12

Slide 332

Slide 332 text

119 Saturday, 17 November 12

Slide 333

Slide 333 text

Writing features is (usually) not enough... 119 Saturday, 17 November 12

Slide 334

Slide 334 text

WE NEED TESTS! Writing features is (usually) not enough... 119 Saturday, 17 November 12

Slide 335

Slide 335 text

120 Saturday, 17 November 12

Slide 336

Slide 336 text

“I get paid for code that works, not for tests, so my philosophy is to test as little as possible to reach a given level of confidence.” -- Kent Beck 120 Saturday, 17 November 12

Slide 337

Slide 337 text

TDD != TEST FIRST 121 Saturday, 17 November 12

Slide 338

Slide 338 text

EFFECTIVE TESTS 122 Saturday, 17 November 12

Slide 339

Slide 339 text

EFFECTIVE TESTS 122 Saturday, 17 November 12

Slide 340

Slide 340 text

EFFECTIVE TESTS • They are describing ActiveRecord behaviours. 122 Saturday, 17 November 12

Slide 341

Slide 341 text

EFFECTIVE TESTS • They are describing ActiveRecord behaviours. • Allow mass assignments on foreign keys is wrong. 122 Saturday, 17 November 12

Slide 342

Slide 342 text

EFFECTIVE TESTS • They are describing ActiveRecord behaviours. • Allow mass assignments on foreign keys is wrong. • They are testing how methods are implemented. 122 Saturday, 17 November 12

Slide 343

Slide 343 text

EFFECTIVE TESTS • They are describing ActiveRecord behaviours. • Allow mass assignments on foreign keys is wrong. • They are testing how methods are implemented. • No confidence gained. 122 Saturday, 17 November 12

Slide 344

Slide 344 text

TEST WTFS • What are these “tests” actually testing? 123 Saturday, 17 November 12

Slide 345

Slide 345 text

TEST WTFS • What are these “tests” actually testing? 123 Saturday, 17 November 12

Slide 346

Slide 346 text

TEST WTFS • What are these “tests” actually testing? 123 Saturday, 17 November 12

Slide 347

Slide 347 text

DE-DUPLICATE TEST CASES 124 Saturday, 17 November 12

Slide 348

Slide 348 text

DE-DUPLICATE TEST CASES 125 Saturday, 17 November 12

Slide 349

Slide 349 text

DE-DUPLICATE TEST CASES 125 Saturday, 17 November 12

Slide 350

Slide 350 text

DE-DUPLICATE TEST CASES 125 Saturday, 17 November 12

Slide 351

Slide 351 text

DE-DUPLICATE TEST CASES 125 Saturday, 17 November 12

Slide 352

Slide 352 text

FASTER TESTS 126 Saturday, 17 November 12

Slide 353

Slide 353 text

FASTER TESTS • For objects that don’t matter, use mocks (but don’t abuse ‘em!) ⽆无关紧要的对象们使⽤用 mock 就可以了,但切勿滥⽤用! 126 Saturday, 17 November 12

Slide 354

Slide 354 text

FASTER TESTS • For objects that don’t matter, use mocks (but don’t abuse ‘em!) ⽆无关紧要的对象们使⽤用 mock 就可以了,但切勿滥⽤用! • When use factories, favour build to create 使⽤用对象⼯工⼚厂的话,尽量使⽤用 build ⽽而⾮非 create 126 Saturday, 17 November 12

Slide 355

Slide 355 text

FASTER TESTS • For objects that don’t matter, use mocks (but don’t abuse ‘em!) ⽆无关紧要的对象们使⽤用 mock 就可以了,但切勿滥⽤用! • When use factories, favour build to create 使⽤用对象⼯工⼚厂的话,尽量使⽤用 build ⽽而⾮非 create • In-memory SQLite instead of MySQL/PostgresSQL 可以的话,测试时使⽤用 SQLite 的内存储存 126 Saturday, 17 November 12

Slide 356

Slide 356 text

FASTER TESTS • For objects that don’t matter, use mocks (but don’t abuse ‘em!) ⽆无关紧要的对象们使⽤用 mock 就可以了,但切勿滥⽤用! • When use factories, favour build to create 使⽤用对象⼯工⼚厂的话,尽量使⽤用 build ⽽而⾮非 create • In-memory SQLite instead of MySQL/PostgresSQL 可以的话,测试时使⽤用 SQLite 的内存储存 • gem install slurp 126 Saturday, 17 November 12

Slide 357

Slide 357 text

REFACTOR WITH CONFIDENCE 127 Saturday, 17 November 12

Slide 358

Slide 358 text

REFACTOR WITH CONFIDENCE 127 Saturday, 17 November 12

Slide 359

Slide 359 text

REFACTOR IN THE WILD Improve code readability and maintainability 128 Saturday, 17 November 12

Slide 360

Slide 360 text

A SIMPLE EXAMPLE 129 Saturday, 17 November 12

Slide 361

Slide 361 text

130 Saturday, 17 November 12

Slide 362

Slide 362 text

130 Saturday, 17 November 12

Slide 363

Slide 363 text

130 Saturday, 17 November 12

Slide 364

Slide 364 text

KEEP CONTROLLERS CLEAN 131 Saturday, 17 November 12

Slide 365

Slide 365 text

132 Saturday, 17 November 12

Slide 366

Slide 366 text

132 Saturday, 17 November 12

Slide 367

Slide 367 text

132 Saturday, 17 November 12

Slide 368

Slide 368 text

132 Saturday, 17 November 12

Slide 369

Slide 369 text

132 Saturday, 17 November 12

Slide 370

Slide 370 text

133 Saturday, 17 November 12

Slide 371

Slide 371 text

A MORE COMPLETE EXAMPLE 134 Saturday, 17 November 12

Slide 372

Slide 372 text

PROBLEM 135 Saturday, 17 November 12

Slide 373

Slide 373 text

PROBLEM • A user has many trips 135 Saturday, 17 November 12

Slide 374

Slide 374 text

PROBLEM • A user has many trips • Each trip may contain more than one stops, e.g. • Beijing -> Shanghai • Shanghai -> Hongkong 135 Saturday, 17 November 12

Slide 375

Slide 375 text

PROBLEM • A user has many trips • Each trip may contain more than one stops, e.g. • Beijing -> Shanghai • Shanghai -> Hongkong • We only want to display the first stop from each trip 135 Saturday, 17 November 12

Slide 376

Slide 376 text

136 Saturday, 17 November 12

Slide 377

Slide 377 text

136 Saturday, 17 November 12

Slide 378

Slide 378 text

136 Saturday, 17 November 12

Slide 379

Slide 379 text

136 Saturday, 17 November 12

Slide 380

Slide 380 text

136 Saturday, 17 November 12

Slide 381

Slide 381 text

136 Saturday, 17 November 12

Slide 382

Slide 382 text

136 Saturday, 17 November 12

Slide 383

Slide 383 text

136 Saturday, 17 November 12

Slide 384

Slide 384 text

136 Saturday, 17 November 12

Slide 385

Slide 385 text

137 Saturday, 17 November 12

Slide 386

Slide 386 text

137 Saturday, 17 November 12

Slide 387

Slide 387 text

138 Saturday, 17 November 12

Slide 388

Slide 388 text

138 Saturday, 17 November 12

Slide 389

Slide 389 text

A RUBY-CHINA EXAMPLE Albeit an old example, but nonetheless... 139 Saturday, 17 November 12

Slide 390

Slide 390 text

140 Saturday, 17 November 12

Slide 391

Slide 391 text

140 Saturday, 17 November 12

Slide 392

Slide 392 text

140 Saturday, 17 November 12

Slide 393

Slide 393 text

140 Saturday, 17 November 12

Slide 394

Slide 394 text

140 Saturday, 17 November 12

Slide 395

Slide 395 text

141 Saturday, 17 November 12

Slide 396

Slide 396 text

142 Saturday, 17 November 12

Slide 397

Slide 397 text

REFACTOR + OPEN SOURCE 143 Saturday, 17 November 12

Slide 398

Slide 398 text

IDENTIFY THE ISSUE 144 Saturday, 17 November 12

Slide 399

Slide 399 text

IDENTIFY THE ISSUE 144 Saturday, 17 November 12

Slide 400

Slide 400 text

ATTEMPT TO REFACTOR 145 Saturday, 17 November 12

Slide 401

Slide 401 text

ATTEMPT TO REFACTOR 145 Saturday, 17 November 12

Slide 402

Slide 402 text

ENCOUNTER UNEXPECTED PROBLEM 146 Saturday, 17 November 12

Slide 403

Slide 403 text

ENSURE CODE INTEGRITY 147 Saturday, 17 November 12

Slide 404

Slide 404 text

VERIFY THE ISSUE ELSEWHERE 148 Saturday, 17 November 12

Slide 405

Slide 405 text

BEGIN DEBUGGING... 149 Saturday, 17 November 12

Slide 406

Slide 406 text

TRACK DOWN THE CAUSE 150 Saturday, 17 November 12

Slide 407

Slide 407 text

TRACK DOWN THE CAUSE 150 Saturday, 17 November 12

Slide 408

Slide 408 text

FIX IT! 151 Saturday, 17 November 12

Slide 409

Slide 409 text

FIX IT! 151 Saturday, 17 November 12

Slide 410

Slide 410 text

ENSURE IT ACTUALLY WORKS 152 Saturday, 17 November 12

Slide 411

Slide 411 text

ENSURE IT ACTUALLY WORKS 152 Saturday, 17 November 12

Slide 412

Slide 412 text

ENSURE IT DIDN’T BREAK ANYTHING 153 Saturday, 17 November 12

Slide 413

Slide 413 text

PULL REQUEST 154 Saturday, 17 November 12

Slide 414

Slide 414 text

155 Saturday, 17 November 12

Slide 415

Slide 415 text

“There are only two hard things in Computer Science: cache invalidation and naming things.” -- Phil Karlton 155 Saturday, 17 November 12

Slide 416

Slide 416 text

Approval User Role ? 156 Saturday, 17 November 12

Slide 417

Slide 417 text

Approval User Role UserApproval 157 Saturday, 17 November 12

Slide 418

Slide 418 text

PROBLEM WITH “UserApproval” 158 Saturday, 17 November 12

Slide 419

Slide 419 text

PROBLEM WITH “UserApproval” • What does it mean? 158 Saturday, 17 November 12

Slide 420

Slide 420 text

PROBLEM WITH “UserApproval” • What does it mean? • A user’s approval? Nope. 158 Saturday, 17 November 12

Slide 421

Slide 421 text

PROBLEM WITH “UserApproval” • What does it mean? • A user’s approval? Nope. • An approval’s user? Nope. 158 Saturday, 17 November 12

Slide 422

Slide 422 text

PROBLEM WITH “UserApproval” • What does it mean? • A user’s approval? Nope. • An approval’s user? Nope. • So, it’s not an approval, or a user. 158 Saturday, 17 November 12

Slide 423

Slide 423 text

PROBLEM WITH “UserApproval” • What does it mean? • A user’s approval? Nope. • An approval’s user? Nope. • So, it’s not an approval, or a user. • Where’s the indication of “role”? 158 Saturday, 17 November 12

Slide 424

Slide 424 text

Approval User Role ? 159 Saturday, 17 November 12

Slide 425

Slide 425 text

Approval User Role Stakeholder 160 Saturday, 17 November 12

Slide 426

Slide 426 text

UserApproval vs Stakeholder 161 Saturday, 17 November 12

Slide 427

Slide 427 text

EMBRACE RUBY We are a fortunate bunch. 162 Saturday, 17 November 12

Slide 428

Slide 428 text

163 Saturday, 17 November 12

Slide 429

Slide 429 text

This portion of the slide is intentionally left blank. One function?! 164 Saturday, 17 November 12

Slide 430

Slide 430 text

MORE RESOURCES Learn, Learn and Learn 165 Saturday, 17 November 12

Slide 431

Slide 431 text

RAILSCASTS.COM 166 Saturday, 17 November 12

Slide 432

Slide 432 text

PEEPCODE.COM 167 Saturday, 17 November 12

Slide 433

Slide 433 text

DESTROYALLSOFTWARE.COM 168 Saturday, 17 November 12

Slide 434

Slide 434 text

CONFREAKS.COM 169 Saturday, 17 November 12

Slide 435

Slide 435 text

THECHANGELOG.COM 170 Saturday, 17 November 12

Slide 436

Slide 436 text

CODESCHOOL.COM 171 Saturday, 17 November 12

Slide 437

Slide 437 text

RUBYINSIDE.COM 172 Saturday, 17 November 12

Slide 438

Slide 438 text

RUBYFLOW.COM 173 Saturday, 17 November 12

Slide 439

Slide 439 text

RUBYWEEKLY.COM 174 Saturday, 17 November 12

Slide 440

Slide 440 text

NET.TUTSPLUS.COM 175 Saturday, 17 November 12

Slide 441

Slide 441 text

RUBYSOURCE.COM 176 Saturday, 17 November 12

Slide 442

Slide 442 text

NEWS.YCOMBINATOR.COM 177 Saturday, 17 November 12

Slide 443

Slide 443 text

THANK YOU! :-) 178 Saturday, 17 November 12