Comparing Laravel to the Play framework

Web development has moved beyond what the best language for the job is (since they all contain many of the same features, just in different forms) and into choosing the best framework to use. Frameworks create a base for developers to perform tasks that are used in all web applications without having to do the leg work. Two popular frameworks right now are Laravel and Play. One uses PHP and the other uses Java. So which one is better?

The most widely used framework for PHP is called Laravel. This is an open-source (free) framework that has a huge community and development team behind it. The documentation is substantial and there are many forms so even developers that are new to the framework can quickly pick it up.

Laravel Framework Features:

  1. Contains weak Type Safety (Information won’t be changing as it moves through the system, most of the time.)
  2. Using MVC architecture. (Makes code much more manageable and easier to navigate)
  3. Auto-compiling (No wait time to see the changes that are made being implemented)
  4. Open Source (Loads of great add-ons and libraries to enhance the functionality of the system without having to custom code)
  5. RESTful routing built-in (Great for building APIs)
  6. PHP was built for the web (Many built in functions and conventions that make web application creation easier)

One of the biggest complaints people have against PHP is that all the functions are synchronous. This means that large volume usage can potentially become a problem if your infrastructure is not large enough. That being said it is very easy to scale up Laravel products and there are even tools built by the guys at Laravel to make this scaling even easier. Laravel also has node.js built-in which allows for requests and many other functions to be run through the Javascript making them asynchronous! So one of the only complaints that people have about PHP (synchronous actions) is solved by Laravel.

People are Scared of PHP.

People may also be wary of PHP due to its dark past. PHP started out as an unstructured, mostly unregulated language that developers eventually grew scared of. Luckily this was 5 years ago and since then PHP has grown into a very structured language that is talked about in the same respect as other more widely accepted languages such as Java and Python. Developers need not fear that Laravel uses PHP.

That being said, many people can’t shake the feelings they used to get from PHP and stick to Java when creating their web applications. One of the most popular frameworks for Java right now is called Play. It is also open source but the documentation and community behind it is smaller. I think this is largely because it is mostly used for Enterprise projects where people don’t want to be sharing code. This means that most projects in Play need to be all custom and that can end up costing a lot of money if you are paying for the development. That being said let’s look at some of the features that Play.

Play Framework Features:

  1. Contains Type Safety (Built into the Java Language)
  2. Uses the MVC Architecture (Makes code much more manageable and easier to navigate, however, Java syntax can be quite confusing.)
  3. Auto-compiling (Java doesn’t normally do this but Play has built it in)
  4. Open-source (Doesn’t seem to be quite as extensive as Laravels but still big)
  5. Asynchronous (All actions get queued and do not block threads)

Play has a lot of great features but it is built on Java and that can provide a few problems. Java is an older language and was not made specifically for the web. That means it does not contain as much of the built-in functionality as PHP. There are packages that can accomplish this but you are required to find reliable ones and it can bloat your framework. Java has always been notorious for huge headers in all files. This can make the code more difficult to read and can lead to more mistakes as imports can easily be missed in files.

Java runs faster than most.

Java does contain many great features. Its purpose when it was built was to be as secure as possible and that goal is still maintained to this day. Because of this emphasis on security many enterprise systems choose Java. Most new languages do take from Java though, and implement many of the same security features that Java has.

Java is also a compiled language so it can have a better performance rate that PHP if it is built right. There are more performance features that can be built into the compiled stage than an interpreted language. For most small scale projects not much effect will be seen but at a certain scale, Java does provide optimizations that a language like PHP can’t provide.

Overall these are two great frameworks built to make coding web applications as easy as possible. Personally, I prefer the readability and community behind Laravel and PHP but Play and Java provide a great alternative to those that are still wary of PHP.

2017-12-19T14:07:24+00:00By |