On Programmer Laziness & Anonymous Types
Some thoughtful person took their time to respond to a blog that using anonymous types constitutes laziness. An anonymous type is a type defined on the fly by using the "New With" construct, naming the parameters and providing initializers. In fact, the compiler code generates the class as an anonymous type when you do this. I submit that this in fact is not laziness, but a diligent use of time.
Archimedes is attributed with saying "give me a lever long enough and a place to stand and I will move the world." Saying that employing this or that tool--the proverbial lever if you will--is lazy is short sighted. There is a certain beauty in toiling long and hard to accomplish an end, but what constitutes long, hard, or even toil. If you or I think hard enough about a problem and the result of that labor is a tool that favors future labor savings have we not indeed labored long and hard?
Terms like long, hard, and lazy are relative. What is long to one is short to another. The same is true of hard and lazy. A calculus problem can seem insurmountable to many people, but those schooled in calculus may be able to solve the problem in short order. What about people that don't do physical work, but make disproportionately large amounts of money? Compare entertainers to ditch diggers. Clearly the ditch digger probably toils in the classical sense of the word, but practicing an art-craft is clearly labor and may be hard to the artist.
I encourage you to forget about words like toil, hard, and lazy as programmers. Focus on finding levers that make your labor easy. If you are toiling at writing code then you may just be missing the critical lever. Clearly there are millions of lines of code in the .NET framework already written; it is no more lazy to use these lines of code than it is to expect a better living through a college education. Look at it another way. If you avoid laborious coding then your brain and time are free to invent clever new solutions. Stand proudly on the shoulders of greatness to achieve inspired genius. If you can write code in fewer lines, solve problems with simpler means, or rely on existing tools, idioms, and engines to make your life a little easier and to get to the heart of a solution faster than you are certainly not lazy.
Paul Kimmel is the VB Today columnist for CodeGuru and has written several books on object-oriented programming and .NET. Check out his upcoming book Professional DevExpress ASP.NET Controls (from Wiley) now available on Amazon.com and fine bookstores everywhere. Look for his upcoming book Teach Yourself the ADO.NET Entity Framework in 24 Hours (from Sams). You may contact him for technology questions at pkimmel@softconcepts .com. Paul Kimmel is a Technical Evangelist for Developer Express, Inc, and you can ask him about Developer Express at firstname.lastname@example.org and read his DX blog at http:// community.devexpress.com/blogs/paulk.