Programming with Hidden Types – A Good Idea?

When you think about type safety, what do you think about? Alex asked this question on social media, got some interesting answers, and ended up defining a few principles for a style of programming with “hidden types” as follows:

A) I don’t define types for method and function parameters, or class members
B) I validate a lot at the entry to the system
C) I define my own objects and use them with duck typing (aka if it has the method or data member with the correct name then it’s the correct type)
D) I name everything precisely

The surprising thing about this style is that it didn’t get us in trouble. So are types actually important to prevent programming mistakes? Or are they just a preference?

Here’s the mastodon thread:

More from the Blog

Leave a Comment

Your email address will not be published. Required fields are marked *

    Your Cart
    Your cart is empty
      Apply Coupon
      Available Coupons
      individualcspo102022 Get 87.00 off
      Unavailable Coupons
      aniscppeurope2022 Get 20.00 off
      Scroll to Top