1. Functional Programming
at Verizon OnCue
6th September 2014
Timothy Perrett
Service Architect
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement.
2. Secret project.
Formally Intel Media; purchased by Verizon
in early 2014.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 2
3. Completely “green field”.
Every conceivable system component was being
created from scratch.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 3
4. Scala Services.
Using FP for all platform services from day one.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 4
5. Challenges.
We’ve broken our fair share of eggs making this
particular omelet.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 5
6. Explosion in team size.
Engineering group expanded by an order of
magnitude within the first year.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 6
7. Utilize market conditions.
Market supply of specific skills is nearly always
eclipsed by supply of candidates with strong
engineering aptitude.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 7
8. Every engineer is unique.
Engineers are people; not pluggable resources.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 8
9. Effort of learning FP
Effort
Time
Time in a single language
Ease of learning FP
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 9
10. Effort of learning FP
Effort
Time in a single language
Ease of learning FP Less unlearning;
FP more intuitive
Time
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 10
11. Effort of learning FP
Effort
Time
Time in a single language
Large unlearning Ease of learning FP
period; FP “is hard”
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 11
12. Perceived difficulty.
“Constant struggle against your own instincts”
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 12
13. Effort of learning FP
Cost of learning FP vs time in multiple PL paradigms
Time in n-PL Ease of learning FP
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 13
14. Strong teams need both.
Embrace change, tackle challenges together.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 14
15. Distribute team education.
Centralized education alone is not enough. Use
education, pair programming and team sessions.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 15
16. Provide space to learn.
Be prepared to allow the team to make mistakes, give
room to learn and encourage experimentation.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 16
17. Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 17
18. Libraries can be dangerous.
Encouraging reuse across a large team results in
inconsistent, lossy abstractions.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 18
19. Functional core. Imperative API.
Internally functional libraries can have optional
imperative APIs for easier migration / learning curve.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 19
20. Code Example
val config: Task[Config] =
knobs.loadImmutable(Required(FileResource(...))) or
knobs.loadImmutable(Required(ClassPathResource(...)))
val connection: Task[Connection] =
for {
cfg <- config
usr <- cfg.require[String]("db.username")
pwd <- cfg.require[String]("db.password")
prt <- cfg.lookup[String]("db.port")
} yield Connection(usr,pwd,port)
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 20
21. Code Example
import instruments.timer
val taken = timer(
name = "time-taken",
description = "Time taken to compute Foos")
def thing(x: Bar): Foo =
taken.time {
// compute Foo
}
def thingAsync(x: Bar): Task[Foo] =
taken.timeTask(taskComputingFoo)
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 21
22. Writing from scratch is a win
If you can: build it. Taylor to your orgs’ needs.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 22
23. Numerous internal libraries.
Monitoring. Configuration. Graph Processing.
Logging. Functional RPC system… and many more.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 23
24. Minimal external dependencies*
Scalaz. Scalaz-Stream. Scodec. Shapeless.
*working on the jvm often makes this problematic (log4j, slf4j etc).
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 24
25. Was it worth it?
100% yes. Choosing to use functional programming
has ultimately eased our lives considerably.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 25
26. Change is easy.
So easy we don’t even notice the daily win.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 26
27. New and exciting wins the day.
Happy teams are productive teams.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 27
28. We’re hiring!
At every level of the stack. Yes, really.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 28
29. Q&A
Thank you for listening.
Confidential and proprietary materials for authorized Verizon personnel and outside agencies only. Use, disclosure or distribution of this material is not permitted to any unauthorized persons or third parties except by written agreement. 29
Editor's Notes
How do you scale a large team doing functional programming?
What are the risks?
What are the benefits?
Tell the story about kelly.
Diverse set of technical backgrounds within engineering team
Everything from seasoned C++ and Java veterans to Rubyists
Strong teams need the experience and depth long-time platform users bring, but the organization also needs evangelists to keep the FP momentum going and to stop managers slipping into the “we only know Java, so that’s what we’ll hire for” mode.
+ Encourage a culture where staff can ask their desk neighbors questions and work together.
+ Pair juniors with both seniors and occasionally other juniors: everyone can be both a teacher and student.
+ The line between a generilized abstraction and obfuscation of well understood apis is far thinner than most give credit for.
+ Accept that you will acrew technical debt
Despite this overhead, FP has still be a huge win within the organization for several reasons:
in our daily work we find that changing things is very easy; so easy in fact that we dont even notice the daily wins. (e.g. knobs refactor)
sense of newness keeps the team pumped and having a high morale ultimately makes the team more productive overall
Ultimately its not Java!