(first (look Hoplon.io))  

Writing web applications can be a chore. With all the languages (minimum of HTML/CSS/JS) you need to learn just to write a single web page, with a little PHP thrown into the mix when you need to do server side computation, the simple dynamic web page can get hairy pretty badly.

Jquery solved a lot of problems on dynamic DOM bindings but on the server side, PHP leaves a lot for us to consider. Why can’t we just use one language to solve them all? A fast, compiled language that has huge libraries for us to use, easy to use and port to another server. Now that’s what we want, right? Is Python Django, Ruby on Rails, PHP Cake the answer to all of this?

No.

Fast and compiled? PHP. Easy to use and port, Python and Ruby.

But for both to be present at the same time, neither of them meets the mark.

Enter Clojure #

clojure-logo10.png

Clojure is a modern lisp hosted on the JVM, with ports to JavaScript and CLR. It features functional programming with immutable states, which allows safer and secure concurrent programming models.The JVM provides many battle tested libraries and tools that have survived the test of time. Java may suck all time, but the JVM does not. Being a lisp, famous for the macros that allow you to change the language as it is being run, clojure can be suited for a variety of tasks. If it doesn’t, we can make it suit it.

Wait, this is nice and all, but where is the web stuff? #

As we have said, if we want clojure for our HTML/CSS/JS/PHP, we just write it.

Meet Hoplon. #

(page "foo/bar.html"
  (:require [my.lib :as lib]))

(defc clicks 0)

(html
  (head
    (title "Hello World")
    (link :rel "stylesheet" :href "css/main.css"))
  (body
    (lib/heading-large "Hello, world!")
    (p (text "You've clicked ~{clicks} times."))
    (button :on-click #(swap! clicks inc) "Click me!")))

One single language for all your web programming needs.

(ns my-project.api
  (:require [tailrecursion.castra :refer [defrpc]]))

(def counter (atom 0))

(defrpc get-state []
  {:rpc/query [{:random (rand-int 100)
                :counter @counter}]}
  (swap! counter inc))

The code is terse and tight, you don’t have to worry about shared resources because we don’t do direct references to them at real time, we take a snap shot of them and use it, like in a database, as in hoplon, it is abstracted as a speadsheet.

Everything is just cells in a spreadsheet, and functions that operates on the cells in the spreadsheet. When you need the data, you take a look at it, but you do not take it as say, “thats mine!”.

It all boils down to safe and easy code. Getting the hang of the parentheses instead of braces or newlines isn’t very hard, and result is visually appealing.

The UI is seperated from the server code in that nothing in the UI directly changes the database underneath. It calls a function, which sends a remote connection to the server with the change, after verification, the database is changed and that bubbles back up to the UI. Clean and seperated.

Try it out and have a change of heart. No more juggling languages, just pure coding power.

 
2
Kudos
 
2
Kudos

Now read this

Sounds muse

Audio cues can play a huge part in games, ranging from minor sounds like a gun click to large and dramatic sounds like the usage of an ultimate ability. Unity3D helps in this by providing a 3D sound engine which we could use to our... Continue →