Archive for the ‘Uncategorized’ Category

Designing in simple steps

08.11.2017 Leave a comment

I like reading books about military history. Recently, I have read “One bullet away” by Nathaniel Fick. The author describes the training he had to complete in order to become an officer in US Marine Corps. One of the things he described was how the young officers are made to write lots of written orders in five-paragraph format called SMEAC. It stands for situation, mission, execution, administration and logistics, command and signal. The point of all this writing was to make sure that all those issues are remembered extremely well and become part of the thought process of the trained person.

I think that my line of work, writing computer software, can learn a lot from the military. So today, for my own use, I created a similar format I will follow when given a task to design a software component. The elements are:

  1. Mission statement – what should the component do? It should contain any functional and non-functional requirements.
  2. Environment – where should it run?
  3. Restrictions – what are the known restrictions on the component? Those usually are existing legacy systems and interfaces.
  4. Assumptions – for me, this means stating clearly what are the things I don’t know when creating the design and how I deal with the resulting risks.
  5. Description of the component – most designs I see seem to only have this part and quite often it leads to lots of wasted effort.

Just as the officer on a battlefield, I often have no time to write formal documents. But I am posting this very simple process description on this blog so that I remember about it. I hope that even considering those things in my mind before starting work will be a good thing.

Categories: Uncategorized

Scala performance analysis with perf and Flame Graphs

10.09.2017 Leave a comment

I’ve been toying with Scala profiling lately. I find CPU Flame Graphs to be cool and useful, so decided to see what I can do with that. After some hacking and automating I got this:

flame chart

One thing I find strange here is that scala.collection methods are shown as yellow, which according to The Source means they are C++ code. Overall, it seems like in this very simple case, it’s possible to see where the problems are. If there were any kernel-level operations involved, like network communication, the chart would be even more useful.

Categories: Uncategorized Tags: ,

Scalar 2016

26.04.2016 Leave a comment

I attended the scalar conference in Warsaw. This is a short write-up of some of my thoughts about it.

By far the most interesting talk was given by Mathias Doenitz, who described his project Swave, which is a Rective Streams protocol implementation intending to be usable both in place of standard Scala/Java collections and distributed processing systems like Akka Stream or Apache Storm. I was looking forward to such a “write once, run everywhere” framework for quite some time, I will definitely be watching it’s progress.

On last year’s Scalar, the most interesting talk was given by Heather Miller, a PHD student of professor Martin Odersky. It seems someone from “Scala headquarters” is sent to Warsaw every year. This year’s emissary was Dmytro Petrashko, who talked about some unexpected behaviours of Scala initialization order. It was definitely interesting, but did gave me a pause thinking about unexpected complexity of having multiple mixins in a class.

Presentation of Amira Lakhal was also quite interesting but not from technical point of view. Amira is “one of the Duchess France leaders where she helps women in IT to became role models”. She demonstrated a simple but complete machine learning system, gathering accelerometer data from an Android device to detect if the user was standing, walking or running. Talk was very well prepared and it seem Amira’s strategy is to show some real-world, tangible application. Frankly, it was a welcome break because many of the other presenters (not mentioned here) were so out of touch with reality that it felt like a symposium on string theory.

The conference itself was very well organised, in particular the venue was really great. However, all of the talks were really short and there was almost no time for questions. I must also say that the conference host seemed rude and sexist. But maybe I just have high expectations, having attended conferences hosted by RafaƂ Motriuk – this guy is just pure awesomeness on stage. Despite those minor glitches, the conference was great and I am looking forward to visiting it next year.

Categories: Uncategorized

Deamon slayer

14.01.2013 Leave a comment

A nice gotcha – what happens when you forget about destructors when writing server-side code in C++ can be found on Rachel’s blog.

Categories: Uncategorized

Programming like it’s 1975

05.12.2012 Leave a comment

Some tips about getting optimal performance from modern hardware and operating systems. Author argues that application programmer has no way of knowing if the memory in RAM or cached out to disc, so it’s best to not to interfere with kernel. The other smart point is using worker threads in “most recently busy” fashion – a bit counterintuitive but makes perfect sense.
Edit: A discussion on hackernews raises several points when it comes to memory management. It’s getting increasingly rare to find a technical discussion there, this one seems better.

Categories: Uncategorized

Stop the train!

11.10.2012 Leave a comment

A nice example of branch prediction can be found here. Discussion under “Update” mentions Intel compiler and it’s cool ability to do loop interchange. Extra credit for well-fitting railway analogy.

Categories: Uncategorized

Oracle – how add milisecond to a timestamp value?

06.09.2012 Leave a comment

Recently somebody needed to add a millisecond to a timestamp value in Oracle. You can’t do just

 select systimestamp + 1 / 24 / 60 / 60 / 1000 from dual; 

because the ‘+’ converts timestamp to date and fractional seconds are lost. The (supposedly) wise guy here seems to suggest that the way to go is to create a custom function in Java… Come on Oracle, there should be a better way to do this!

Categories: Uncategorized