{ null != Steve } Failures are finger posts on the road to achievement. (C. S. Lewis)

23Jan/100

Blogging Break

Anybody that actually pays attention to this blog, will realize I haven’t posted in awhile.  Basically I’m taking a break for a bit.  I’m extremely busy, starting a new project, maintaining an existing few as well.

I’ve been using Patterns and practices WSSF and really enjoying the setup actually.  Additionally, I’m expanding more into a Silverlight based project, and would like to utilize something like P&P Prism setup.

I’d like to write up more on my WSSF experience at some point and write back about how the Silverlight development goes.

I’ll be helping to architect and lead a larger project for at least the next 3 to 6 months.  And who knows where it will go from there  :)

Just wanted to give an update.   I’ve had some responses to other blog posts, mostly around asp.net mvc posts, so that is great to see.  I hope to respond better to those questions.

Filed under: Uncategorized No Comments
4Dec/094

Fantastic Friday – Links, thoughts and more…!

Happy Friday to you  :)   I’m looking forward to my employer’s (Strategic Data Systems) Christmas party tommorow night.  It’s always a fun time.

SquareUp by Twitter

http://squareup.com/
Twitter founder formally unveils 'Square' project  - this is pretty cool I think – the ability to have “mobile-payments”.  

Here is a description:

The Square hardware is a small, inexpensive card reader that plugs into the audio jack of a compatible device, including a mobile phone (it's starting with the iPhone and currently has job postings up for BlackBerry and Android engineers). It processes credit card payments, geotags their locations on a map, and e-mails a receipt to the buyer.

I think it’s a great idea – pretty cool stuff. 

Visual NHibernate Beta

At first I thought this might be ‘free’  :)   But it’s not.  However, I must say, it’s looking very nice.  Based on some NH google lists the developer(s) are very responsive to adding features and bug fixes.  That was good to see.  One of the ‘complaints’ that I hear sometimes about NHibernate (vs. like EF, L2S, or commercial ORMs) is that it’s complex to get up and running if your not familiar with how mapping files, etc… work.   So Visual NHibernate provides a visual designer and mapping tool for creating and editing NHibernate projects.

Ryan Cromwell - Castle Windsor

Not sure if I blogged on this before (yeah… I know I can search…) but I really like working with Castle Windsor’s Inversion of control container.  Ryan Cromwell (fellow contractor at Strategic Data Systems) provides a couple of good blog posts on it’s usage.  I was recently asked about factory facility for Windsor, and I was able to refer that person to Ryan’s post (see ‘Injecting WCF Channel as Dependency..’ below)

Strategy Pattern with Castle Windsor (he includes a sample project – thanks Ryan!)

Registering WPF “Views” with Windsor Fluent API

Injecting a WCF Channel as Dependency via Windsor – this shows off the Factory facility for Windsor.

By the way – a plug for Ryan:  He is our TFS specialist and can help setup, provide guidance, etc… for TFS.  If your looking for someone to do that for you – he is definitely the man to get!  I should add, he is a heck of a WPF programmer as well – he does some really fine work!

MVC Turbine – Plugin for ASP.NET MVC

http://mvcturbine.codeplex.com/

From CodePlex:

MVC Turbine is a plugin for ASP.NET MVC that has IoC baked in and auto-wires controllers, binders, view engines, http modules, etc. that reside within your application. Thus you worry more about what your application should do, rather than how it should do it.

This is very good to see from my perspective.  One of the features I really enjoyed while experimenting with Grails was how easy it was to have everything injected under the covers without needing to get into the weeds (in Grails case – Spring).  MVC Turbine offers this same functionality for the ASP.NET MVC programming.

Turbine is not exclusive to a particular IoC container.  Here is a feature list:

Features

  • Visual Studio 2008 Solution Templates for IoCs
    • Ninject
    • Castle Windsor
    • StructureMap
    • Unity
  • New runtime framework that allows extensibility
    • Blades (components) that are auto-registered and loaded at runtime.
    • Introduced the Core Blades to setup the basic runtime of an MVC application:
      • MvcBlade -- wiring for MVC related components (Controllers, View Engines, etc).
      • WebBlade -- wiring for System.Web components (IHttpModule, etc.).
      • RoutingBlade -- wiring for the IRouteConfigurator implementation.
    • RotorContext that works with the Blades to setup the runtime.
  • Auto-registration of View Engines (VE)
  • Auto-registratrion of MVC Filters to support constructor injection.
    • Added new InjectableFilter attribute to associate a filter to an action.
    • Added support for IActionFilter, IAuthorizationFilter, IErrorFilter and IResultFilter
  • InferredViewResult handles inferred actions and reports HTTP 404 for missing actions.
  • Works with ASP.NET MVC in Mono

 

Service Orientation Requires Data Orientation

More and more the conversations are around SOA.  This one article at InfoQ stuck out to me regarding ‘service data’

Most of today’s SOA literature and implementations concentrate on defining business aligned services and rarely discuss the role and impact enterprise data has in the context of SOA

 

How to Uninstall – or make Message Stop loading up on Windows 7?

How to uninstall/remove Messenger on Windows 7 ?    My dad just got a new computer with Windows 7.  Anytime he starts it up, it wants him to sign in to Messenger.  He doesn’t use Messenger, and doesn’t want to use Messenger. 

What I find irritating is there isn’t any ‘don’t show this on startup’ or ‘turn this off’ within the Messenger pop-up.  At best you have to go out to the internet and start looking for hacks or ways to turn this off.

Microsoft – I don’t mind if you want to promote your own chat program in your OS, but please be kind enough to make it easy to turn off for non-computer expert users. 

Caliburn SL Nav Walkthrough/Intro

I’ve blogged in the past regarding ‘Caliburn’ by Rob Eisenberg.  Just a reminder:

Designed to aid in the development of WPF and Silverlight applications, Caliburn implements a variety of UI patterns for solving real-world problems. Patterns that are enabled by the framework include MVC, MVP, Presentation Model (MVVM), Commands and Application Controller.

Rob is in the process of ‘releasing various starter kits/samples for Caliburn’.  His first sample just recently released is :

Silverlight Navigation Walkthrough

Using jQuery to Scroll Just in Time for Paging Records..like Bing

Rob Conery blogs about using jQuery to scroll down a list of records with ‘just in time scrolling’ for paging.  Pretty cool – I have seen this feature used in different application.  I suspect this will become the defacto standard in paging lists.  Check out his how to here.

TFS Offline

Quote of the day... 'Don't work offline'.  I’ll keep the source of that quote unnamed, but I did think it was rather funny.  I hope TFS improves it’s offline capabilities.  This is very reminiscent of Visual SourceSafe – which I really didn’t like much.  SVN, Git, etc… all have pretty good offline capabilities.   While we are at it – I do hope TFS also integrates with explorer so if you edit a file outside of studio that it picks it up.  (Maybe you can, but I haven’t seen it).

UPDATE  I’ve been corrected that TFS does provide explorer integration with the  TFS power tools.

(My only response though… I was told this has been around since 2005… seems almost 5 years later this would be an installation option for TFS for Visual Studio ?  Guess you just have ‘know’ this is available - lol)

Google Docs

I am setting up my ‘Google’ realm of Wave, Gmail, Docs, Reader, etc… so far… I’m loving it.  Just recently I received an email with Excel spreadsheet.  Opened it up in Gmail, which prompted to use Google docs !  Worked out great.  And to share that document with my wife, I didn’t have to forward that document around.  Just share it exclusively to her.  All stored up securely on the Google cloud.

I did notice in the Excel to Google Doc conversion that lookups aren’t exactly the same, so it didn’t properly convert the lookup lists.  I hope they fix that.   I really see the world approaching of using this approach more and more.   With the cloud storage, feature rich word processor, spreadsheet and slide creation capability… who needs an expensive desktop copy of Office!

Steve’s Final ‘Thoughts of the Day’ - (or rather ‘Stirring the ORM Pot in the .NET world…’)

Douglass Starnes has a series on different data model approaches with asp.net mvc, showing how to setup them up and use them.

In part II of the series he makes this comment: 

In the ASP.NET MVC space I see three ORMs being used most commonly.  By far the favorite outside of Microsoft is NHibernate.  Inside of Microsoft there are two competing offerings: LINQ to SQL and Entity Framework.

This view/perspective - is it a correct one ?  Is Microsoft competing against NHibernate OSS .NET projects created by it's own community ?  Or is Microsoft just giving more options ?  Microsoft doesn't need to include NHibernate in any of it's products – too many legal traps I’m sure.  What if it didn't create it's own ORM and merely demo'd features using NHibernate in it's examples ?  I'm all for competition to make products better, but in this case, is MS having 2 ORM's that are catching up in functionality, but still lagging behind NHibernate and other .NET ORM's in the market a wise thing ?  Is that how you see it ?  I went to use EF in a project, but because it didn't handle an 'append only' with 'hilo' id generation - and because it wasn't poco based - where the entities are the domain objects - it was finally deemed impossible to use.  Meanwhile, we prototyped NHibernate and were able to implement everything needed in the Legacy system.  Personally, I want to pick the best of breed, not pick something just because of 'who' makes it.  

I don’t want to distract from his series, but that comment seems to be a prevailing one in the .net community.   What I wonder is ‘doesn’t Microsoft understand that is how it will be perceived’ – and if so… is their position to outdo the products, or do they consider this a core piece of the .NET framework to provide ORM solutions ?

I keep pointing to jQuery and ASP.NET MVC – they provide jQuery in the project templates for ASP.NET MVC.   How does that compare to including NHibernate support – or even just promoting it without including it ? 

Personally I can think of 3 examples of where they could make a difference:

1. Provide a Linq provider just like they did for EF and L2S (yes, there are Nhibernate linq providers in work – there is a basic one available now)

2. Provide a NHibernate DomainService out of the box for RIA.NET

3. Provide support for NHibernate out of the box for ADO.NET Data Services.

All three could be extensions that are referenced but included in each release.

Craftsmanship Dilemma:

Last thought… I was told to just ‘get something done’ basically… hack it.  No tests, no real design, just get it done now.  Do you think that is ok ?  How does that compare to craftsmanship ?  I don’t think I have to craft the perfect 100% solution, but how it gets built – ie. with a test, with some design/OO principles in place – shouldn’t we push back a bit to not just create ‘junk’ ?  I am noticing this trend in many industries.  Just ‘build the car’, doesn’t have to last, we need it cheap and now to compete.  At what point does quality matter ?  How would you feel if the rollercoaster your going to ride is built with that mentality?  Or the bridge ?  Or the airplane ?  Or how about the breaks on your car?  Why isn’t software engineers able to defend their craft in these situations ?  I guess it’s all about the $$$  ?  There is ‘agile’ … then there is ‘craftsmanship’…

 

Well, that is enough for the day – everyone have a great weekend!

25Nov/090

Wonderful Wednesday

Working hard… sorta of – it’s the day before Thanksgiving and many people aren’t working today – makes for a long weekend for many.

Well, I’m still working, so thought I’d post some updates from the week since my last ‘Saturday Splash’.

Couple of items this week of interest:

Saturday Night Live : ‘China Cold Open’

http://www.hulu.com/watch/110317/saturday-night-live-china-cold-open

Telerik ASP.NET MVC Controls

Telerik has some free open source mvc controls available: http://demos.telerik.com/aspnet-mvc/

  • Pure ASP.NET MVC components

    Built on top of ASP.NET MVC to leverage its values - lightweight rendering, clean HTML, separation of concerns, and testability.

  • Completely Open Source

    The Extensions are licensed under the widely adopted GPLv2. A commercial license with support is also available.

  • Exceptional Performance

    No postbacks, no ViewState, and no page lifecycle. The Web Asset Managers optimize the delivery of CSS and JavaScript, so no precious HTTP requests are wasted.

  • Based on jQuery

    Telerik Extensions draw on the power of jQuery for visual effects and DOM manipulations.

  • Search Engine Optimized

    The Extensions render clean, semantic HTML, which is essential for indexing your content in the major search engines.

  • Cross-browser support

    Telerik Extensions for ASP.NET MVC support all major browsers - Internet Explorer, Firefox, Safari, Opera and Google Chrome.

  • One of the biggest concerns for those hooked (more like stuck – lol) on webforms is ‘but what about my controls'?’.  Sad but true, however, with asp.net mvc it’s much easier to create controls.  Combine those with a powerful javascript library like jQuery and it can be magic.

    Take for instance the Telerik grid (by the way, you can get a similiar grid from MVCContrib, which I use, which this code is nearly the same… hmm… wonder if the same guy made them for Telerik – lol):

    <%= Html.Telerik().Grid<Order>(Model)
            .Name("Grid")
            .Columns(columns =>
            {
                columns.Add(o => o.OrderID).Width(100);
                columns.Add(o => o.Customer.ContactName).Width(200);
                columns.Add(o => o.ShipAddress);
                columns.Add(o => o.OrderDate).Format("{0:MM/dd/yyyy}").Width(120);
            })
            .ServerBinding(serverBinding => serverBinding.Action("FirstLook", "Grid", new { ajax = ViewData["ajax"] }))
            .Ajax(ajax => ajax.Enabled((bool)ViewData["ajax"]).Action("_FirstLook", "Grid"))
            .Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))
            .Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))
            .Pageable(paging => paging.Enabled((bool)ViewData["paging"]))
            .Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
    %>
    
    

    Simple to use, and very powerful… and free. Check out the link above to view the other available controls.

    Update: http://blogs.telerik.com/AtanasKorchev/Posts/08-11-06/ASP_NET_Ajax_Controls_in_ASP_NET_MVC.aspx

    From that link above:

    …I am glad to inform you that RadScriptManager provides support forASP.NET MVC view and master pages. What this means is that RadControls for ASP.NET Ajax can be used in ASP.NET MVC…

    
    

    (Learn more from Atanas Korchev’s blog here – he has some good posts surrounding asp.net mvc with Telerik)

    
    

    RIA Services: A DomainService IS A WCF Service – Add Service Reference

    Brad Abrams has a good post on showing how a RIA.NET Domain Service IS a WCF Service:

    http://blogs.msdn.com/brada/archive/2009/11/22/ria-services-a-domainservice-is-a-wcf-service-add-service-reference.aspx

    This is a recent change in RIA.NET – and I should add, several other services like ADO.NET Data Services – where they are using WCF ‘under the covers’ as their communication protocol.  I think this is a good move – it provides a very standard way to communicate across the wire regardless of which flavor you choose.

    Using JsonP with WCF and jQuery

    Ben Dewey has an excellent blog post on how to use JsonP with WCF and jQuery in the new release of .NET 4.0.  As he explains, the WCF team has added support for JsonP.  Since jQuery ships with a getJSON ajax function, it makes this a piece o’ pie  :)

    ASPNET MVC from Basic to Tips and Tricks

    Michael Johson has a good writeup on tips and tricks with asp.net mvc.  I think he is spot on in all his recommendations.  Much of what he write about is best practices with asp.net mvc.

    As more and more asp.net developers see the light of mvc, we’ll need more posts like this to keep them writing good mvc code  :)

    Refactor or Rewrite

    Another good infoq article – this one on ‘refactor or rewrite’.   I’ve had this same conversation several times in my career – as I’ve seen projects really expand and bolt more and more functionality, which ends up changing the overall scope of the application – making it harder to maintain and understand.  Obviously many companies are scared to rewrite an app from scratch.

    Other

    Google: Last but not least, I’ve really enjoyed my switch to using google products.  I switched my email address over to gmail, I’m using google reader, google docs, etc…  and finally I’m using Google Chrome in full force now.  I miss two items from Firefox that I’m looking for replacements… (1) Firebug –which is the greatest and best web dev tool ever… and (2) FireFTP.  For now, I just pop open Firefox when I need it.  I think Chrome is more stable, uses less memory, and is faster.

    I deployed a test of the Google chrome on a web project.  This enable me to keep chrome as the website engine, and allow the client to use IE still as the main browser.  Certain pages, like reporting services, just use vanilla IE to print reports, etc..

    Lastly, I had a good talk with a member of the Microsoft Patterns and Practices team last week.  I had been critical in a blog post about their releases, etc…  As always, talking directly to someone helps tremendously.  We were able to voice our concerns (I invited a few coworkers) and where we think they could do better.  It was well taken.  That team is very customer focused, and they want and value community feedback.  This helped change some of my views.   One area I want to get more involved with is growing their web client guidance – expanding it to asp.net mvc – and their Prism for Silverlight.  Just wanted to express that the P&P team is hard at work and I was able to get more clarification on the role they play at Microsoft.  As fyi – they are an extension I believe of the product teams, and yet rather than just one product, they have several under their belt – that keeps them quite busy  :)

    That is all for this week – I hope everyone has a Happy Thanksgiving.  This is my favorite holiday – family and good food, time to be thankful for all we have.  The Lord has been good to my family and myself.  Just pray for all those that don’t have a family to be with and for those less fortunate.  I also pray for those out of work to be able to find some work.  This economy has been very hard on our community.  God Bless!

    Filed under: C#, General, MVC No Comments
    21Nov/090

    Saturday Splash

    To continue from the Super Tuesday post – here are some more highlights from this week:

    First off, let’s get things started right… today is the best football game of the year – Ohio State vs. Michigan

    buckeye-pride

    OH!  IO!   Go Bucks  :)

    Value Objects Presentation

    Dan Bergh Johnsson gives an enlightening presentation on ‘value objects’.  Sounds… boring… ?  Not at all.  This is a real eye opener.  I had to sigh a few times as he spoke thinking ‘I need to go start refactoring some code!’.

    Give your programming career a favor and watch his presentation over at InfoQ.

    Dan Bergh Johnsson refreshes the listeners’ memory on using value objects showing by example how their good use can revolutionize a program’s architecture, simplifying it, making it more readable and testable, in a word, better.

    Chrome OS:

    Been following the news on Chrome OS ??? Well, it’s all very interesting!  Here are some favorite links:

    Help Build Chrome OS: http://blog.chromium.org/2009/11/hello-open-source-developers-would-you.html

    Demo: http://www.youtube.com/watch?v=ANMrzw7JFzA&feature=channel

    Google OS Concept Video :http://www.youtube.com/watch?v=hJ57xzo287U

    http://googleblog.blogspot.com/2009/11/releasing-chromium-os-open-source.html

    My take on this new Operating System:

    1. “Just” Chrome… hmmm… not sure about this value.

    2. Android + Chrome ?  Now we’re talking.  This is the way they should proceed IMO.  Android would add value.

     

    UPDATE: Looks like my #2 is right on target….read about ..converge…  :)  

    Google's co-founder, Sergey Brin…said "Android and Chrome are likely to converge over time."

     
    ASP.NET MVC 2 Beta Released:

    http://haacked.com/archive/2009/11/17/asp.net-mvc-2-beta-released.aspx

    My favorite .NET web framework has been updated to version 2 beta. From Phil Haack’s link above:

    Here are some highlights of what’s new in ASP.NET MVC 2.

    • RenderAction (and Action)
    • AsyncController
    • Expression Based Helpers (TextBoxFor, TextAreaFor, etc.)
    • Client Validation Improvements (validation summary)
    • Add Area Dialog
    • Empty Project Template
    • And More!
    Go Live

    ASP.NET MVC 2 Beta also includes an explicit go-live clause within the EULA.

    To go along with this release is a good write up custom validation in asp.net mvc 2.  A snippet of what this post covers:

    cover building a custom validation attribute using the base classes available in System.ComponentModel.DataAnnotations. ASP.NET MVC 2 has built-in support for data annotation validation attributes for doing validation on a server. For details on how data annotations work with ASP.NET MVC 2, check out Brad’s blog post.

    Great stuff Phil! This is a 3rd part of Phil Haack’s series on asp.net mvc beta 2.  This team continues to impress me on their progress.  As David Hayden has said ‘"hopefully you have spent the past year learning and mastering the ASP.NET MVC Framework, because Webforms is officially dead"’  :)   (LOL)

    P&P Web Client Developer Guidance

    I’m going to start following the Web Client guidance project from the Patterns and Practices team.  Some of their ‘anticipated benefits’ (from CodePlex site) include:

        • Provides infrastructure for developing and maintaining ASP.NET and AJAX applications
        • Provides guidance on MVC 2, jQuery, and AJAX library
        • Unit testing for ASP.NET and JavaScript client applications
        • Responsive applications
        • Flexible architecture that allows change
        • Separated presentation including unit testing view logic
        • Application modules are developed, tested and deployed separately
        • User Interface components are dynamically composed
        • Guidance on how to improve Web client security
        • Allows incremental adoption of the components

    This is a bold list, but a good list of future features.  I’m going to urge this team to make these a reality.  As some know from my past post, I consider ‘Grails’ to be the defacto standard right now for a web application framework.  That said, personally I’d like to see this team start to take on their model of convention over configuration, etc… and provide guidance that implements practices – such as IoC for injecting services into the controllers, a loosely coupled architecture, testing structures created – build/test routines, ease of switching back and forth from test/dev/production in builds – simplified setups for developers with consistent project layouts.  I think their list again, is bold, but good.  I look forward to seeing this progress.

     

    Chrome Frame:

    http://code.google.com/chrome/chromeframe/

    Yes… I actually used this – and it worked out well.  We enjoy the benefits of Chrome, and a customer that uses IE.  Where it helped was we are using Reporting Services in certain pages.  These pages did not include the frame to get the printing functionality of IE.  Meanwhile, the rest of the application enjoyed the Chrome features, all looking as if it’s in IE.  (Note: this was an intranet web app)

     

    Davey Brion’s Introducing the ‘Agatha’ Project

    http://davybrion.com/blog/2009/11/introducing-the-agatha-project/

    What is Agatha ?  Agatha is a new ‘Response/Request Service Layer’  RRSL.   http://davybrion.com/blog/2009/11/requestresponse-service-layer-series/

    These are the posts that this series consists of:

    1. Requests And Responses
    2. Processing Requests
    3. Handling Requests
    4. Exposing The Service Layer Through WCF
    5. Synchronous Client-Side Usage
    6. Testing Synchronous Client-Side Usage
    7. Asynchronous Client-Side Usage
    8. Testing Asynchronous Client-Side Usage
    9. Conclusions

    This is an open source project.  He summarized a list of items in his concluding post. 

     

    Udi Dahan (NServiceBus) on Search and Messaging:

    http://www.udidahan.com/2009/11/01/search-and-messaging/

    One question that I get asked about quite a bit with relation to messaging is about search. Isn’t search inherently request/response? Doesn’t it have to return immediately? Wouldn’t messaging in this case hurt our performance?

    Learn more about Search and Messaging – as I lean toward SOA/EDM/ESB architecture, these are critical pieces to understand, in particular the Command/Query pattern:

    See Udi’s post on ‘Command Query Separation and SOA’.

    Steve Sanderson on 'Selective Unit Testing – Costs and Benefits'

    Steve Sanderson, author of my favorite ASP.NET MVC Framework book has a good article on ‘selective-unit costs & benefits.

    Here is a snippet to get you started:

    So why am I writing this? Two reasons:

    1. Because I think we can go further and understand the underlying forces that make unit testing worthwhile (or not) for any given unit of code.
    2. Because a minority of developers still believes that they should aim for 100% unit test coverage, and that if they don’t follow the TDD code-first process, then they’ve failed as a professional. I’m not satisfied with that view.
    Filed under: Uncategorized No Comments
    18Nov/090

    CodePlex Foundation : Ajax Library Project

    What is CodePlex Foundation?

    logo[1] 

    The CodePlex Foundation is a not-for-profit foundation created as a forum in which open source communities and the software development community can come together with the shared goal of increasing participation in open source community projects

    (You can click on the image above to goto the website and learn more)

    So the news of the day is that this foundation has created it’s first ‘gallery’, the ASP.NET Open Source Gallery.

    What is a Gallery?

    Galleries may be sponsored by a third-party organization, e.g. a commercial software company, or run by the Foundation. Galleries will rely on Foundation staff and volunteers to provide a set of support services, including administration, security, best practices and marketing.

    Out of this gallery is the first project the ‘ASP.NET Ajax Library’.  This project has a wiki setup to learn more, get the source code, view some sample applications, etc…

    http://www.asp.net/ajaxlibrary/

    Head over to the ‘Learn’ section at http://www.asp.net/ajaxlibrary/learn.ashx it gives an overview of the capabilities of the library.

    Some of the examples are interesting as they provide a ‘imperative’, ‘declarative’, and ‘jquery’ approach.

    My ‘favorite’ example is the one on :

    HOW TO Call ASP NET MVC Controller Actions

    I’ll snag a few snippets off that page in a shorter format – go read for the full instructions.

    First, a controller action with model class:

    public JsonResult GetCustomers()
    {
        List<Customer> custs = new List<Customer>
        {
            new Customer
            {
                CustomerID = 1,
                FirstName = "John",
                LastName = "Doe",
                Age = 50
            },
            new Customer
            {
                CustomerID = 2,
                FirstName = "Jane",
                LastName = "Doe",
                Age = 47
            }
        };
        return Json(custs);
    }

    ASP. NET makes it easy to return data as Json out of the box as you can see above.

    To then call this controller/action from the view:

    <script src="../../Scripts/MicrosoftAjax/start.js" type="text/javascript"></script>
    <script type="text/javascript">
        Sys.require([Sys.components.dataView, Sys.scripts.WebServices], function() {
            var dataView = Sys.create.dataView('#CustomersTemplate',
                {
                    dataProvider: "/Home/GetCustomers",
                    autoFetch: true
                });
        });
    </script>


    There is a ‘dataview’ defined above with the #CustomerTemplate referring to a html element on the page of id ‘CustomerTemplate’

    ie.

    <div id="CustomersTemplate" class="sys-template">
        {{FirstName}} {{LastName}}
    </div>

     

    This should give you an idea, the other examples covering different topics are available, with sample code snippets and instructions on how to use the code.

    I feel they have done a good job putting this together in a easy to follow manner, and the technology presented isn’t complex.

    Filed under: Ajax, OpenSource No Comments
    17Nov/090

    Super Tuesday!

    One of my coworkers recommend combining some posts together than one a bunch of ‘one offs’ of links or news of interest.

    I’ve accumulated a set of links, thoughts, experiences, etc… over the last few days (I’ve been busy). 

    New Sharp Architecture Release

    http://devlicio.us/blogs/billy_mccafferty/archive/2009/11/12/s-arp-architecture-1-0-2009-q3-with-nhibernate-2-1-1-ga-released.aspx

    Basically Sharp Architecture is about as close as you can currently get to a Spring/Hibernate MVC architecture in .NET.  My last project used several pieces of Billy’s previous ‘NHibernate Best Practices’ that I retrofit for asp.net mvc.  Then, Billy helped put together Sharp Architecture!

    A snippet of what Sharp Architecture is at the wiki:

    Pronounced "Sharp Architecture," this is a solid architectural foundation for rapidly building maintainable web applications leveraging the ASP.NET MVC framework with NHibernate. The primary advantage to be sought in using any architectural framework is to decrease the code one has to write while increasing the quality of the end product. A framework should enable developers to spend little time on infrastructure details while allowing them to focus their attentions on the domain and user experience. Accordingly, S#arp Architecture adheres to the following key principles:

    • Focused on Domain Driven Design
    • Loosely coupled
    • Preconfigured Infrastructure
    • Open Ended Presentation

     

    SpringSource updated to 2.2.1 includes new GSP Editor

    I updated my SpringSource (STS) – (see more below about STS + Grails)
    The update to 2.2.1 is here: http://www.springsource.org/node/2172

    Grooy and Grails Random Thought

    As a very well done project for building web applications...what is it's popularity out in the world?  Are companies afraid of it?  Take NHibernate in the .NET world, in spite of it's best of breed position, companies would rather use less to not use open source (the 'it's not from MS position').  Is Groovy and Grails popular out there ?  If you do Grails/Groovy development – ping me please – let me know where your at, how you like it, etc… I’d like to see if it’s made much of a dent out there!

    What I’m reading: ‘Grails in Action’ : Some Thoughts While Reading

     
    Shout out to Manning for this e-book, love their setup, easy to purchase, prices are fair, many up and coming books on topics you don’t see in the mainstream yet!

    Chapter 1 - good start.  Steps through the creation of a sample grails app.  Covers the basic commands.  Only issue I had was using the 'file db' - so I setup Grails to run on MySQL, which was a good exercise.  Tests still run in memory, which is good.  Final part was using prototype with taglibs to do some simple ajax.  I like how it starts by not bogging down into details, but getting something up and running.    

    Highlights:

    • convention over configuration
    • removal of much of the xml configuration
    • testing built in.
    • Domain focus, code generated is clean and 'pojo'.
    • Built in common functionality ie. prototype.
    • Good helper support with tablibs.

    Chapter 3

    ...Chapter 2 was a nice overview of Groovy.  I'm now moving on to 'Modeling the domain':
    This chapter covers
    ■ What GORM is and how it works
    ■ Defining domain model classes
    ■ How domain classes are saved and updated
    ■ Techniques for validating and constraining fields
    ■ Domain class relationships (1:1, 1:m, m:n)

    STS and Grails

    http://www.grails.org/STS+Integration
    Nice setup I'm using, shows how to create or import an existing Grails project into the workspace

    I like the way that Grails provides integration tests as part of the framework that automatically handle transactional rollbacks.

    I like the integration that STS does provide for Grails.  But I do think doing the work from the command line is faster and more efficient.  After adding new items, just refresh the Eclipse project and it's there.  This is especially good for quickly running tests.

    Grom

    One thing I see in other frameworks (ie. asp.net mvc) is the concentration on views and controllers.  Whereas in Grails, I think the pattern all starts with the domain model.  Generate the model which has what I would call 'built in DAO support'.  GROM makes life easier  :)

    Validation

    Grails validation is very well done, it's built on a 'constraints' model with a built in validation DSL.  From Grails in Action:

    static constraints = {
            userId(size:3..20, unique:true)
            password(size:6..8)
            homepage(url:true, nullable:true)
        }

    This says ‘userid must be unique (in db) and be between 3 to 20 characters long’  - nice eh?

     

    Software Craftmanship Manifesto


    Did some pair programming last couple of days.. it was fun to say ‘whoa, this needs a new class here!’, refactor, make it more readable, etc… Must have been the next day I was shown this manifesto.  The only part that is still missing is the testing part, although some of the code is using legacy code that doesn’t lend itself well to testing… nevertheless, there is a real sense of accomplishment and success in writing code when there is craftsmanship put into it… so this manifesto is spot on!

    http://manifesto.softwarecraftsmanship.org

     

    How to start agile development in your team:

    http://weblogs.asp.net/rosherove/archive/2009/11/16/how-to-start-agile-development-in-your-team.aspx

    Thanks to Roy Osherove, as my current client was recently asking it’s team ‘are we agile’… From the link above:

      1. start doing daily stand up meeting
      2. start doing automated builds
      3. start working in pairs on relatively complicated problems
      4. start doing code reviews
      5. start showing visible progress
      6. start trying to show demos every two or three weeks
      7. start learning unit testing
      8. learn how to code better, design better
      9. start doing TDD

    As a company, there are maybe 2 items here, as a team, more like 50% ?  I will say this: more and more it’s about the culture.  Happens everywhere, even on ESPN radio there was talk about the ‘culture’ on a team in the NFL, take a so-so quarterback, joins a new team, with a different culture, and he does well…(Denver Broncos) take a star on one team, move him into another culture… and he struggles…(Chicago Bears). 

    More work needs to be done to promote a new culture in companies.  How to ‘sell’ to upper management who doesn’t seem to care ‘how’ you do it, as long as you go it… vs.  technical people in a company that totally reject anything new.   Where I’m at now, every new idea is really rejected, the company is fine with it’s ‘it was made here’ approach, but it is already showing it’s age and it’s big, bulky and hard to move it forward.  Some work was done to add some domain driven design concepts, add some tests, etc…  In the end… culture… If you haven’t watched ‘Pimp My Architecture’– watch it! 

    Here is a related article from InfoQ:

    Tips to Select a Pilot Project for Agile Adoption (InfoQ) :

    One of the most important factors which influences the success of Agile adoption is the set of learnings derived by applying Agile to a pilot project. These learnings significantly influence the organization to go ahead with Agile or fall back to their usual process. This places a lot of emphasis on the selection of the pilot project. A wrong type of pilot could end up aborting, which would be a poor advertisement for the new process.

    and

    An engaged business sponsor can help the team if it needs to push against entrenched business processes, departments, or individuals. The time and energy of a business sponsor are critical to the success of the project…all these factors become meaningful with a strong team. Hence, choosing the right team is a precursor to all the above factors.

    It takes a “strong/right” team with a mindset to embrace the agile methodology.  They later become the flag bearers for other projects within the organization.  

    NServiceBus – Web Asynchronous Publishing


    nservicebus includes an async pages sample.  Publishing a message asynchronous to a queue and it returned back to the page.  Get 2.0 beta – and learn how nservicebus works.  This brings to mind a lunch conversation today..SOA isn’t just ‘web services’ – there is much more to it.  NServiceBus helps provide a message based architecture.   

    ie. Command Query Pattern

    The command service publishes messages about changes to data, to which the query service subscribes. When the query service receives such notifications, it saves the data in its own data store which may well have a different schema (optimized for queries like a star schema). The query service may also keep all data in memory if the data is small enough.

    Learn More

    TCP Sockets, Chat Program

    Don’t ask about this one.  I am working on some port listener code for a flying sim hobby I enjoy.

    Good start …

    Building a Chat Server

    Building a Chat Client

    … by the way… Groovy does it better  :)

    s = new Socket("localhost", 8283)
    s << "Groovy Rocks"
    s.close()
     

    (reference : http://gallemore.blogspot.com/2008/01/socket-client-for-groovy.html and Groovy Sockets: http://pleac.sourceforge.net/pleac_groovy/sockets.html)

     

    asp.net mvc 2 beta released at PDC


    http://haacked.com/archive/2009/11/17/asp.net-mvc-2-beta-released.aspx

    Here are some highlights of what’s new in ASP.NET MVC 2.

        * RenderAction (and Action)

        * AsyncController

        * Expression Based Helpers (TextBoxFor, TextAreaFor, etc.)

        * Client Validation Improvements (validation summary)

        * Add Area Dialog

        * Empty Project Template

    I hope to see some ‘grails like’ command line scaffolding and richer domain class support in upcoming versions.   In my post there, Phil says ‘Version 3’… so.. stay tuned!

    I’m really glad to see Microsoft continuing this project, it’s a breath of fresh air – I have a 1-1/2 year project that is using it and I never grow tired of the technology part of it.   

    LifeCycle Data Services (LDS)

     

    Huh?  :)   This is one a bit out of my normal range, but I was curious about an InfoQ article talking about Flex/Flash/AIR, etc… and one of the tools they are making is LDS.   LDS is about domain modeling.

    And so the way it works is that, we have a model that becomes the centre of the universe, if you want, of the server-side developer and you create a model that represents your data. You can create it from scratch or you can introspect the database as a starting point

    There is a new plugin that you add on top of Flash Builder: that is the Model Designer. The process that I just described here is actually done within Flash Builder in a kind of a visual way; so we have a visual model editor. In that model, it's more than what you typically do in a pure data model - you can add constraint and validation rules, you can specify things that typically you would have to specify again and again in view components

    Once you create your model, you deploy the model and basically you don't have to write server side code because, based on the model, we have enough to really provide a persistence layer

    Nothing new here right..? Well, what caught my eye was that they are using Hibernate (my bff) !!!  So, even Adobe is hopping into the mix here :)

    Behind the scenes, this is implemented using Hibernate - the persistence layer is provided by Hibernate - and then we also do some code generation on the client side, again the value objects and the service proxies. The key point is that the foundation for that is still the data management service

    There you have it.  Now if we can just get Microsoft to embrace NHibernate and see the light…  :)

    And last…. but not least… I saved the best for last:

    Slashdot post: ‘Less than Free’

     

    On the day that Google announced its new service, the stock in the two companies that had controlled the market for map data, Garmin and TomTom, dropped by 16% and 21%, respectively. (Those companies had bought Google's erstwhile map-data suppliers, Tele Atlas and NavTeq, in 2007.)

    Read more about ‘the strategy behind Google's releasing turn-by-turn mapping for free…’ .  Wow.

    12Nov/090

    Dan North Presentation… Pimp My Architecture

    Thoroughly enjoyed this presentation ‘Pimp My Architecture’ over at InfoQ…given by Dan North of ThoughtWork.

    Check it out if you get a chance  (sounds like 95% of the places I’ve been too…lol)

    At the very least, unless I’m just too much of a geek, you have to get a laugh out of his standup meeting part  :)

    And ‘we never called it pairing… just a lot of helping going on’   :)

    Filed under: Uncategorized No Comments
    11Nov/090

    Bulk Data Operations with NHibernate

    …using ‘Stateless session’ :

    http://nhforge.org/blogs/nhibernate/archive/2008/10/30/bulk-data-operations-with-nhibernate-s-stateless-sessions.aspx

    The key here is that an IStatelessSession does not use the first-level cache.  Basically by default, every object that is saved or loaded through a session is cached in the first level cache.  In normal operations you want this functionality, but if you are, ie. looping through items to save, it’s better to use the stateless session

    Filed under: Uncategorized No Comments
    11Nov/090

    Good Article on ‘Practical SOA Using WCF’

    http://blog.netshock.com/post/Practical-SOA-using-WCF.aspx

    I definitely like the event-driven-architecture discussion.  Just recently I was asked about how to link a couple of services together.  It was described as ‘orchestrating’ but in essence, it was creating yet another service to sit in front of 2 and make 2 service calls and combine the data in return…

    Which in this read, you can see he points out:

    The bigger question is how are these services linked (or coupled) together? …

    Your two choices would be EDA (event-driven architecture) or a "product" service.  The former is the preferred method as the latter creates a single service (providing a potential single point of fail) which orchestrates interaction between the various services.  The former is an architecture based on services publishing certain events which other services may subscribe to

    The patterns I see emerging here is SOA kept loosely coupled, etc… leads to a need for event-driven-architecture… which then leads to the need for an enterprise service bus.

    SOA –> EDA –> ESB

    And then ESB is about business process modelling BPM

    SOA –> EDA –> ESB –> BPM

    So, that leads me to solutions like NServiceBus.  They have actually a good article on NServiceBus and WCF.  I’ve mentioned others here like MassTransit, and I know Ayende has his RhinoBus.

    Trying to decide which route to take.  I’d prefer more convention over configuration if possible…

    Udi (create of NServiceBus) describes the architectural principles :

    Service-Oriented Architecture and Event-Driven Architecture together
    provide the basis for identifying where NServiceBus should be used.

    I’m going to plug Mass Transit as well - (Chris Patterson blogs about Mass Transit)

    I’ll end with this last quote:

    Strategic Domain-Driven Design helps bridge the Business / IT divide
    and drives the choice of business events published using NServiceBus.

    Filed under: Uncategorized No Comments
    9Nov/090

    Create and Install Temp Certs in WCF for Msg Security During Dev

    In my last post on WCF, there is a point in the videos where you will get errors creating endpoints because they create identities expecting certificates.

    I mentioned that at the end of the blog.  However, I decided this link and instructions were good and wanted to point it out.

    How To: Create and Install Temporary Certificates in WCF for Message Security During Development

     

    Edit:

    (oh and make sure you run your VS cmd line as administrator or you will get this error :Save encoded certificate to store failed => 0x5 (5)     (Vista/Windows 7))

    Edit again:

    Note this comment as well:

    Note: If FindPrivateKey is not on your machine, download the WCF samples, including the FindPrivateKey tool, at http://www.microsoft.com/downloads/details.aspx?FamilyId=2611A6FF-FD2D-4F5B-A672-C002F1C09CCD&displaylang=en

    Although note again… this link is no longer good (sigh)… so try here instead http://msdn.microsoft.com/en-us/library/aa717039.aspx  (lol good luck… and you wonder why Ryan… haha)

    Filed under: WCF No Comments