We are using PHP (a dynamically-typed language) in our project. However, I have found my colleagues asking questions such as https://stackoverflow.com/questions/20438322/modeling-a-binary-relationship-between-two-types.
I’m feeling like we have a paranoia that we are going to get unexpected errors (E.G. if you look at that example question, you will see that the poster is asking how to ensure that a
like does not get initialized for a
Person), and we are using static-typing (something that doesn't exist in PHP) along with unit tests to help ourselves rest easy at night. :-)
Now, the thing that tells me our approach is wrong is the number of big websites written using dynamically-typed languages: Google uses Python extensively, Facebook is written using PHP, Twitter and GoodReads are written using Ruby. So what I feel is that web applications—at the very least—are moving toward dynamically-typed languages.
However, no matter how I try to comprehend this, i can’t. Don’t these guys have trouble comprehending the domain? Don’t they have problems that arise when using dynamically-typed languages (E.G. “Property
whatever is not defined on this object.”)? If they do, how do they deal with those while keeping the agility that comes with using dynamically-typed languages?