<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.atalasoft.com/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Rick Minerich's Development Wonderland : talks, reflection</title><link>http://www.atalasoft.com/cs/blogs/rickm/archive/tags/talks/reflection/default.aspx</link><description>Tags: talks, reflection</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>The Future of Programming Languages</title><link>http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/15/anders-hejlsberg-on-the-future-of-programming-languages.aspx</link><pubDate>Wed, 15 Oct 2008 14:18:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:16086</guid><dc:creator>RickM</dc:creator><slash:comments>14</slash:comments><comments>http://www.atalasoft.com/cs/blogs/rickm/comments/16086.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/rickm/commentrss.aspx?PostID=16086</wfw:commentRss><wfw:comment>http://www.atalasoft.com/cs/blogs/rickm/rsscomments.aspx?PostID=16086</wfw:comment><description>&lt;p&gt;Yesterday, my coworker &lt;a href="http://www.atalasoft.com/cs/blogs/loufranco/default.aspx"&gt;Lou Franco&lt;/a&gt; pointed me to a fantastic talk by Anders Hejlsberg &lt;a href="http://blog.jaoo.dk/2008/10/07/the-future-of-programming-languages/"&gt;on the future of programming languages&lt;/a&gt;.&amp;nbsp; In this talk Anders argues that the future of programming language development will be focused on three events: the explosion in the use of Dynamic Languages, the creation of many new Domain Specific Languages and the rising need for Concurrency.&amp;nbsp; &lt;/p&gt;&lt;p&gt;In this article I'm going to focus on Dynamic Typing and Metaprogramming in particular.&amp;nbsp; It's interesting to consider what the impact on the maintainability of our code from their increased prominence might be.&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Dynamic vs Static Typing&lt;/b&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Over the last decade the use of dynamic programming languages has exploded.&amp;nbsp; Working at the higher level of abstraction that dynamic languages provide allows the programmer to spend much more time building things and much less time worrying about the details.&amp;nbsp; For sure, when prototyping or experimenting the speed of dynamic languages is a huge boon.&amp;nbsp; However, without type checking at compile time the potential for really difficult to track down bugs is huge. &lt;br&gt;&lt;/p&gt;&lt;p&gt;Just think about the kinds of strange bugs that can happen when any type can be passed into any argument of any method.&amp;nbsp; It gets even worse when you consider that these types may be silently converting themselves.&amp;nbsp; Without great care, the number of potential execution paths in your program could skyrocket.&amp;nbsp; &lt;/p&gt;&lt;p&gt;This can be offset by really strict unit testing and
extremely high code coverage.&amp;nbsp; However, I have yet to see a large real
world project that had this level of testing.&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;p&gt;For these reasons I find the new C# "dynamic" keyword rather
worrying.&amp;nbsp; It allows the programmer to declare variables which are only
type checked at runtime instead of at compile time. I would hate to have to
maintain a code base where it was liberally used. &lt;br&gt;&lt;/p&gt;&lt;p&gt;Anders also mentions F#'s static but implied typing system.&amp;nbsp; He talks a bit about the two worlds of static and dynamic meeting in the middle in this kind of way.&amp;nbsp; I agree, this is really the best of both worlds.&amp;nbsp; You gain the "dynamic feel" but get almost none of the downsides.&amp;nbsp; The security of static types without all the extra typing. &lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Metaprogramming&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I agree that Metaprogramming is a powerful tool, especially for testing.&amp;nbsp; In a ecosystem designed around objects having meaning, it only makes sense to be able to ask questions about those objects and be able to dynamically manipulate how they operate.&amp;nbsp; However, I am worried that it may in some cases become a substitute for well designed architecture. &lt;/p&gt;&lt;p&gt;Also, because of it's nature, in many cases Metaprogramming necessitates the use of strings to represent information about the application.&amp;nbsp; Strings whose contents will not be checked at compile time.&amp;nbsp; Because of this it is very easy to make breaking changes to an application which won't be caught when the program is compiled. &lt;/p&gt;&lt;p&gt;Take for example the idea of a class with a single property.&amp;nbsp; In the code for the application in which that class lives, a code branch depends on reflection to check if that property exists.&amp;nbsp; If you were to rename that property that path would no longer be taken and a bug would result.&amp;nbsp; If the creator of that code had used an interface instead of reflection it would have broken at compile time. &lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Conclusion &lt;/b&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;I'm not saying that these kinds of powerful tools shouldn't exist. They are extremely useful in many cases.&amp;nbsp; We just need to be very careful in their use.&amp;nbsp; As &lt;a href="http://www.atalasoft.com/cs/blogs/stevehawley/default.aspx"&gt;Steve Hawley&lt;/a&gt; likes to say, when you have a shiny new hammer everything starts to look like nails.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Edit&lt;/b&gt;:&amp;nbsp; I want to note that I had intended to include a
subsection on the direct modification of abstract syntax trees but ran
out of time.&amp;nbsp; Also, a good friend of mine also pointed out to me that
Lisp style macros actually do let you work with the underlying code in
a much more meaningful way than C++ style text manipulation.&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;br&gt;&lt;br&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/15/anders-hejlsberg-on-the-future-of-programming-languages.aspx&amp;amp;;subject=The+Future+of+Programming+Languages" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/15/anders-hejlsberg-on-the-future-of-programming-languages.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/15/anders-hejlsberg-on-the-future-of-programming-languages.aspx&amp;amp;;title=The+Future+of+Programming+Languages" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/15/anders-hejlsberg-on-the-future-of-programming-languages.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/15/anders-hejlsberg-on-the-future-of-programming-languages.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/15/anders-hejlsberg-on-the-future-of-programming-languages.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/15/anders-hejlsberg-on-the-future-of-programming-languages.aspx&amp;amp;title=The+Future+of+Programming+Languages" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/15/anders-hejlsberg-on-the-future-of-programming-languages.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/15/anders-hejlsberg-on-the-future-of-programming-languages.aspx&amp;amp;;title=The+Future+of+Programming+Languages" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/15/anders-hejlsberg-on-the-future-of-programming-languages.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/15/anders-hejlsberg-on-the-future-of-programming-languages.aspx&amp;amp;;title=The+Future+of+Programming+Languages&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/rickm/archive/2008/10/15/anders-hejlsberg-on-the-future-of-programming-languages.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=16086" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/programming/default.aspx">programming</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/F_2300_/default.aspx">F#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/concurrency/default.aspx">concurrency</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/object+oriented/default.aspx">object oriented</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/.NET/default.aspx">.NET</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/talks/default.aspx">talks</category><category domain="http://www.atalasoft.com/cs/blogs/rickm/archive/tags/reflection/default.aspx">reflection</category></item></channel></rss>