In the previous two parts of this article I described the first three versions of the webapp behind this site.
Site V1 was based on Bootstrap, jQuery, Java, Spring Framework, CouchDB.
The next version, V2, was enriched with new features, but server side there was a big change. The web engine was entirely rewritten in asyncronous style using Vert.x, while Spring was set apart.
With V2, a new trend began in which I was looking for a “better” approach to building the server part.
V3 version should have been more classic and minimal, with vanilla Java, but this version never came to production.
New ideas came in place.
I was still considering some aspects of concurrent programming revealed during V2 development: thread context switching cost and how accessing shared resources in a concurrent environment.
Immutable data was gaining new attention, in the web, for building scalable, concurrent applications.
Immutable data means that we doesn’t change data, but produce a copy of the data with the changes. This concept is inside functional programming and makes synchronization unnecessary to access data.
In the meanwhile, I was working on some mobile application. I would have liked to use the same or similar tools at the client and at the server level, that needed to develop a single page app, a mobile app, or a server side service.
Immutable data, functional programming, multiplatform development… all of that led me to Clojure. Clojure is a functional language, it’s a dialect of Lisp. It is compiled, yet remains completely dynamic. It runs on the JVM and can interop with Java. It permits interactive development using a REPL console.
Clojure challenged my habits based preferably on statically typed object oriented languages… but It was really interesting to investigate.
I choose Luminus micro-framework as the foundation of V4.
Meanwhile, I was experimenting with ClojureScript + React Native for developing mobile apps.
I rebuild the production part, web pages and articles, of the "site project" in Clojure and Luminus. It was challenging but, at the same time, a pleasure. I learned Clojure thanks the very good "Clojure for the Brave and True". An amazing book!!!
V4 was made. To distribute the application, I left my distribution system based on CouchDB. I opted for Git and Fabric, see my article "Luminus uberjar deployment automation via Fabric/fabfile and Git". I even simplified my site architecture consolidating all in one datacenter, at least for the moment.
I was satisfied by the result, but there was still something to investigate and improve.
It was difficult for me to maintain this project in this functional way. The code, as suspected, is difficult to read after some time you have written. Perhaps for my relative inexperience in functional programming or my mindset. I missed editor code completion and other goodies offered by a static typed language.
Meanwhile, my try with mobile development in Clojure had suffered of the many layer of abstractions, making difficult debugging a program. ClojureScript + React Native needs a very good computer to develop. Intensive CPU load happens only to start a development session.
So, I started again my search for a different tool fulfilling a common denominator of my needs in software development.
Web development, Mobile App development, Server Side development, sharing tools and code base, good support for the best concurrent development practices, IDE and tooling... Probably a useless effort, searching for a tool for all. While I was looking for a tool for mobile development, I was struck by Flutter...
Flutter is another mobile UI framework that promises effective Android and iOS app development. It’s made by Google. Google is even too much pervasive in today world with Android and its search engine and I would prefer to use a tool of some another vendor or association. But I found Flutter very interesting, because It was really possible to create apps for the main two mobile operating system with native speed and interacting with native features.
The language is Dart. Nothing really new under the sun, but all the features I could appreciate in a language with static types are present: modules, classes, syntactic sugar for accessors, null operators, asynchronous not blocking programming under the hood eased by async keyword, true generics, multithreading by isolates, etc, etc… and last but not the least, great documentation!!!
Another important thing is first class attention put on tooling: dart analyser is a component that exposes local web API providing to editors and IDE the data for code completion, code analysis, hints.
And what to say about "DartPad" for the lovers of REPL console!!!
I decided to reboot for the fifth time my "site" project with Dart and Aqueduct.
To develop V1, V2 and V3 I used Springsource Tool Suite, an open source Eclipse based IDE. For V4 I’ve used Atom Editor. Now, even if there are a lot of open source alternatives, I opted to use a commercial IDE, Webstorm by Jetbrains, because I wanted to try it, comparing it with my previous experiences. I also hoped that a commercial IDE could make me immediately productive working with a recent and new language. I didn’t want to search and try a lot of plugins to integrate Dart development to some IDE or editor. This is my personal choice at this moment.
Aqueduct is an extensible HTTP framework for building REST APIs, but I could easily use it to serve web pages thanks to the hints found on GitHub, in the pages of the Aqueduct project, or on StackOverflow or even in the source code, when necessary.
I decided to put apart of CouchDB and return to the good old relational SQL DB PostgreSQL. Aqueduct provide a good simple ORM to access PostgreSQL DB, managing schema migrations.
Coming from previous four “site” project heavy refactorings, I, relatively easily, came up and running with site V5. If you are reading this article at giandisa.it, look at the bottom of the page. If you see 5.x.x version, then this article is served by Dart and Aqueduct, the pinpoints of V5.
I know, It’s useless searching a programming language or programming patterns or tools that could cover all programming needs. The right tool, language depends on many factors, technicals and not.
But I like to follow the evolutions, try to discover some new pebbled, polished stone in the river of informatics and admire it, hoping it could relief from some of the hussles when creating new software crafts.
Meanwhile in the journey, I've learn some lessons that, perhaps, have made me a better software developer and engineer.
Thank you for having followed the story of this my little quest. I hope that you have enjoyed it and you could have found it somewhat interesting.
Gianni Di Sanzo