-
Notifications
You must be signed in to change notification settings - Fork 2
Decisions
Back End: Vert.x
Vert.x is an application platform, designed to make the best use of today's hardware. It uses not only the multicore/multithread capabilities of modern servers, but also the power of servers distributed over a network or even the internet. And, most important, the application programmer does not have to be concerned about multithreading, synchronization problems and deadlocks. We create just simple bare bone single threaded verticles or modules, and Vert.x does the rest to scale them to a multiprocessor- or even multiserver- environment.
Even better: We don't have to mess around with communication between separate independently running parts of an application. The Vert.x EventBus provides a fantastic easy way to send messages and data around, even between clients and servers running on different machines somewhere on the internet.
And, last but not least, Vert.x is multilingual. You can easily write Verticles in Java, Scala, Ruby, Groovy, CoffeeScript or Javascript, and all work neatly and friendly together.
Data store: MongoDB and Mysql/PostgreSQL
We have to use mysql/postgreSQL, because legacy elexis is built on it. But since sql databases are not well suited for the task of a distributed data store, the final goal is, to migrate to NoSQL. After some evaluating, MongoDB proves best suited for our needs (with CouchDB running up).
Vert.x, however, offers a combined mysql/postgreSQL-Module, and a MongoDB-Persistor ready to use. Downloading, installing and running of such modules is as easy as:
container.deployModule(<module-id>,<Callback>);
With Vert.x, the decision is easy: We use the Vert.x EventBus via Sockjs to communicate between server and client.
Since we want to support as many devices as possible, there is only one choice, if you don't have lots of developer power: Create a web based fronted. Most devices today feature a recent web browser and thus are able to run browser based software.
The language of choice for browser based software is JavaScript. There are many options to reduce the amount of work to create such an application.
Two obvious solutions are Google's GWT and Eclipse's RAP. Both let you write your code in Java, using your favorite IDE and Debugging tools, and convert it automagically into a browser-app. In this automation lies the drawback, though. At least in my opinion. Everything is hidden. You can't easily understand what happens, and you can't easily modify the output, and it's difficult to leave the predefined path of the toolkit. I gave both a try, but didn't really succeed. This ist definitely my own fault, since other people created great software with either GWT or RAP. But it's not working for me.
So I decided to learn JavaScript. And making this step, I learned, that it is much more tedious to program in Javascript than it is in Java. The coding-debugging-coding cycle becomes an adventure as it was in times of C/C++ (or I probably just didn't find the right tools for the job yet).
Fortunately there is help. You don't have to code everything by yourself. There are great JavaScript Libraries around.
General toolboxes: jQuery and underscore
Many programs written in JavaScript make use of jQuery. So many things get easier with this lib. Of course, you can do the same things somehow without jQuery. But, since jQuery exists, why should I try to find out how?
Underscore, on the other hand, brings a lot of features from functional languages to JavaScript. Most notably great functions for manipulation of collections. If you're missing some of the features you love in Scala or Haskell, give underscore a try.
UI design: Bootstrap
Having said, that we want to support as many platforms as possible, we have to consider everything from phone to big screen. Well, it's quite tedious to create user interfaces for all possible sizes. Unless you use Bootstrap for this task.
This is a collection of different tasks:
- We don't want to reload the whole page, when the user clicks something. Instead, we want a single window, much like a desktop App. The key for this task is Ajax. (I'm using the term Ajax here in a broader sense, i.e. also for asynchronous communication sharing not only XML messages. In fact, webelexis doesn't use XML at all, but instead sends Json-Messages)
- We want an easy transfer of server based objects into the client view and vice versa. The key concept here is Databinding.
- we want to separate design from application logic.
- we want to distribute load between server and client, so that the number of requests can be minimized. Most clients today are powerful enough to do some data processing, so we optimize requests and the form of transmitted data to reduce the internet traffic.
There are a number of libraries to help with such tasks. After some looking around, I ended up with either AngularJS or KnockoutJS. While they work quite differently, they both seemed to provide the things I needed, so the decision was not easy, and somewhat arbitrary. Finally I chose KnockoutJS. Mainly because I understood better, how it works. Here is a good starting point to compare these two frameworks.
Webelexis does not enforce this environment. This is just the starting point I chose for myself. You can build client side code however you like. The only requirement is: It must communicate via the Vert.x EventBus. (which means not more, than you have to include vertxbus.js and sockjs.js and require the vert.eventbus. That's all)
(For an even more elaborate discussion of this topic, read here)
If you read until here, you are ready to setup your developing environment for Webelexis.