Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

NET Event - Migrating WinForm


Published on

Raffaele will provide a gap analysis and the potential problems or advantages of moving from a Win32 technology to a vectorial technology like WPF/Silverlight. A detailed discussion and samples will be provided to address when to use WPF and when to use Silverlight.

Published in: Technology
  • Be the first to comment

NET Event - Migrating WinForm

  1. 1. From legacy to WPF/SL<br />Migrating applications from Windows Form to WPF/Silverlight<br />Raffaele Garofalo<br />
  2. 2. Who am I?<br />Raffaele GarofaloNET Software ArchitectMCP (MCAD, MCSD, MCTS)<br />Blog:<br />Twitter: @raffaeu<br />Company: Nephila Capital Ltd. ( <br />I am Italian, sorry for my bad English<br />
  3. 3. My Books<br />Microsoft<br />APRESS<br />
  4. 4. Summary<br />Reasons for migrating<br />Choose the right technology<br />Is Windows Form dead?<br />Choose the right architecture<br />The team<br />Some useful tools<br />
  5. 5. Reasons for migrating<br />Legacy application that requires refactoring (partial)<br />Legacy application developed with a very old technology (FoxPro, VB6, …) (re-write)<br />Application that requires a more complex UI (User Interface) not sustainable with Windows Form (partial)<br />Specific request from the Customer (at the end, he has the money …)<br />New project (never start a new project with an old technology!)<br />
  6. 6. Always consider the budget!<br />You do not need to re-write everything, you can keep the existing UI and migrate only the new features<br />Windows Form can live in parallel with WPF/SL<br />You can host Windows Form in WPF (WindowsFormHost) and WPF in Windows Form (ElementHost) or SL in Windows Form (embed browser)<br />
  7. 7. Is Windows Form dead?<br />No, it is not. There are still thousands of active projects done in Windows Form<br />Win Form is still the following step after VB6 <br />WPF is not intended to replace Windows Forms<br />It is not dead but it is an old technology. It is still available <br />It does not separate UI from code, I can’t employ a designer for the UI <br />
  8. 8. Choose the right technology<br />First rule: WPF is for Standalone, Silverlight is for Web, Phones<br />Second rule: WPF works only on Windows OS, Silverlight works on Windows, MAC, Linux<br />Third rule: WPF is a more powerful technology, Silverlight uses a restricted version of the NET Framework but more feasible for Web and Media<br />WPF requires a knowledge of XAML for WPF, Silverlight requires XAML for SL, HTML and JS and WCF<br />
  9. 9. What can I do with?<br />WPF<br />Full .NET Framework(i.e. Split() has 6 overrides)<br />UI objects derives from Visual base class<br />Routed events, more control<br />Cryptography more powerful<br />Not a lot of choices for Media management<br />SILVERLIGHT<br />Restricted version of .NET(i.e. Split() has 3 overrides)<br />UI objects derives from Control<br />Routed events, less control<br />SL supports only 4 hash algorithms<br />Great support to Media management and streaming<br />
  10. 10. What Microsoft suggests? SL<br />If you're just starting out, and there's a question as to which technology to choose (Silverlight or WPF) then start with Silverlight. It is generally easier to move up to WPF from Silverlight than it is to move the other way. Silverlight has a smaller API, and is therefore generally considered easier to learn.<br />If you need a desktop application with only basic system integration, consider building a Silverlight Out-of-Browser application. Silverlight 4 Trusted Applications with IDispatch support provide access to many system resources previously unavailable to web technologies.<br />If you need deep system integration, excellent multi-touch support, device access, local resources, and all the other things that go with a solid desktop application, then consider moving up to WPF.<br />If you're a C++ developer, you can choose to go with C++ and MFC, or use C++ with WPF on the front end, like the Expression team did.<br />
  11. 11. Still missing …<br />WPF<br />A good designer tool, VS is not cool as Blend<br />The Control toolkit is not exhaustive, you still need a third party control library<br />Silverlight<br />Same thing<br />Interaction with HTML and Javascript still lacks in some parts<br />Still requires to recompile your .dlls<br />
  12. 12. Composite Frameworks<br />Create an application using Modules (independent assemblies)<br />Specialize teams in different areas (UI, Presentation, Business)<br />Reusable architecture<br />Increase quality and usability by sharing common services and functionality<br />
  13. 13. Composite for WPF/SL<br />Prism<br />Requires observer patterns (message broker)<br />Cool navigation service in V4<br />Only IoC with Unity (Microsoft)<br />Astonishing resources and documentation<br />caliburn<br />Auto-wiring<br />Transitions between Views<br />Open source with less technology limits<br />Available also for Windows Phone<br />
  14. 14. Demo<br />WinForm demo application (MSDN, Telerik)<br />WPF demo application (MSDN, Codeplex)<br />Silverlight demo application (MSDN, Telerik)<br />WPF showcase<br />Silverlight showcase<br />
  15. 15. Choose the right architecture<br />Layered application or monolithic block?<br />SOA or not SOA? If I work with Silverlight that’s the only choice …<br />TDD or not TDD?<br />What about an O/RM? Entity Framework, Nhibernate or what?<br />What about security, especially if I am working with SL?<br />Design patterns, is M-V-VM mandatory?<br />
  16. 16. Layered application, why?<br />Why should I use a layered application if it requires:<br />More code<br />More time<br />More effort<br />More people<br />More money<br />
  17. 17. Layered application, why?<br />The application we are designing is complex or it will be complex in the future<br />I need to be able to make my application scalable, maintainable and secure<br />I want to split the project over multiple teams and resources<br />I need to recycle as many code/features as I can<br />I need to cover with test as much surface as I can<br />
  18. 18. Layered applications<br />
  19. 19. SOA (Service Oriented Architecture)<br />Real reasons<br />We need to hide the datastore and the business logic<br />I need to spread the business logic over different technologies (WPF, Phones, REST)<br />I can’t migrate everything (like AS400 …) so I need a bridge between old/new<br />Developer’s reasons<br />I need to get certified on WCF<br />It is cool and I am the only one that doesn’t use it yet<br />I can write 10 times more code to do the same thing<br />
  20. 20. TDD Overview<br />
  21. 21. TDD Overview. A good unit test …<br />Run fast (they have short setups, run times, and break downs).<br />Run in isolation (you should be able to reorder them).<br />Use data that makes them easy to read and to understand.<br />Use real data (e.g. copies of production data) when they need to.<br />Represent one step towards your overall goal.<br />
  22. 22. TDD Pros and Cons<br />PROS<br />Indicator of project’s health<br />Less time to fix bugs<br />You should write application using functional code<br />Good documentation for you code by function/requirements<br />CONS<br />One change may requires more effort on fixing tests than fixing real code<br />Time to write tests<br />You may not always need to write applications using functional code<br />Wrong test will document wrong requirement<br />
  23. 23. O/RM, which one?<br />Nhibernate, Entity Framework are free, others are not<br />Nhibernate is 100% flexible but no IDE<br />EF has an IDE but is not flexible<br />Nhibernate has years and is open source<br />EF is still not mature and it is not open source<br />Nhibernate requires more experience, it is not for newbie<br />
  24. 24. O/RM<br />PROS<br />You are not anymore Database technology driven<br />Write applications faster, do not need ton of SQL<br />Easier to test the data layer<br />CONS<br />Less flexibility because you can’t use all the power of a specific RDBMS<br />Devs tend to forget T-SQL/PL-SQL<br />The database become a simple container of data, no more logic in it<br />
  25. 25. Security real facts, did you know?<br />Most developers have no clue about security<br />Most of the intranet applications are not secure at all, especially WinForm<br />SOA implies an additional layer of security<br />The database should also be encrypted<br />A web application with “secret” data should be always SSL<br />The NET framework provides tons of utilities and facilities to apply security<br />
  26. 26. Security concerns for my application<br />Authentication, how the user will authenticate against the application<br />Authentication with SOA<br />Authorization, are we applying also granular security rights?<br />Logging, do we know what is going on? Do we have a trace?<br />Data protection, is security applied also at the data tier or do we use SA in SQL?<br />
  27. 27. M-V-VM Overview<br />
  28. 28. M-V-VM Main concepts<br />Provides separation of concerns<br />It is natural pattern for XAML platforms<br />Enables the developer-designer workflow<br />Increases application testability<br />
  29. 29. Resources on M-V-VM<br />In the Box Visual Studio integration (SEE DEMO)<br />My Book<br />Gary McLean’s book<br />PRISM documentation<br />Josh Smith<br />Karl Shifflett<br />
  30. 30. The Team<br />How big is the team I will work with?<br />How much experience do they have?Guru | Some exp. | newbie<br />What was their previous project? Do they know the difference between Client (WPF) and Web (SL)?<br />Is there a technology leader in the Team with some experience? <br />
  31. 31. The right one<br />Never put too many seniors: “Too many cooks spoil the dinner”<br />Never use big teams, lot of technical debates and few hours on writing code<br /> Put together devs that love the technology they are working with, negativity is a cancer<br />Tools make a developer life easier (documentation, books, controls, …)<br />
  32. 32. Make your life easier<br />Choose a set of Controls, learn it and use it! <br />Apply one pattern for the UI, learn it and use it. <br />Do not “experiment” with customer money, do what you know and avoid the unknown<br />Do not over engineer, remember that the Customer can appreciate only what he can see … (a.k.a. no NASA web services)<br />Small steps, small releases, small iterations<br />
  33. 33. Some tools<br />Books<br />Guidance<br />Best practices<br />Forums and Communities<br />
  34. 34. Books<br />My book <br />Architecting Applications for the Enterprise<br />PRISM’s Developer Guide (MS PRESS)<br />WPF 4 Unleashed (Adam Nathan)<br />Silverlight 4 Unleashed (L. Bugnion)<br />
  35. 35. Guidance<br />Codeplex<br />MSDN“Developers Guide to Microsoft PRISM”<br />WPF<br />Silverlight<br />
  36. 36. QA?<br />