Why did we choose PHP?
There are many choices these days with a heated debate about which one is the best programming language to choose for an online web platform. Most of the debate is technical in nature and focus on areas like architecture, performance implications, flexibility, and extensibility of the platform. We have taken all the technical aspects into considerations, but we have bundled that with other business factors to come up with a decision on the programming language to build Storat.com with.
The choices between programming languages look endless, but when you go into a deeper business/technical evaluation, the choices come down to a few. The list of languages we shortlisted was:
- The non-blocking I/O that produces high-performance server-side applications,
- PHP: One of the early popular dynamic languages for Internet applications and websites. Php is the most widely used programming language on the web powering companies like Facebook and WordPress. PHP has a large ecosystem of developers and tens of frameworks to choose from. PHP is a rebel rule-less language, as a result, larger projects can become difficult to maintain, a problem known as “Spaghetti Code”.
- Ruby on Rails: is a popular framework and dynamic language powering the alike of twitter (although it seems twitter decided to migrate a portion of their front-end to Scala because of scalability issue), Airbnb, and Groupon. Ruby is an elegant language with a strong object orientation root.
- Python: is another dynamic programming language adopted by companies like Pinterest and Instagram. It is also very famous in the scientific community because of the large number of scientific libraries available.
For Storat.com, we have adopted a standard LAMP architecture. While LAMP stands for (Linux, Apache, MySQL, PHP), you can replace any of the components with your choice of language or platform based on the needs of your application. For Storat.com, we have built the platform on the following architecture:
- Operation System: Linux Ubuntu and CentOS flavors
- Web Server: we started with Apache but we migrated recently to Nginx as part of the performance optimization process.
- Database and Data-structures: We are currently running Storat.com on four different data platforms:
- MySQL Database for structured data: suited and optimized by the open-source community to hold millions of records and support millions of concurrent users through a scale-out architecture. It is being used heavily by Facebook and Google in such a scenario. However, as part of our optimization roadmap, we have factored the code to give us the flexibility to migrate parts of our data structure to a NoSQL database in the future if there is a need for that.
- Redis: for in-memory data and caching. A critical component to provide high response time to users through the caching of queries.
- ElasticSearch: to improve the performance and response time when users run a search on Storat.com, the data and results are fetched from elastic-Search that index the data in real-time and provide a sub-second response for users queries.
- Amazon AWS S3 Storage: for storing documents, images, and static content.
- AWS CloudFront for Content Delivery Network. we are currently using AWS CloudFront because of its price advantage and ease of use. But as part of our roadmap, we are considering local CDN for an improved experience.
- Middleware: the subject of this article! Our middleware runs on Laravel and PHP.
- Mobile Platform: for the upcoming mobile platform we have selected React Native because of its portability and meeting the requirements of our mobile platform scope. Going native with our scope was going to be an overkill.
For the choice of the back-end programming language, the following were the top 6 factors that settled the debate, yet again, in favor of PHP and the Laravel framework:
- Free platform: Open-source language where we will not be locked down with one vendor.
- Technical Support: wide and very large community support online to answer our questions. So far, for every issue we faced, we found the answer online even without posting a question.
- Speed to Market:
- How fast can we build apps and release them in agile methodology? PHP proved the fastest so far.
- Availability of open-source plugins and libraries that can save us time in writing new code.
- How easy to adopt the language and framework to new developers in the team and put them quickly in the development workforce. For a talented programmer, it takes less than 2 weeks to learn the framework to join the development effort.
- Talent Acquisition: Availability of highly skilled programmers on the platform so we are not locked in a lengthy process acquiring talent.
- Availability of modern MVC framework: that can rationalize a rule-less language like PHP. In this case, the framework we chose was Laravel.
- Performance: while this is the most contested issue when it comes to programming language choice. We have made the decision based on many factors but the following are the top four:
- The programming language is one out of 20 factors that decides the performance and scalability of web applications. Regardless of the middleware language. Performance optimization is a never-ending process across all the layers of the applications (in-memory caching, storage, query indexing, structure database optimization, etc).
- The performance of the language is more dependent on a skilled programmer writing elegant and high performing code, than the choice of the language. It was much easier for us to find highly-skilled PHP programmers in LeadCenter.AI operating locations in Eastern Europe, India, and the middle east.
- The dropping cost of hardware means that it is cheaper for us to throw more webservers to scale the application than spending a much longer time building with a static language or another dynamic language that would give few percentages of a performance boost.
- The release of PHP7 that gave a major boost to the performance of PHP applications, outperforming other dynamic languages like Ruby and Python. This is based on tests we conducted in LeadCenter.AI labs in India.
Regardless of our decision, we think that there is no right or wrong choice among the top and widely used web frameworks. The lesson learned for us is to map your choice not only based on the technical aspect of the evaluation, but also on the business needs, cost, access to talented resources in the long term, and the value your startup is trying to deliver.