3

How to quickly learn Hack language?

Profile picture
Staff Software Engineer [E6] at Meta3 months ago

The Hack language is indeed associated with PHP but it's not exactly a new version of PHP. Instead, Hack is a programming language developed by Meta (formerly Facebook) that operates within the same ecosystem as PHP and is designed to interoperate with PHP code. Hack extends PHP by adding additional features such as static typing, type inference, generics, nullable types, and async programming, among others.

Hack aims to maintain the fast development cycle of PHP while offering the added reliability of static typing, enhancing both performance and safety. It was developed to address some of the shortcomings and challenges of working with large PHP codebases, especially in a fast-paced development environment. Hack and PHP codes can coexist, allowing developers to gradually migrate PHP codebases to Hack, providing a smooth transition pathway without requiring a full rewrite. Meta originally developed Hack to run on the HipHop Virtual Machine (HHVM), which is used to execute both Hack and PHP code, significantly improving execution times compared to the standard PHP interpreter.

94
5

Discussion

(5 comments)
  • 2
    Profile picture
    Staff Eng @ Google, Ex-Meta SWE, Ex-Amazon SDM/SDE
    3 months ago

    The question up top makes sense, but the rest of that seems like it’s copied from a wiki or generated by an LLM.

    Read documents. Write toy code. Read real code. Add/extend real code. Read code reviews of experienced engineers writing Hack, and see what they are doing, and what feedback they get. Submit a few reviews yourself for minor/softball/bootcamp bugs. See what people say and why you did it wrong.

    If you iterate the steps you think are helping (revisit docs after you’ve tried some things and are more likely to understand them, read more code with fresh eyes, etc).

    When reading code, ideally find things that are being newly-written in Hack, not piecewise conversions from PHP. When people are writing new, clean code in Hack, what does that look like? You want to emulate that, not the just-barely-converted legacy PHP.

    I have to imagine… I can’t remember the name, I think “code lab” is Google’s name… but there are classes that have a “lab” element to do sandbox coding in. Definitely do that, there must be a Hack one, I would bet maybe multiple.

    I’m guessing you’re not going to find a ton of howtos online, as Hack, while open source, seems to have limited use outside of Meta (they say Slack and Box, but that’s not critical mass). As such you’re going to be relying on internal resources, but it is invested in heavily, so there are a lot of those. I’d bet there’s “learn Hack” workplace groups and things to get support, etc.

    • 2
      Profile picture
      Tech Lead/Manager at Meta, Pinterest, Kosei
      3 months ago

      The description text definitely seems AI-generated :/

      @OP: you're going to get much better answers if you write like a human -- people want to help other people, not bots. Prove you're human by sharing context about your situation and what you're looking for help on.

      If you want to reference something, just link it instead of copying the paste in the text.

  • 2
    Profile picture
    Staff Software Engineer [E6] [OP]
    Meta
    3 months ago

    My situation is that I am new to Meta. I am on the new project, and newly formed team. There are some people who were here a while but they are not engineers. One engineer that is knowledgeable is super busy and do not write code - he is busy with design work, alignment and roadmap plannings. I tried to find micro-mentorships with other orgs. I signed up for E6/E7 program to buddy up with experienced engineers. I am hoping to cover my gaps since the project we are working on is a high priority and I need to be a code machine on this project in a month or two. How to learn quicker and to understand existing code base in the tech stack that is totally new to me?

Meta Platforms, Inc. is an American multinational technology conglomerate based in Menlo Park, California. The company owns 3 of top 4 social networks in the world: Facebook, Instagram, and WhatsApp. More than 3.5 billion people use at least one of the company's core products every month.
Meta246 questions