Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Hack - Why Should I Care?

Hack - Why Should I Care?

version given at Nomad PHP EU in April 2015

Joel Clermont

April 23, 2015
Tweet

More Decks by Joel Clermont

Other Decks in Programming

Transcript

  1. What to expect • No insider secrets • High-level tour

    of Hack’s unique features • Make the case why you should try it out
  2. What to expect • No insider secrets • High-level tour

    of Hack’s unique features • Make the case why you should try it out • Show you how to get started
  3. What to expect • No insider secrets • High-level tour

    of Hack’s unique features • Make the case why you should try it out • Show you how to get started • Answer all your questions
  4. Type Annotations
 What do we get out of it? •

    Easier for developers to understand intent
  5. Type Annotations
 What do we get out of it? •

    Easier for developers to understand intent • Correctness of our type system
  6. Type Annotations
 What do we get out of it? •

    Easier for developers to understand intent • Correctness of our type system • Easier to refactor
  7. Doesn’t PHP already have type hints? • Scalar type hints

    • Typed arrays • Nullable types • Function return type hints
  8. Doesn’t PHP already have type hints? • Scalar type hints

    • Typed arrays • Nullable types • Function return type hints • Type checker
  9. Collections Other nice features • Familiar interface • OutOfBoundsException •

    Collections are objects (no more passing by ref) • Immutable collections too
  10. And more . . . • User attributes • Enhancements

    to traits • Async / await • Constructor promotion • Shapes • Type aliases . . . .
  11. Trying out Hack is not scary • Gradual process •

    Full PHP interoperability • Not just for multi-million line codebases
  12. Trying out Hack is not scary • Gradual process •

    Full PHP interoperability • Not just for multi-million line codebases • Awesome tooling
  13. How to get started • Install HHVM (packages available) •

    Convert existing code with hackificator
  14. How to get started • Install HHVM (packages available) •

    Convert existing code with hackificator • Monitor logs for type errors
  15. How to get started • Install HHVM (packages available) •

    Convert existing code with hackificator • Monitor logs for type errors • Harden your types over time
  16. Resources • Conversion guide
 http://docs.hhvm.com/manual/en/install.hack.conversion.php • HHVM blog http://hhvm.com/blog •

    IRC channel #hhvm • http://hhvm.com/frameworks/ • https://github.com/facebook/hhvm/wiki/Extensions