Saturday, December 30, 2017

Practical application of the dot product

I recently had to write an algorithm to decide whether two trains (whose movement directions are known) are moving towards each other or not.

When two trains move towards each other the angle between their direction vectors is larger than 90 degrees. If the track was a straight line the angle would be close to 180 degrees, but tracks are not always straight.

I used the dot (scalar) product as follows:


  1. Calculate the dot product of the train direction vectors. This is equal to cos(angle).
  2. If 90 < angle <= 180 (-1 =< cos(angle) < 0), the two trains are moving towards each other
Note 1: If the track is bending more than 90 degrees, this algorithm will not work:
Note 2: If the trains have passed each other just using the dot product won't work, you also have to check whether the trains are in front of each other (let that be another blog post):

Friday, December 22, 2017

How to respond to questions of novice engineers

When a novice engineer comes to you with a technical question, your first reponse should not be answering the question at hand but asking "what are you trying to accomplish" because most of the time the novice will have gaps in his understanding of the job to be done. Based on that misunderstanding, he will try to solve some technical problem, get stuck and come to you for guidance.

By clarifying the higher level goal to be reached, you can be sure that the question is indeed meaningful and answering it will be productive.

Further reading: Difference between novice and experienced engineers

Music: Hallelujah - Pentatonix

Friday, December 15, 2017

Keeping motivation after lots of failures

Software development means getting stuck a lot of times where all your attempts at moving forward result in failure. This affects my motivation and after enough failures, I feel desperate and don't want to touch the project anymore.

One way to overcome this deadlock is to do smaller things with guaranteed success. For example, I improve documentation, draw prettier graphs, make more detailed plans. Scoring little victories shortens my procastination period and I gain enough enthusiasm to tackle the beast.

The 7 Habits of Highly Effective Artists

Monday, November 27, 2017

Mobile Games for Kids

Below is a list of mobile (Android) games that my 5 year old plays on his tablet and I recommend:
  • Minecraft
  • Monument Valley 2
  • Alto's Adventure
  • Samorost 3
  • Cat Quest
  • War Robots
  • Badland 2
  • Contre Jour
  • World of Goo
  • Bowmasters

Thursday, October 19, 2017

Stop worrying that your expertise isn't worth much

Today I was talking with a chemist friend of mine who complained that he could rarely use his chemical expertise and was spending most of his time with jobs at the technician level. While I am in a slightly better situation, mine is not that much different.

My expertise is in dynamic flight simulations of 6DoF rigid bodies. Outside of my day job, its value is zero. However, while gaining that knowledge I have also learned a lot of tools and methodologies that could be used elsewhere. Here is a short list:
  • How to verify data/code prepared by others before using them in your own project.
  • How to write good reports
  • How to manage engineers
  • How to design complex software
  • Matlab/Simulink
  • C/C++
  • Java
  • C#
These skills and tools can easily be translated to other domains, which makes them very valuable. Concentrate on what skills you will acquire while pursuing your topics of interest and make sure that they have some use other than your own narrow field.

Thursday, October 05, 2017

Çocuklara yazılım eğitimi

2014 yılında Facebook WhatsApp'ı 19 milyar dolara satın aldığından beri memlekette yazılım geliştirmeye ilgi arttı. Bu aralar çocuğu olan kişiler benim yazılımcı olduğumu öğrendiklerinde "çocuğumu programlama konusunda nasıl eğitebiliriz" diye soruyorlar. Okullar programlarına kodlama dersleri koymanın telaşı içindeler.

Daha da büyüyecek bir alan olması nedeniyle yazılıma yatırım yapmak mantıklı. Çocuğun yaşına göre müfredatın, özellikle de ilk adımın nasıl olması gerektiği mühim. Önerim öncelikle velinin temel becerileri edinip çocuğuna yol göstermesi, yoksa çocuğun gelişimi tesadüflere kalıyor. Eğitim/ilham başkalarına devredilemez.

Lego Mindstorms güzel bir platform. Veli internetten Lego Mindstorms'un nasıl kullanılacağını öğrenmeli, sonra seti alıp ilk adımları kendi atmalı. Böylece çocuğuna yardımcı olabilir veya göndermeyi düşündüğü okulun/kursun kalitesini değerlendirebilir. Kendi öğrenmeden Mindstorms'u alırsa çocuk altından kalkamayabilir ve birkaç gün içerisinde sıkılabilir. Birkaç ay yardımcı olduktan sonra ilgi uyanmışsa çocuk giderek daha bağımsız devam edebilir.

Geçen yıl 12 yaşında bir tanıdığa Lego Mindstorms ile yazılım/robot eğitimi verdim. Eğitimde yazılımın yanısıra hataların öğrenme fırsatı olduğunu, bir işi başkalarına anlatabilmenin önemini ve yönetimlerini vurguladım. Birlikte çektiğimiz video bu linkte.

Güncelleme 27 Kasım 2017: Neredeyse tüm çocukların oynadığı Minecraft üzerinde Scratch ile program yazarak kodlamaya giriş: