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
Comments Off on Interesting: code of the same application in PHP, Python, Ruby, Closure, node.js, Java and Go

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

 

ClosureGoJava / JSPnode.js / JavaScript / CoffeeScriptPHPPythonRuby
Share this
sass laravel

Extremely easy SASS in Laravel (with pure PHP)

Working with SASS is awesome: it reduces your workload dramatically, makes web projects much cleaner, DRYs your code, adds awesome

php

How to install/setup latest version of PHP 5.5 on Debian Wheezy 7.0/7.1/7.2 (and how to fix the GPG key error)

Please note: This works fine. But this package will also upgrade your apache to version 2.4 which has different config

modern-php

Creator of Slim framework and “PHP – The right way” writes book: “Modern PHP”, available 2015

Definitly something every non-superexpert-PHP-developer should have on its books-to-buy-in-2015-list: Josh Lockhart, creator of the legendaray Slim framework and the famous

cheap cloud server php

DigitalOcean rolls out interesting feature: Transfering server snapshots directly to the client’s account

Today DigitalOcean has rolled out a quite interesting new feature: You are now able to transfer a server snapshot (which

php

PHP 5.7 gets refactored core, is 10%-30% faster than PHP 5.5! Wow!

What an announcement! The awesome PHP core guys have refactored the Zend Engine (which drives PHP) and could successfully speed

php

[Link] How to create, read, update and delete (CRUD) with PDO, MySQLi and MySQL the right way (prepared statements)

Mike Dalisay has written an excellent tutorial on the CORRECT USAGE of basic CRUD functions (create, read, update, delete) with

js javascript

[video] Netflix JavaScript Talks about ECMAScript 7: The Evolution of JavaScript

bash-command-line-tutorial

Best introduction to unix command line / bash ever (by André Augusto Costa Santos)

The New Era of JavaScript (28min conference talk, Jack Franklin, 2013)

php

How the PHP session garbage collector really works

Sessions in PHP are easy to handle, but have a tricky configuration underneath. The common opinion is, that when you

1/4

Categories

Search

mod-rewrite-ubuntu-14-04-lts
How to install / setup PHP 5.5.x on Ubuntu 12.04 LTS
JavaScript ECMAScript6 – A short video introduction (5min)
Bézier Curves – Under the Hood (4min video)
battlefield-3-free
Electronic Arts / Origin offers Battlefield 3 for free (limited promo action) !
Frontend Ops Conf 2014 – Paul Irish: Delivering The Goods In Under 1000ms (40min video)
phpstorm-8
Killer-feature in PHPStorm: Search everywhere
The New Era of JavaScript (28min conference talk, Jack Franklin, 2013)
sass laravel
Extremely easy SASS in Laravel (with pure PHP)
composer
The difference between “composer install” and “composer update” – nailed on the head
php
How to install latest PHP 5.4.x on Ubuntu 12.04 LTS (Precise Pangolin)
Experimenting with HHVM at Etsy (Link)
Google I/O 2014 – HTTPS Everywhere (video)
mod-rewrite-ubuntu-14-04-lts
How to enable mod_rewrite in Ubuntu 12.04 LTS
hiphop php
HipHop VM reaches 100% green Unit Tests in Laravel, Drupal, Slim, CodeIgniter etc.
GitHub finally introduces repo traffic stats

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