Logo
  • PHP
    • HipHop / HHVM
    • Modern PHP
    • PHPStorm
    • LAMP
    • Laravel
    • Composer
    • PDO
  • JavaScript
    • node.js
    • AngularJS
  • CSS
    • SASS
    • “CSS4” (CSS level 4)
  • HTML
  • Git
  • LAMP
  • Vagrant
  • UI / UX
  • Architecture of …
  • Off-Topic
With ♥ from Berlin
January 20, 2014
Chris
How do THEY do it ?, PHP
0

Interesting: code of the same application in PHP, Python, Ruby, Closure, node.js, Java and Go

PreviousNext
java

Definitly worth a look: Adam Bard created a tiny application in 4 different languages (PHP, Python, Ruby, Closure), just to show how some basic syntax and application architecture of every language. Other people joined this idea and added versions in JavaScript/node.js/CoffeeScript, Java/JSP and Go. But – in theory a wonderful project – the results absolutly don’t represent the languages. In some case the pure language is used, in some a framework is used. Beside, the PHP example is horrible, no serious developer would mess up PHP and HTML in that kind of way. Third negative point: Sometimes the views or the view-code is put inside the main application, sometimes not. Number 4: Some examples have multiple view and a full form, some just put out one a string. This is simply not compareable. For a REAL comparison I would love to see experts in these languages writing the app in the best, modern and readable way possible (sounds like a serious project for 2014).

And to be honest, looking at the syntax says probably nothing about the pros and cons of a language.

Anyway, looking at the examples is still interesting: I’m surprised by the simplicity of the Python example, but that’s mainly because it’s not pure Python, he’s using a microframework here (which would also make look the PHP example much much cleaner). The usage of a framework makes this project a little bit cheesy, as it does not represent the original idea anymore. Especially the node.js example is remarkable: Nice code (but I hate to work without brackets!), very short, and readable, but the Go example looks much more organized (but is sooo long), I also like the PHP/JS-like func xxx() {} coding style. The final Closure example looks interesting too, very simple, but unusual/hard to read. Ruby seems to be a good candidate for extremely reduced code, the syntax shows why Ruby has such a hard fan-base. First impression: really good! Biggest surprise: The syntax of Java/JSP, it’s so extremely near JavaScript and PHP. Cool! A little side note here: There are languages on top of Java that have a simpler syntax.

I love clean and “visually readable” code. Code that has clearly visible “units” and “levels”. I also like brackets and use of natural basic human-readable english language. And the dotted.chaning.syntax feels totally right, something like x = model.cars.getCarById(7).sortDesc().yourMom().trim() clearly says what’s going on, and handles a lot of stuff in one line without looking weird.

Personal conclusion: As a PHP and JS developer I find it extremely easy to read und understand the Java example. Wow! I think every PHP developer with JavaScript knowledge who has never seen Java code before feels the same right now. The entire Java example is fully readable, each line makes sense, everything feels natural, logical and correct. Even without having any Java skills it would be easy to add and change stuff. Gentlemen, thanks for sharing this great moment with you! Maybe it’s time to read a Java book in the next holidays :)

Full article: http://adambard.com/blog/PHP-ruby-python-clojure-webapps-by-example/

 

Example in Java / JSP

java

 

Example in node.js / JavaScript / CoffeeScript

nodejs code example

 

Example in Ruby

ruby

 

Example in Closure

closure

 

Example in Go

go

 

This article was written quite a while ago (9 years), please keep this in mind when using the information written here. Links, code and commands might be outdated or broken.

Random articles

  • PHPStorm: 42 Tips and Tricks (47min video talk by Mikhail Vink at Dutch PHP Conference 2015)PHPStorm: 42 Tips and Tricks (47min video talk by Mikhail Vink at Dutch PHP Conference 2015)
  • What’s new in PHPStorm 9What’s new in PHPStorm 9
  • Experimenting with HHVM at Etsy (Link)Experimenting with HHVM at Etsy (Link)
  • Dangerous Performance Myths in the Web (video talk by Thomas Lohner, PHPUG Latvia)Dangerous Performance Myths in the Web (video talk by Thomas Lohner, PHPUG Latvia)
  • Install MINI in 30 seconds inside Ubuntu 14.04 LTSInstall MINI in 30 seconds inside Ubuntu 14.04 LTS
  • MINI2, an extremely simple barebone PHP application on top of SlimMINI2, an extremely simple barebone PHP application on top of Slim
  • MINI, an extremely simple barebone PHP applicationMINI, an extremely simple barebone PHP application
  • How to setup / install PHP 5.6 on Ubuntu 14.04 LTSHow to setup / install PHP 5.6 on Ubuntu 14.04 LTS
  • Support FLARUM, the future of PHP forum scripts (with some dollars on Kickstarter)Support FLARUM, the future of PHP forum scripts (with some dollars on Kickstarter)
ClosureGoJava / JSPnode.js / JavaScript / CoffeeScriptPHPPythonRuby
Share this

Leave A Comment Cancel reply

phpstorm-8

PHPStorm 8 has just been released

The excellent PHP IDE PHPStorm just had a major release these days: Version 8 is out, coming with latest PHP

How to show the available version of a package (before doing apt-get install)

To show the version of the package that will be installed with apt-get install, do apt-cache policy packagename. To show

“Fuck you. Pay Me.” How to deal with clients, the professional way. An excellent talk with Mike Monteiro.

Excellent (and very useful) speech by Mike Monteiro about how to deal with clients, how to create a professional relation

compress-png

Compress png, jpeg, gif and svg up to 90% with Compressor.io

What a fantastic tool: Compressor.io is a totally free service that let you compress png, jpeg, gif or svg files

hearthbleed-ssl-bug

A quick guideline on how to fix the Hearthbleed bug (and update OpenSSL) on Ubuntu

If you still haven’t fixed your servers after mainstream discovery of the legendary Hearthbleed bug, then do it now –

php

Is there a JSFiddle for PHP ? Yes !

It’s awesome how UNknown these little and extremely powerful tools are: There are some online tools that let you paste

the-php-login-project

How to install php-login-one-file on Ubuntu 12.04 LTS

This tutorial will show you how to install the one-file version of php-login.net‘s login script (see the full GitHub repository

ilovepreloaders – A tumblr collection of preloader animations

An excellent collection of preloaders (GIFs, Movies and real ready-to-copy&paste code) here in this wonderful blog: http://ilovepreloaders.tumblr.com/ This thing just

laracon-2014-eu-amsterdam

Laracon 2013 – Jordi Boggiano: In Depth Composer (47min video)

More videos of 2013’s and 2014’s Laracon events from US and EU on their Youtube channel. This article was written

All new features of WordPress 3.9 in this 2 minute video

This article was written quite a while ago (9 years), please keep this in mind when using the information written

1/4

Categories

Search

phpstorm 7.0 php
How to setup and use XDEBUG with PHPStorm 6/7 (locally in Windows 7/8 and Mac OS X)
sass
[german video] Modernizing and minimalizing frontend markup code at AutoScout24
Install Laravel 4 on Ubuntu 12.04 LTS (a how-to tutorial)
ubuntu-14.04-lts
First view: Ubuntu 14.04 LTS brings PHP 5.5 and Apache 2.4
hiphop php
HipHop VM reaches 100% green Unit Tests in Laravel, Drupal, Slim, CodeIgniter etc.
php
Slides from International PHP Conference 2014
O’Reilly’s Learning JavaScript Design Patterns by Addy Osmani for free
php uk conference
Slides & talks from PHP UK Conference 2014
angularjs
Two excellent introductions into AngularJS by Todd Motto
zend framework 3
First view on Zend Framework 3 by Matthew O’Phinney
bitdeli git github stats
Get visitor stats for your GitHub repo with BitDeli
php
Awesome list of Design Patterns with PHP code examples
DEF CON 18 – When your computer got stolen and you can still SSH into it: “Pwned by the 0wner” (22min conference talk)
php
How to install latest PHP 5.4.x on Ubuntu 12.04 LTS (Precise Pangolin)
Berlin, prepare for TOA conference (15th – 17th of July)

Tags

apache bash centos composer conference coupon CSS debian fonts framework git GitHub hack HHVM HipHop HTML HTML5 IDE JavaScript JS LAMP laravel linux mod_rewrite MVC MySQL Nginx optimization PHP PHP 5.5 PHP 5.6 phpmyadmin PHPStorm security server SSD Ubuntu UI UX vagrant video virtual machine voucher VPS wordpress
Side-Project: Wordle-Solver:
www.wordle-helper.info

Pages

  • Privacy Policy
 
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT