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
october cms

October CMS, built on top of Laravel, is beautiful, clever and on the way to be the new #1 CMS

Do you remember when you tried to edit one line of code inside TYPO3 or Contao ? And the extreme

[Link] Improving Smashing Magazine’s Performance: A Case Study

The title says it all: A very interesting guide through the optimization process on one of the largest blogs in

php-phalcon-logo

Which PHP-framework to learn in 2014 ? PHALCON, by far the fastest ever!

Hey guys, just a short little article between the years: If you have the possibility to learn and use a

php

PHP.net hacked, but most things are fine again

Between 22nd and 24th October 2013 php.net served JavaScript malware (that was built to use security holes in the usually

logo-internet-explorer

How to professionally test on old Internet Explorer versions

If you have (or want) to test your websites and applications on older versions of Internet Explorer, then there’s a

Symfony devs: Creator of Symfony framework is hiring (Cologne, Germany)!

Probably one of the most interesting companies for a PHP developer is currently hiring Juniors and Seniors in Cologne, Germany.

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

GitHub finally introduces repo traffic stats

It has been a veeeery long time, but finally GitHub has introduced private traffic stats for all projects. To open

Ghost

[FREE SERVER PROMO] Install GHOST for free on a free SSD server with this coupon

A little off-topic, but highly interesting: In April 2013 the former User Interface Head of WordPress (and WordPress expert) John

Install Laravel 4 on Ubuntu 12.04 LTS (a how-to tutorial)

Laravel 4 is the big thing. Every blog talks about it, nearly every developer-twitter-account mentions it. Hmm, looks like everybody

1/4

Categories

Search

Redesigning Windows 8 – fantastic and clever drafts by Jay Machalani
How to show the available version of a package (before doing apt-get install)
php
How to install sqlite driver for PHP in Ubuntu & Debian
How to hack time (KUNG FURY promo campaign)
php
12 tools for better PHP quality
php
[Link] Excellent PHP best practices, 2014 style
The architecture of StackOverflow
pdo-debug
Debug PDO with this one-line function. Yeah!
php
Is there a JSFiddle for PHP ? Yes !
How to show memory usage (Ubuntu)
twig
A 6min video introduction into Twig, the PHP templating engine
php
PHP 5.6.0 RC1 is available
php
[Link] How to create, read, update and delete (CRUD) with PDO, MySQLi and MySQL the right way (prepared statements)
php
A super-simple introduction into PHP namespaces (7min video)
Meet the developers behind Ableton (14min video)

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