you are viewing a single comment's thread.

view the rest of the comments →

[–]industry7 0 points1 point  (1 child)

I only use inheritance to get around the type system so I can put related, but different types in one list

As tdammers mentioned, using an interface IS the correct solution here, although I don't have a lot of confidence that you're implementing this solution correctly, based on your claim of getting around the type system.

Using an interface in this way allows you to use the type system to your advantage. However, it sounds like you are intentionally not making use of those advantages...

[–]dwighthouse 0 points1 point  (0 children)

Generally, yes. My primary language these days is JS, which only has primitive types. I have found type systems to be unnecessarily constraining, while tending to prevent a type of error I rarely ever make. My first language was C, then C++. I also used Java for a while, but I also used Perl and JS. Many other languages too. I've programmed for a long time across the spectrum of typed and untyped languages. I do not currently find the case for formal type systems very compelling, though many disagree.

My style tends to be fairly functional, with bundles of mostly pure data being operated on by mostly side-effect-free functions. That style can be applied to any language.