My First Post      My Facebook Profile      My MeOnShow Profile      W3LC Facebook Page      Learners Consortium Group      Job Portal      Shopping @Yeyhi.com

Pages










Friday, March 6, 2020

My First look of Hack Language over HHVM by Facebook

Hack is a great language in terms of the advantages it has over PHP. The hack language introduce a level of type safety and related concepts. Undoubtedly, with HHVM it becomes a faster processing language. It is more expressive, more economic, it is faster to write and catch more bugs. The key features as explained by Facebook itself are:

Fast Development
Hack reconciles the fast development cycle of a dynamically typed language with the discipline provided by static typing, while adding many features commonly found in other modern programming languages.


Type Checking
Hack provides instantaneous type checking by incrementally checking your files as you edit them. It typically runs in less than 200 milliseconds, making it easy to integrate into your development workflow without introducing a noticeable delay.


Built for HHVM
Hack is built specifically for HHVM, a high performance 


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


Generics
Generics allow classes and methods to be parameterized (i.e., a type associated when a class is instantiated or a method is called) in the same vein as statically typed languages like C# and Java).

Lambdas
Lambdas succinctly allow definition of first-class functions.


HHVM is an open-source virtual machine designed for executing programs written in Hack. HHVM uses a just-in-time (JIT) compilation approach to achieve superior performance while maintaining amazing development flexibility. HHVM should be used together with a webserver like the built in, easy to deploy Proxygen, or a FastCGI-based webserver on top of nginx or Apache.

Released in 2014, Hack is still not so much popular and I see following as the reasons.
  1. I cannot find any big hosting provider to support HHVM hosting and support for Hack language. You need to maintain your own server. This is one of the big issues that I see with Hack.
  2. Vast majority of php programmers do not build using TDD approach or do lots of whitebox testing. Hence, the benefit of type checking does not attract them much. For many hhvm is just a slightly faster incompatible php, no surprise they aren’t going to invest much there.
  3. Installing Hack on different systems require more technical knowledge. Novice programmers usually lack the skills of core OS. Also, on some systems you need to build HHVM from scratch using the source code repo.
  4. Backwards compatibility with PHP is not 100%. Almost all PHP code works in Hack but there are certain features of PHOP which is not supported in Hack. Hack may have some incompatibility with existing PHP codebases, which increases the cost of switching.
  5. Not everyone needs the amount of scalebilty the companies like Facebook need.
  6. Other bigger eCom and web companies are trying with new RAD tools like React and doing pretty well in their NodeJS world. Webservices are already build using Java or C# and they do not want to come to PHP of Hack.
  7. Hack doesn't allow templating of HTML and Hack code together, which is a popular feature of PHP. You need an engine in between.
  8. Last, but not the least, no one knows how far facebook itself will support the developemnt and Bug fixes in Hack or HHVM.

However, we should also understand that in the world of PHP, the language Hack becomes very useful. It will help developers catch some errors while writing the code itself. Further, the dev tools by Facebook and other contributors are also very exciting. So, I will be experimenting more with the language. Will keep you all posted about new features.

No comments:

Post a Comment