MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.


I'm not curious

The HipHop Virtual Machine with the Hack programming language

Published on 25 June 15
2173
0
3
The HipHop Virtual Machine with the Hack programming language - Image 1
HipHop Virtual Machine

HipHop Virtual Machine or (HHVM) is an open-source virtual machine designed for executing programs written in PHP and hack. HHVM is used by many including the omnipresent site, Facebook. Furthermore, HHVM employs much of the internetâs current PHP.
Whatâs hack?
The HipHop Virtual Machine with the Hack programming language - Image 2
Yes, hack. For the benefit of those who are not aware that thereâs a programming language called hack, the Hack language is derived from PHP and possess both static typing and dynamic typing functions, while also supplementing additional features such as generics and type aliasing. For example, Facebook has utilized hack successfully where the majority of the PHP codebase has been migrated to Hack, since the hack language appears to be similar to PHP.

Also with hack, it doesnât require programmers to stay on a defined statically typed language like Java or with a dynamically typed language like JavaScript or Perl. Hackâs benefit is that it grants programmers flexibility by typing statically or dynamically in a very detailed manner, which is ideal in catering to varying work demands.
Examples of Hack programming codes:
1) Type Annotations allow for code to be explicitly typed on parameters, class member variables and return values
<?hh
class MyClass {
const int MyConst = 0;
private string $x = '';
public function increment(int $x): int {
$y = $x + 1;
return $y;
}
}
2) Generics allow classes and methods to be parameterized in the same vein as statically type languages like C# :
<?hh
class Box<T> {
protected T $data;

public function __construct(T $data) {
$this->data = $data;
}

public function getData(): T {
return $this->data;
}
}
So what is HipHop Virtual Machine and how did it came about?
Firstly, the term HipHop came from HPHPc, a PHP transpiler, created by a team at Facebook, to help save resources on Facebook servers due to the massive PHP codebase of Facebook. However, there were problems with HPHPc such as absence of full support for the PHP language and troubles pertaining to specific time and resource-consuming development and deployment processes.


Eventually, the PHP transpiler was replaced by HHVM due to its more impressive just-in-time (JIT) compilation-based execution engine.
Benefits of HHVM
1) Just-in-time (JIT) Compilation
The HHVM machine makes use of a just-in-time (JIT) compilation approach to attain powerful web performance while keeping the development flexibility of the PHP language. HHVMâs JIT compilation means that it consolidates Hack and PHP into an intermediate HipHop bytecode which translates into an x64 machine code dynamically at runtime. Thus, the JIT compilation enables optimizations that are not possible in a statically compiled binary, hence enabling a much powerful performance on your Hack and PHP programs.

2) High speeds and efficiency of PHP based development
HHVM is way faster than PHP, even with the default PHP built in OpCache. Also, with static typing through the hack language, you can start files you want to type check before compilation with <?hh instead of <?php, and the compiler will automatically do the rest of the work. Hence, through static typing, you have a higher quality of compilation and a more efficient programming of native codes.
Over at Facebook, the HipHop team highlighted that HHVM improves the efficiency of PHP execution and increases productivity for PHP developers. Using Hack, programmers will have iterative cycles between writing a line of code and seeing the change on the front end, allowing you to refresh and see changes instantly. Hence, it makes it easy to integrate into the development workflow without introducing a noticeable delay.

3) Performance
We would all certainly appreciate it if our website has decent loading speed and lesser delays with the response time. Such factors would impact notably on end-users. With HHVM, it has the ability to make use of live type information to create effective native codes resulting to an increase in web server throughput and reduced latency.
Conclusion
Besides Facebook, other known sites have also been using HHMV programs including Baidu, Box, and Wikipedia. Furthermore, it seems like Hack and HHVM are paving the way for future programming which is less determined by decisions such as static versus dynamic language. The prospect is that with Hack programming gaining more prominence for its uses, it will be used beyond PHP based services.

As quoted by Julien Verlaguet, part of the team behind the hack programming language on Facebook, she claimed that People donât realize just how extensively this is used at Facebook. Itâs really the de facto service side language here. He then further emphasized for anyone who is employed at Facebook, this is the way development is conceptualized.

Well folks, it looks like we may get a chance to see even more innovative programming at play as advancement of web developer tools make their way to our computers.































The HipHop Virtual Machine with the Hack programming language - Image 1

HipHop Virtual Machine

HipHop Virtual Machine or (HHVM) is an open-source virtual machine designed for executing programs written in PHP and hack. HHVM is used by many including the omnipresent site, Facebook. Furthermore, HHVM employs much of the internetâs current PHP.

Whatâs hack?

The HipHop Virtual Machine with the Hack programming language - Image 2

Yes, hack. For the benefit of those who are not aware that thereâs a programming language called hack, the Hack language is derived from PHP and possess both static typing and dynamic typing functions, while also supplementing additional features such as generics and type aliasing. For example, Facebook has utilized hack successfully where the majority of the PHP codebase has been migrated to Hack, since the hack language appears to be similar to PHP.

Also with hack, it doesnât require programmers to stay on a defined statically typed language like Java or with a dynamically typed language like JavaScript or Perl. Hackâs benefit is that it grants programmers flexibility by typing statically or dynamically in a very detailed manner, which is ideal in catering to varying work demands.

Examples of Hack programming codes:

1) Type Annotations allow for code to be explicitly typed on parameters, class member variables and return values

This blog is listed under Open Source , Development & Implementations , Digital Media & Games and E-Commerce Community

Post a Comment

Please notify me the replies via email.

Important:
  • We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
  • To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
  • Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
You may also be interested in
Awards & Accolades for MyTechLogy
Winner of
REDHERRING
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url

Back to Top