I have taken a special interest in parallel and asynchronous data processing in F#. The absolute majority of the really hard to fix bugs that I have come across during the last years all have one thing in common, thread safety. Or rather, the lack of thereof.
It is very easy to write a class in C#, Java, or C++ that is not thread safe. And if you try to make it thread safe it quickly can become quite complex and it is easy to forget to put a lock on a variable or make some subtle mistake that makes the lock useless (locking on a reference to an object that you later make a copy of, which makes locking the old reference useless, is a not so uncommon mistake that can be really hard to spot).
Another thing about thread safety is that it is really hard to test for. All your tests might run perfectly fine, but then when you go into production, things starts crashing in really strange ways.
F#, and other functional languages, addresses these problems and makes it easy to write code that can execute in parallel, safely. More info on the topic can be found here.
Also, I have started to write (well, mostly copy...) code to try out concurrency in F#. See my repo at https://github.com/Backhage/Parallellism for some code samples.
It is very easy to write a class in C#, Java, or C++ that is not thread safe. And if you try to make it thread safe it quickly can become quite complex and it is easy to forget to put a lock on a variable or make some subtle mistake that makes the lock useless (locking on a reference to an object that you later make a copy of, which makes locking the old reference useless, is a not so uncommon mistake that can be really hard to spot).
Another thing about thread safety is that it is really hard to test for. All your tests might run perfectly fine, but then when you go into production, things starts crashing in really strange ways.
F#, and other functional languages, addresses these problems and makes it easy to write code that can execute in parallel, safely. More info on the topic can be found here.
Also, I have started to write (well, mostly copy...) code to try out concurrency in F#. See my repo at https://github.com/Backhage/Parallellism for some code samples.
Kommentarer
Skicka en kommentar