Sander van den Oever

Sander van den Oever
Computer Science student

Track: Software Technology
Interests: Software (Web) Engineering
Occupation: PHP Developer

Recent blogs

Calendar

January 2016
M T W T F S S
« Dec   Mar »
 123
45678910
11121314151617
18192021222324
25262728293031

Categories

Exam period and Firebase

First of all; happy new year! I hope you’ve enjoyed the holidays. Back to reality, sadly, exams have arrived. As mentioned before I have one exam, Compiler Construction. This is a tough course, but if you keep up with the lectures and assignments it should be doable.

I’ve mentioned my project for Functional Programming before but I’ll give a bit more detailed information. For this course (which is a MOOC basically) the participants at TU Delft have to carry out a project. Basically the assignment was a one-liner describing what has to be done. Our project description was;

Build an alternative for firebase from scratch (inspiration: search quora for alternatives)

You might know about Firebase. Firebase is a library which allows for live syncing to a database. The database in the backend is implemented using JSON, and through the Firebase library you can connect to this database. Each connected client will receive every change live (ignoring network latencies etc. of course). We were free to choose any language as long as we would be able to show where we applied the functional way of programming. We chose to use Scala, most of the members in my team already have experience with Scala, and it’s very similar to Java. From there the challenge started; none of us had too much experience with building such a system from scratch. So we started looking into available tools etc. We knew we had to find a way to push changes from the server/database to all connected clients. Quickly we found Akka Actors, but connecting this to a JavaScript library was a second challenge. After a lot of trial-and-error we came across ScalaJS. Basically ScalaJS allows you to write Scala code and compile it to JavaScript. We were able to implement a WebSocket connection and using that connection we can set up the communication between our clients and servers. Meanwhile other members of the team had worked on processing client requests on the server, the security of the connection, and so on. There’s really a lot to think about.

Project overview

Figure: Project overview. We had to implement the parts in red, gray shows possible extensions of the project (like a native iOS library).

There are some really useful things I’ve learned during this project;

  • If you use some external libraries: use a dependency manager, it’ll save you so much time in the end.
  • Automate whatever you can, whenever it is useful. If you run a compile command every time you save your code for instance, you might want to set up a watcher that automatically compiles the code on change.
  • Use a decent editor, get to know it; it saves you a lot of time to know to the shortcuts and to actually use them. For instance I use editors by JetBrains (IntelliJ, PhpStorm) where you can quickly navigate through your entire project using the double-Shift shortcut amongst various other features.
  • Talk before you start implementing; we worked separately in the beginning. When we had to connect our different components it turned out that basically all of us used a slightly different version of the JSON format (used for internal processing). We had to adapt to make it fit again. If we had agreed on this upfront this wouldn’t have been an issue (necessarily).

Of course IntelliJ is not the only editor, alternatives like Eclipse, Sublime Text or any other editor can be just as fine, it’s all a matter of preference and setting up the editor to your preferences.

IntelliJ editor with the project

Figure: IntelliJ editor with the project. In the lower section the terminal is visible (integrated in the editor), it is keeping track of file changes while I code. In the upper section you see the Quick Switcher in IntelliJ (double-Shift). It searches all partial filenames/paths and contents for whatever you are looking for.

You learn best by doing, projects like this one prove this over and over. 🙂

Comments are closed.

© 2011 TU Delft