December 2007 Entries

LINQ and the DTO Tax

Jean-Paul Boodhoo's post on MappingEnumerable<T> reminds me how DTOs sometimes require an inordinate amount of effort for the simple jobs they perform. You need to define them, instantiate them, map them, groom them, and take them for walks twice a day. It always felt to me that the language should help to reduce the DTO tax, somehow. In JP's post, he is using the following interface to define a mapper responsible for transforming domain objects into data transfer objects (screen bound DTOs, I'm assuming). public interface IMapper<Input, Output> {     Output MapFrom(Input input); } Where a simple implementation might look like: public class DepartmentMapper : IMapper<Department,...

Creating Silverlight Player Templates

Pete Brown is a local guy with a great deal of Silverlight content on his blog, and some cool wallpaper downloads. Pete pointed to the Expression Encoder White Paper today. The document describes itself as providing the "best practices and methods for providing integrated and branded media player skins for Microsoft Silverlight". After a quick read, I'd say the document does a fine job describing how to build custom skins and templates for the Silverlight media player. The techniques described in the document will also work with the ASP.NET Futures <asp:Media> control. Both of those controls provide additional features (like...

Inheritance and the Entity Framework

Here is an excerpt of the schema for the top level of OdeToCode: The Community_ContentPages table carries all of the data needed by every type of content – like moderation flags, published date, and owner ID. Community_Articles carries just the extra information needed for a published article – like the article text itself. Inside the code, Article and Book classes derive from ContentPage. Inheritance simplifies the implementation, because a great deal of the business logic applies to all the different types of content objects. For instance, the moderation and approval rules apply to articles, book reviews, comments, images, and other...

ALT.NET in Baltimore and D.C.

Matthew makes the announcement in a blog post: So, you may ask yourself, there are already groups out in the DC area, such as CapArea.NET, RockNUG, CMAP, DC XP Users group among others. They are great user groups that put on a lot of great events that I have attended time and time again and at some point presented at one of them. It's my belief that this group can supplement them nicely and help each other out. Many of these groups spend a lot of time talking about the new things coming from Microsoft. That's...

The Greatest Challenge in Software Development

... is choosing the right names. Local variables need names. Instance variables need names. Methods need names, too, as do classes, columns, delegates, events, files, forms, parameters, projects, products, services, styles, tables, and of course – namespaces. Namespaces are nothing but a name! So many names, and so few words to use. I was thinking about the amount of mental effort I expend in basic programming activities – like picking control structures (foreach versus do-while), or data structures (stacks versus lists), versus the amount of effort I expend to name all the abstractions in the simplest piece of software. Loops...

Can I Replace JavaScript (and everything else) With Volta?

In my last post, I looked at using managed code in Silverlight as a replacement for JavaScript and offered the following code as an example: HtmlDocument document = HtmlPage.Document;HtmlElement select = document.GetElementByID("mySelect");for (int i = 0; i < 10; i++){    HtmlElement option = document.CreateElement("option");     option.SetAttribute("value", "foo" + i.ToString());    option.SetAttribute("innerHTML", "foo" + i.ToString());    select.AppendChild(option);} In my opinion, the managed code API offers a sub-optimal experience relative to the plain and simple JavaScript that would implement the same functionality. To be fair, Silverlight's mission isn't to replace JavaScript, HTML, web browsers, and motherly love (as yet, I guess), but I wanted to explore the idea. In an...

Scott Allen
Posts - 869
Comments - 4493
Stories - 14