When it comes to dynamic and static typing there are big discussions and many opinions all around. I’ve collected following thoughts about this problem. Each one of it is questionable because programming is not black & white world. This is what is said in general (the truth is probably somewhere in-between):

Static typing:

  • it is recommended for large projcets with shared code bases
  • it is expected lower maintenance cost
  • usually enforces OOP, classical inheritance and interfaces
  • it is IDE dependent
  • good refactoring tools
  • code is more verbose
  • project contain much more files and lines of code
  • there are more levels of indirections when reading code
  • many data container classes and translation logic between them

Dynamic typing:

  • recommended for small and middle size projects
  • faster development
  • shorter, more elegant and expressive code
  • usually don’t need IDE
  • enforces functional and flat application design
  • types are checked at runtime
  • it is sometimes hard to find what the object structure is
  • error prone when not practicing unit testing
  • harder refactoring

In reality it also depends on other aspects such as skills, preference of development team or project requirements itself. The truth is that big and reliable software was built in both languages with strict type checker like Java, C#, C++ as well as in dynamic languages like Python, JavaScript or Groovy.

What really matters is if you test your code. Type checker is the first line of tests which will fail fast in case of typos or even serious type problems. On the other hand the effort spent in satisfying type checker and working in more verbose environment can be invested in better unit tests. In any case you should test your units and business logic, if you don’t even type checker won’t save your application.

Choosing one or the other approach is hard and often opinionated decision. There are strong advocates of both approaches however there is no clear winner.

Related Post

Leave a Comment

© 2024 Instea, s.r.o.
All rights reserved. Privacy policy

Contact us

Where to find us

Connect with us