views:

143

answers:

4

My team is starting a new project in silverlight. We are all experienced developers. It should be out of browser application with usage of public api's. We read about MVVM pattern... Are there some other guidelines/best practices for silverlight?

ADDED: What we would like to know is:

  1. Is there some other patterns/guidelines for SL other than MVVM
  2. Unit testing silverlight: your expirience with it...
  3. Out of browser behaviour...bugs, problems?
  4. Consuming web services, public api's...problems, pluses/minuses?

Thank you

+3  A: 

You might want to check out Prism (Composite WPF) by the Microsoft Patterns & Practices team. They have some "best practices" examples there, including MVVM. They also show you how to share code between Silverlight and WPF.

Also, check out the Silverlight Unit Testing framework, which allows you to unit test the UI.

Andy May
The EventAggregator from Prism is very useful to avoid memory problems (it's a weak dependency!). The IoC is also a very good thing if you want to build a BIG app.
Benjamin Baumann
+2  A: 

I'm using Silverlight by now and this is my first real/complete application using this techno. I've been using MVVM from the start first with the MVVM Light Toolkit. It is a really light and useful component that helps doing with mvvm and getting around with its constraints. Then I implemented Managed Extensibility Framework (MEF) wich helps you getting your application modular and it appears to complete/substitute to MVVM toolkit.

I didn't want to use PRISM at the beggining because my app is light. But when using MVVM pattern, you have to handle a bunch of pattern limitations. So it is sufficient alone only if you have a basic-data-application. Otherwise you're going to reinvent the wheel to finally discover that a great framework (PRISM-like) would have solved almost all your problems.

LouG
+2  A: 

I've done one major project (technically it's still in progress). I find myself using Blend and Visual Studio at the same time when working on the Silverlight project. Blend is so much better at the visual work but pretty much sucks for the code, and vice versa for Visual Studio.

I used MVVM Light Toolkit. For my next project I'll try Prism. There are other frameworks but as I understand it both of these are good for Silverlight or WPF.

I started to use MEF for some stuff, but dropped it to simplify getting something done rather than trying to get everything done. If extensibility is essential to the idea of your app then MEF seems to be a must have.

I would suggest spending some time getting good and familiar with the VisualState element, which I found simplified things a lot. Things like enabling, disabling, animating, transitioning, and so on.

The Liquid Controls (http://www.vectorlight.net/demos/silverlight_controls_demo.aspx) are nice and you may benefit from using them.

WPF might be a better choice for your Twitter app. From what I understand the typography and text support is much better in WPF than what Silverlight 4 offers at this time. If you don't plan on getting exotic with any of that then SL 4 should be fine.

Felan
thank you for your comment...and what have you used as service layer?
Marko
The Silverlight app interacts with a WCF service (not REST or RIA). That service uses ADO.NET Entity Framework with the POCO Text templating add-in for data access.The Entity framework/POCO caused a few headaches, I had to manually go through and delete one of the two links so that the serializer didn't recurse infinitely. It was a bit painful but I think it helped more than it hurt.
Felan
My service would also interact with another service that hosts workflows. I tried putting the workflow service in with my original service but it didn't work like expected. I was running late so I didn't mess around with it too much and I think that long term its better that the workflow be in a seperate service anyway.
Felan
+1  A: 

We are working on a project with a 2 years timeout. our project is a Data-Driven application with Rich UX and entirely our manager predicts 200K code with 400+ use-case.hence we started a survey on different approach and a brief conclusion is :

  • MVVM Light Toolkit(the Messenger class have a power-full features)
  • WCF for interaction with Server and Database (debug features and we prefer work with DB through ADO.Net,actually hand-written code!)

and very details that overally we obtain from Pro Business Applications with Silverlight 4 and Microsoft Silverlight 4 Data and Services Cookbook

Meysam Javadi
great, thank you...and what about testing, do you have some kind of testing(integration,unit)?
Marko
I'll not work on testing area but i know that we will have Unit-Testing team that they have Reshaper+CodeCover.
Meysam Javadi