-
Init.d shell script for Play framework distributed applications
I wrote a shell script to control Play framework applications packaged using built-in command dist. Applications packaged this way are zipped standalone distributions without any need to have Play framework installed on the machine that it’s supposed to run on. Everything needed is inside the package. Inside the zip, in the bin directory, there is…
-
The best code coverage for Scala
The best code coverage metric for Scala is statement coverage. Simple as that. It suits the typical programming style in Scala best. Scala is a chameleon and it can look like anything you wish, but very often more statements are written on a single line and conditional “if” statements are used rarely. In other words,…
-
Await without waiting
Scala has recently introduced async and await features. It allows to write clean and easy-to-understand code for cases where otherwise complex composition of futures would be needed. The same thing already exists in C# for quite a while. But I always had a feeling that I don’t really know how does it work. I tried…
-
With a little help from our friends
“How many bugs have your unit tests found? And why they didn’t find the one that’s currently killing our production? See? This proves that unit testing doesn’t work. It’s just a waste of money. My money.” said the boss. Of course not my boss. That’s actually a pretty valid point. How to prove that unit…
-
Scala Wonderland: Case classes and pattern matching
Pattern matching is usually related to text search. In Scala it has much more sophisticated usage. You can write exciting decision logic when used together with case classes. Even after understanding what the two things mean I wasn’t able to use them as they deserve. It takes a while to really grasp them. Long and…
-
Seduced by the West
I was born and lived 30 years in Bratislava, capital of Slovakia. After studies I started working for IBM as a C#/Java developer and stayed there for 5 years. Nice years. I have learned a lot, met great people, traveled around the world. Not to forget, I have earned some money. Nice money. IBM has…
-
Scala Wonderland: Semicolons, singletons and companion objects
In Scala you may usually omit semicolon at the end of a statement. It is required if more statements are on a single line. Unfortunately there are cases when compiler doesn’t undrstand the code as you would expect. For example following is treated as two statements a and +b: a + b Solution is to…
-
Scala Wonderland: Lists
In functional style methods should not have side effects. A consequence of this philosophy is that List is immutable in Scala. Construction of a List is simple. val abc = List(“a”, “b”, “c”) There is one trick in the previous code. A common trick in Scala. It invokes method named apply on List companion object.…
-
The Rule of Failed Integration Build
What to do if an integration build fails? By failing I mean either there is a compilation error or an aed test fails. The general rule in most of the teams that I worked with is that this situation should be treated with the highest priority. The developer who has caused this problem is responsible…
-
Scala Wonderland: The functional style
Scala encourages to use a functional style of programming. For programmers coming from imperative world of Java or C# it is the main challenge. The first step is to recognize the difference between functional and imperative programming. Scala has two keywords for variable declaration: var – mutable variables val – immutable variables One sign of…