Categories: NewsPHP

Why Facebook’s Hack May Fail to Fly With PHP Developers?

Well, for those innocent souls, I must make it clear that the title of this article has no intentions to point out that Facebook is hacked or so? This is actually about the new programming language, HACK, that Facebook officially launched few days back.
Overview of Hack Language
Before I go on to write further, I must thank the Facebook engineering team to have rightfully identified some of the short-comings of PHP programming language and tried to present solutions to them using Hack programming language. However, while I was going through the changes that they made by adding new features to PHP and made it as Hack language, I wondered whether it added more complexity to the language that was meant to be dynamically scripting language made for WEB and, that this would be well received by PHP programmers, in general. Following are some of the key features that have been added:
  • Static typing: With static typing, one may associate the data type of the variable while defining the variable. This is not present in existing versions of PHP. Thus, following becomes possible with Hack:private string $x = ”;
  • 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 type languages like C# and Java).
  • Nullable Types: Nullable types allows a safer way to deal with nulls and is very useful for primitive types that don’t generally allow null as one of their values, such as bool and int (using ?bool and ?int respectively).
  • Collections:  One can now create parameterized collections Vector, Map, Set etc that is meant to store/contain pre-defined types of objects conforming to the policy set by the container.

Mind you that programs written in Hack language would need HHVM, an open-source virtual machine to run. It would not run with PHP.exe.

Why Hack may Fail to Fly?

Following are some of the reasons, in my opinion, due to which HACK may fail to fly with average php developers:

It is a general notion in developers’ community that they prefer to go with adoption of technologies including programming languages which is supported/driven by community rather than a specific organization such as Facebook, Google etc although they make the technology open-source. That said, there have been many frameworks that were open sourced by large companies such as Facebook, Google, Twitter etc which were very well received by developers community at large. However, if it comes down to something such as programming language such as PHP, which has been driven by a large community, this becomes a different ball game all together.

On the similar lines, the very fact that the language is supported by one company may not be good enough reason for PHP developer community to accept as you never really know when they would supporting adding enhancements to the language.

Why Not Use Java & the Likes?

Many features such as nullable types,  static typing, generics, collections etc, bringing greater capability to PHP, seem to be motivated from strongly typed languages such as Java & C#. The primary reasons being cited for adding some of these features are some of the following:

  • The need to be able to release more than once a day vis-a-vis lesser time spent in testing by avoiding bugs upfront arising due to issues such as invocation of methods on null objects only getting caught at runtime, lack of clarity on object types on whom methods are invoked etc.
  • Ease of maintainability as code gets easier to change due to features such as static typing, generics etc.
However, the counter argument could be the fact that if the objective is to create enterprise level software/application, why would one opt for PHP like language such as Hack, when you have languages such as Java having so much widespread community support. PHP language sees widespread adoption due to its very nature of loosely typed language vis-a-vis rapid development that it facilitates. That said, it would be unfair to say that enterprise applications could not created with language such as PHP. There have been many examples including Facebook and Yahoo who have trusted on PHP with a caveat that they went on to enhance PHP with their own versions such as HACK to meet the needs for enterprise development.

I, myself, being both a JAVA and PHP developer would prefer to use PHP with all its so-called shortcomings rather than HACK just because of its characteristic such as simplicity and rapid development.

This is my personal opinion with absolutely no intention to disregard HACK and I would love to hear you think.

[adsenseyu1]
Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking.

Recent Posts

Agentic Reasoning Design Patterns in AI: Examples

In recent years, artificial intelligence (AI) has evolved to include more sophisticated and capable agents,…

2 months ago

LLMs for Adaptive Learning & Personalized Education

Adaptive learning helps in tailoring learning experiences to fit the unique needs of each student.…

2 months ago

Sparse Mixture of Experts (MoE) Models: Examples

With the increasing demand for more powerful machine learning (ML) systems that can handle diverse…

3 months ago

Anxiety Disorder Detection & Machine Learning Techniques

Anxiety is a common mental health condition that affects millions of people around the world.…

3 months ago

Confounder Features & Machine Learning Models: Examples

In machine learning, confounder features or variables can significantly affect the accuracy and validity of…

3 months ago

Credit Card Fraud Detection & Machine Learning

Last updated: 26 Sept, 2024 Credit card fraud detection is a major concern for credit…

3 months ago