Posted by Jarod Ferguson on Nov 12, 2009 in
Dotnet |
View Original Article
In my last post I took a stab at Lazy Loading data access, and pointed out a concrete example of why I don’t like it. As with anything there are trade-offs. Here are a few practices I use for clean and fast data access. They are heavily influenced by some common patterns from PoEAA, and Domain Driven Design.
- Retrieve data by aggregate roots, have a repository for each root. The root queries should return the entire aggregate. If you are going to defer loading to a part of the root graph, be explicit. Instead of lazy loading Foo.Bars, I like to say Foo.LoadBars() <- yes seriously
- Learn how to identify the right aggregate
- Respect your aggregate root boundaries. Aggregates cannot call into other aggregates children! You shouldn’t be adding a product from the order, really, this is bad: LineItem.Product.Calatalog.Add(new Product). The order AR just crossed into the Catalog AR. Its not the job of the Order to add products to the catalog
- Do not try an overuse an aggregate, its ok to create a new one. Less is more does not apply. Fulfilling an order is different than placing one, and your data access may need to reflect that
- Use a ‘Read Model’. The most common approach here is using DTO or ViewModel, and projecting straight into it from the object model query or database
- For complex queries that perform aggregations and calculations, consider using a store procedure. They really have their place, even with the best ORM’s (then project into Read Model)
- Avoid putting query logic in mappings (Assembler’s, Translators, AutoMapper)
- Use a tracing tool. I like the SQL trace profiler, but if you are not as comfortable with sql, there is a some good profilers around, like NHProf for nHiberante & soon EFProf for the Entity Framework
- Know the SQL that is going to your database. Have your tests emit the generated sql out to the console. Live it, learn it, love it. You should know your ORM tendencies, especially if you are using a linq provider
- Batch requests to your services and database, especially if you are in a web or distributed environment
Tags: Esoterica
Posted by Jarod Ferguson on Nov 12, 2009 in
Dotnet |
View Original Article
I find it ironic that we allow our tooling to mask the biggest bottleneck in the system: The database. Having worked with the majority of the ORM tools out there, I can tell you the most common contributor to slow system performance is lazy loading for Data Access.
I’ve seen this one all too many times:
Business guy: The order checkout screen is running slow in production
Dev: It shouldn’t be, it runs great on my machine
Business guy: Well, it is. It takes 10-15 seconds to load order 123
Dev: Let me check, ya hmm, it is slow. I’ll look into it
The developer proceeds to crack open the source where he finds some LOD nightmare data binding mess in the view, or the mapping to the presentation model: “Customer.Order-> LineItem.Product.Catalog.Vendor.Name”
Because someone wanted to display the Vendor name on the line detail, they just hopped over the graph and loaded the catalog, and then vendor. So here comes the entire catalog! (of course its N + 1)
Why did they do that? Because it is EASY! (and because your boss wanted it yesterday)
The team never knows about it until it’s too late. Yep, it runs fast locally, because we developers only have a small catalog on our machine, I mean “we don’t want all that data on our box”.
Now I know there are many folks out there saying “Well that’s just stupid, I would never do that”. Maybe you wouldn’t, but that guy sitting next to you, he will. I tell you, we all do it, again and again.
The result over time is an interconnected web of queries that can bring a system to a crawl.
Tags: Esoterica
Posted by W3Avenue Team on Nov 12, 2009 in
Javascript |
View Original Article
The Any+Time JavaScript Library provides an easy-to-use, easy-to-customize calendar widget (ATWidget – that includes date and/or time picker) and a powerful Date/String parse/format utility (ATConverter). It is powered by Prototype JavaScript Framework and has been tested with IE 8, Firefox 3, Safari 4, and Opera 9.64.

ATWidget is an AJAX-capable JavaScript GUI component, that you can use to easily add to a page. It provides several option that enable you to easily customize it for your project. The look and feel can be customized by modifying or supplementing the included CSS style sheet. All labels, as well as month, weekday and era names and abbreviations, are also easy to change.
Features
- Time-only
- Begin week with Monday (or any other day)
- Range limits (before and/or after)
- Custom date or time format
- 12-hour or 24-hour clock
- Multiple languages (l10n/i18n)
- Can be configured to use AJAX
- Custom look & feel
- Prehistoric dates
ATConverter converts between JavaScript String and Date objects and supports a wide range of formats. It can be used independently, or in conjunction with ATWidget to manage the format of your date/time input field.
Developed by Andrew M. Andrews; Any+Time JavaScript Library is available under under the Creative Commons Attribution – Noncommercial-Share Alike 3.0 Unported License. You can find further information, demos & download on Any+Time JavaScript Library Website.
Similar Posts:
You can also stay updated by following us on Twitter, becoming a fan on Facebook or by subscribing to our FriendFeed.
Tags: Andrew M. Andrews, CC License, Date/Time/Calendar, DatePicker, Prototype
Posted by Silverlight Team on Nov 12, 2009 in
Miscelleneous |
View Original Article
by Arturo Toledo, Sr. Product Manager, Silverlight Design Audience
A few weeks ago I had the opportunity to visit Europe as part of the Microsoft REMIX Tour 2009. REMIX is basically the little brother (or sister) event of Microsoft MIX – our annual event in Las Vegas during which we show all of our latest and greatest technologies for web design and web development. It was an amazing experience to visit Brussels, Helsinki, Vienna and Lisbon and meet so many people (both designers and developers) who are interested in Silverlight and Expression Blend.
On the last stop of the tour – Lisbon – I met a very interesting group of folks who call themselves Mix and Blend (check out their cool Silverlight site and their portfolio). Mix and Blend is the name of their design shop and they help software development companies with the creation of the user interface and user experience of software applications and websites using Expression Blend. “We do the Blend work for development companies who do not have designers in their teams,” said Sérgio Ferreira, CTO.
From left to right: João Bandarra, João Albuquerque, Sergio Ferreira, Vitor Costa, Nuno Leitão and Emerson Ferreira
Talking to Mix and Blend put me in a Beach Boys mood (for a full multimedia experience play this song in the background while reading the rest of the article). All the guys in this team were wearing a cool black t-shirt that said We Blend for You. I talked to them to find out more about who they were and what they do with Expression Blend. Mix and Blend is a group of surfers – not web surfers but ocean wave surfers - that includes mainly designers but also developers. The designers in Mix and Blend like to spend time on the beach riding the waves. The developers mentioned they do not surf but they enjoy drinking beer while designers are out there in the ocean. A well-balanced team as you can see :). Talking to this group of creatives, designers, and developers, I couldn’t help but think of Keanu Reeves and Patrick Swayze in the old classic Point Break (1991). Although this gang doesn’t rob any banks (that I know of), they report getting the same thrill by using Expression Blend to create user experiences. Sounds like fun? It is – and it’s also a good business.
In the Ocean Look website, for example, We Blend for You merged its two passions – Surf + Silverlight – by designing this website for the surfing community in Portugal. They designed a great-looking site that, among other features, provides weather status and live camera feeds showing the conditions of beaches in real time.
In an upcoming project for one of the most emblematic venues in Portugal, Campo Pequeno, a bullfight arena, shopping center and special events location, Mix and Blend explores the use of Silverlight and Blend to successfully produce a contemporary experience that involves juxtaposing a traditional activity like bullfighting with today’s more modern activities (e.g. movie theaters and music concerts). The site is expected to go live shortly.
Mix and Blend has also produced the official website for a highly popular musician in Portugal, Rodrigo Leão. It is truly a multimedia site built with Silverlight and Blend – a .NET site that mixes media of all sorts, from photography to illustration, video and audio – rich media that allows visitors to enjoy the musical talents of Rodrigo and other musicians.
By using Blend, this design studio has found a way to reuse its existing creative and design skills to help .NET shops and as well as to create its own projects. Silverlight is still a relatively new technology but its adoption numbers amongst developers are growing very quickly because it is simply .NET, one of the most popular development technologies in the world. Developers feel at home. Silverlight enables the creation of not only powerful experiences that run on Windows, Mac and Linux (and every popular browser) but also rich interactive multimedia experiences. For this capability, Silverlight requires user experience design understanding and practice. Silverlight needs designers; therefore designers have become some pretty popular people within the .NET world. Everyone wants a designer! This has created a big opportunity in the last couple years for designers who, in addition to Flash and Photoshop skills, have developed Expression Blend skills. Mix and Blend has effectively leveraged this new market opportunity for designers. They can be creative and make their business grow – all while continuing to surf. You can watch the full interview video here, and drop Sergio an email if you need design and user experience support with your project.
The Microsoft office in Portugal has helped this new design business and other design agencies to meet and collaborate with our existing business development partners. At Microsoft, we are experts in match making – helping developers find good designers to work with to produce spectacular Silverlight websites. I think this is an interesting story for other designers as well as small and big agencies around the world: reuse your creative skills, learn how to use Expression Blend and expand your creative services portfolio by producing Silverlight experiences. You don’t have to become a developer or stop creating Flash websites. It’s about extending your existing skills into a new market for designers, the .NET world. Being a creative individual or agency is what makes you popular in the.NET world. Drop me a note in this blog, twitter or contact your local Microsoft office if you are interested in getting started with Silverlight. Also check out this blog post with the Top 20 Online Resources to get started with Silverlight.


Tags: Case Study
Posted by Jason Grundy on Nov 12, 2009 in
Dotnet |
View Original Article
One of the personal reasons that I had for co-founding Guild 3 was for me to re-discover my passion for software. I was suffering from something similar to what Davy Brion (quite bravely) outlined in Avoiding (Or Recovering From) Burnout. For me the age old adage of “a change is as good as a rest” has proven to be an extremely successful strategy.
One of the things that I had stopped doing was keeping an eye on various OSS projects to see what was on the horizon. Yesterday I (finally!) started to experiment with NHibernate 3.0. The first thing that caught my eye was QueryOver. As Fabio explained there are a lot of different ways of executing queries in NH. Certainly in the pre-LINQ days ICriteria was the predominantly recommended option because it has elements of type safety to it and its fluent-ish API broke everything down into small pieces and avoided string concatenation hell.
QueryOver is fluent a layer on top of ICriteria. It looks very LINQesque but it’s a very different animal, not least of all because there are some concepts in ICriteria that do not have a LINQ equivalent (caching etc.). In the short to medium term I suspect that it will become my de facto approach for NHibernate queries (I’ve used NHibernate LINQ and it’s great for simple queries but I’ve experienced significant issues with more complicated ones).
What I haven’t figured out yet is how, if at all, this will affect my data access testing strategy. Historically I’ve favored smoke tests that have really been doing little more than verifying that a given ICriteria query was semantically valid. Typically I only resorted to actually worrying about the results in specific cases (mainly due to the burden of maintaining test data for each possible scenario). Then again this sounds like a topic for another post doesn’t it…
Tags: Esoterica
Posted by Garth Braithwaite on Nov 12, 2009 in
Flex |
View Original Article
Jonnie Hallman (Destroy Today) joins us to talk about his new position at Adobe on the XDCE team and his involvement with the MAX Twitter app. We also were able to hear the back story to DestroyFlickr and DestroyTwitter, and some news about upcoming features.
Tags: Blogs, riaradio, xd