Sunday Thought: Embracing the Type System | Dru Sellers


: 2

I had a lot of fun talking with all of you on the benefits of dynamic languages on the previous post. Definitely getting a better picture of what working with a language like that is like listening to your stories, so thank you for sharing. I also was given a killer link to an over view of type systems that I want to share with you incase you missed it in the comments or when I tweeted about it.

What to know before debating type systems

Yup, I liked it that much. Easy to understand and gave me a fresh perspective.

Also during my read of the above link, was lead to this guy which blew my mind:

A type based solution to the strings problem

Damn, I need to spend more time in haskell. Interestingly, the little languages that he talks about in the post, and how we usually just use strings to represent them. That problem is one of the reasons why I love the little library called HtmlTags (although built by the Fubu guys has no dependencies on FubuMVC) – makes working with fragments of HTML so much easier. I need one of these for everything that I currently use strings for. :)

Which goes back to another thought of mine which is that we as developers depend far too heavily on primitives in our languages. We use strings to represent everything. Instead of taking the time to write a few app level primitives to wrap up these strings inside type’d goodness, we are content to just let them get passed around as anonymous objects. In .Net at the very least we could be using the BCL’s ‘SecureString’ when we need to lock strings down. You can also read an older post of mine on Business Primitives. And if you work with code that loves types as much as your compiler does you can get some really bad ass code to work with (my favorite is the way I can extend things in FubuMVC).

Do you have to write more code? Yes. Do you get value from doing so? Yes. Do you get enough value to make it worth it? That’s up to you, but I know that I do.

I would say that over the past year I have been looking at python and ruby and I just don’t get the same buzz out of those languages that I do out of languages like C# and Haskell. For my larger projects that is. I still maintain a few small sites and scripts in python (and I LOVE IT). but as my projects get bigger my brain is just wired into the type systems provided to me in a more static language. I love it, I can bend C#’s type system to my will in ways that crush my brain, much like the Haskell type system is currently crushing my brain.

Anyways, just my thoughts on this chill Sunday.