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
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 –

js javascript

JavaScript Testing Tactics (21min video by Justin Searls)

bitdeli git github stats

php-login goes #2 PHP script worldwide in BitDeli stats

Holy! I just checked the stats of my little php-login hobby project on BitDeli (the tracking service for GitHub) and

php

How to install the mcrypt php extension (to use Laravel 4)

When installing Laravel 4 on a fresh Ubuntu or Debian system, you’ll probably get this error message: “Laravel requires the

O’Reilly’s Learning JavaScript Design Patterns by Addy Osmani for free

Addy Osmani has published his excellent book Learning JavaScript Design Patterns for free! You can read the entire book including

Support FLARUM, the future of PHP forum scripts (with some dollars on Kickstarter)

PHP forum scripts are horrible, let’s face it. Nearly everything that’s available is hard to install, hard to handle, hard

php

Why Modern PHP is Awesome And How You Can Use It Today (Slides by Matt Stauffer)

php

Redesigning the PHP logo – who wants ?

The current PHP logo is a really lovely one, it is highly accepted and has its own charme, transports a

phpstorm-8

Ignore .idea folder from git in PHPStorm

By default (?) PHPStorm will create a hidden folder named .idea directly within your project, containing user-specific stuff like chosen

nginx php 5.5

[Link] Set up Nginx with PHP 5.5 easily

As there are surprisingly no good tutorials on how to set up NGINX with PHP 5.5 properly, here’s an excellent

1/4

Categories

Search

php
Test out PHP 5.6alpha1 on Windows 7 / 8 with two clicks
atomic-design
An introduction into Atomic Design, a super-clean way to style web applications
Creators of Laravel launch one-click-installations of Laravel (including nginx, PHP 5.5 etc.)
PHPStorm: 42 Tips and Tricks (47min video talk by Mikhail Vink at Dutch PHP Conference 2015)
sass
[german video] Modernizing and minimalizing frontend markup code at AutoScout24
How major web companies (and banks) handle passwords quite wrong
bash-command-line-tutorial
Best introduction to unix command line / bash ever (by André Augusto Costa Santos)
css
How to center a div vertically and horizontally (modern methods, without fixed size!)
How to hack time (KUNG FURY promo campaign)
php
Why Modern PHP is Awesome And How You Can Use It Today (Slides by Matt Stauffer)
php
12 tools for better PHP quality
php uk conference
PHP Caching Best Practices by Eli White (video from PHP UK Conference 2014)
vagrant
How to setup a (or multiple) server/LAMP-stack inside a virtual machine for local development with Vagrant and PuPHPet
Interesting stats on SONY’s hacked passwords
-45% (or even 50%) off on DesignWall today

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