What’s New and Hot in .NET 4.0
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

What’s New and Hot in .NET 4.0

on

  • 1,815 views

Walks through the new and awesome features in the .NET 4.0 Framework

Walks through the new and awesome features in the .NET 4.0 Framework

Statistics

Views

Total Views
1,815
Views on SlideShare
1,799
Embed Views
16

Actions

Likes
1
Downloads
50
Comments
0

2 Embeds 16

http://www.slideshare.net 13
http://www.brijj.com 3

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • BigInteger: an immutable type that represents an arbitrarily large integer whose value in theory has no upper or lower boundsTuple: a small, finite list of objects; used to pass around multiple values in one object. Kind of like a dynamic struct.ISet:collections that have unique elements and specific operations.Memory-Mapped File: gives you ability to work with files without loading them into memory and locking them from other processes
  • MESSAGING:Late-Binding Support: The ability to do runtime call dispatch rather than being forced into compile-time verification. Named and Optional Parameters: This allows us to clean up our code as we can see. It also goes hand-in-hand with #3, Improved COM interop (bye-bye “ref MissingValue”)Improved COM Interop: Better interop with COM, along with easier deployment via Type Equivalent and embedding of types.Covariance and Contravariance: This is really about patching a problem in our generic type system as it exists today. Most developers won’t be using the generic variance features directly, they will simply be able to do stuff they couldn’t do before.
  • MESSAGING:We show all these features in our demo.
  • MESSAGING:We show all these features in our demo.
  • MESSAGING:There are several trends in modern programming languages that we feel are important to address and capture with our programming language that we will continue to target. DeclarativeImperative languages focus heavily on the how.Programming logic is achieved via if statements, for loops, while loops, etc.Declarative languages focus on the whatTell the computer “what” you want done, and let it focus on how to get it done (so the language decides whether to achieve the goal via a for loop, foreach loop, recursion, etc.)Focusing on the what instead of the “how” is an important part of “stepping away from the compiler” and better expressing your true intent in code.DynamicAround dynamic languages, you often hear the comparison of dynamically-typed versus statically-typed languages.A better way to express this difference is thinking “late-bound” versus early-bound.Early-bound languages enforce calling conventions, matching contracts (method calls on specific types, for instance), at compile time. However, late-bound languages “punt” this decision until runtime. While early-bound languages gain me benefits like compile-time type-safety, they also enforce rigid constraints on the design of your codeIn this way, code written in early-bound languages becomes more difficult to change.For more information on this “flexibility”, check out Duck Typing in Ruby.ConcurrentConcurrency is a topic that is very important to start addressing ASAP. The “concurrency problem” is already here, not 5 years from now, but today.Functional languages like F# are very powerful when it comes to addressing concurrencyThis power comes from the immutable-by-default approach when enables easier-to-parallelize code since assumptions can be made about the behavior of the code because of no shared-stateF# introduces a very powerful mechanism for achieving concurrency called Asynchronous Workflows (has nothing to do with Workflow Foundation workflows)Async Workflows use Parallel Extensions to the .NET Framework under-the-hoodFor shared-stated languages like C# and Visual Basic, concurrency features are primarily coming from library features like Parallel ExtensionsLanguage teams are thinking hard about how to possibly integrate concurrency into the core language (this is a hard space).
  • MESSAGING:There are several trends in modern programming languages that we feel are important to address and capture with our programming language that we will continue to target. DeclarativeImperative languages focus heavily on the how.Programming logic is achieved via if statements, for loops, while loops, etc.Declarative languages focus on the whatTell the computer “what” you want done, and let it focus on how to get it done (so the language decides whether to achieve the goal via a for loop, foreach loop, recursion, etc.)Focusing on the what instead of the “how” is an important part of “stepping away from the compiler” and better expressing your true intent in code.DynamicAround dynamic languages, you often hear the comparison of dynamically-typed versus statically-typed languages.A better way to express this difference is thinking “late-bound” versus early-bound.Early-bound languages enforce calling conventions, matching contracts (method calls on specific types, for instance), at compile time. However, late-bound languages “punt” this decision until runtime. While early-bound languages gain me benefits like compile-time type-safety, they also enforce rigid constraints on the design of your codeIn this way, code written in early-bound languages becomes more difficult to change.For more information on this “flexibility”, check out Duck Typing in Ruby.ConcurrentConcurrency is a topic that is very important to start addressing ASAP. The “concurrency problem” is already here, not 5 years from now, but today.Functional languages like F# are very powerful when it comes to addressing concurrencyThis power comes from the immutable-by-default approach when enables easier-to-parallelize code since assumptions can be made about the behavior of the code because of no shared-stateF# introduces a very powerful mechanism for achieving concurrency called Asynchronous Workflows (has nothing to do with Workflow Foundation workflows)Async Workflows use Parallel Extensions to the .NET Framework under-the-hoodFor shared-stated languages like C# and Visual Basic, concurrency features are primarily coming from library features like Parallel ExtensionsLanguage teams are thinking hard about how to possibly integrate concurrency into the core language (this is a hard space).
  • MESSAGING:F# is a functional programming language for the .NET Framework. It combines the succinct, expressive, and compositional style of functional programming with the runtime, libraries, interoperability, and object model of .NET. F# is included in Visual Studio 2010 and is now a first-class language just like Visual Basic, C#, and C++. F# is very good for compute-intensive problems, highly parallel problems, and language-oriented programming. Since F# just generates normal MSIL and .NET assemblies, you can develop a library in F# that does your computations, and call your F# code from your C# application.
  • MESSAGING:There are several trends in modern programming languages that we feel are important to address and capture with our programming language that we will continue to target. DeclarativeImperative languages focus heavily on the how.Programming logic is achieved via if statements, for loops, while loops, etc.Declarative languages focus on the whatTell the computer “what” you want done, and let it focus on how to get it done (so the language decides whether to achieve the goal via a for loop, foreach loop, recursion, etc.)Focusing on the what instead of the “how” is an important part of “stepping away from the compiler” and better expressing your true intent in code.DynamicAround dynamic languages, you often hear the comparison of dynamically-typed versus statically-typed languages.A better way to express this difference is thinking “late-bound” versus early-bound.Early-bound languages enforce calling conventions, matching contracts (method calls on specific types, for instance), at compile time. However, late-bound languages “punt” this decision until runtime. While early-bound languages gain me benefits like compile-time type-safety, they also enforce rigid constraints on the design of your codeIn this way, code written in early-bound languages becomes more difficult to change.For more information on this “flexibility”, check out Duck Typing in Ruby.ConcurrentConcurrency is a topic that is very important to start addressing ASAP. The “concurrency problem” is already here, not 5 years from now, but today.Functional languages like F# are very powerful when it comes to addressing concurrencyThis power comes from the immutable-by-default approach when enables easier-to-parallelize code since assumptions can be made about the behavior of the code because of no shared-stateF# introduces a very powerful mechanism for achieving concurrency called Asynchronous Workflows (has nothing to do with Workflow Foundation workflows)Async Workflows use Parallel Extensions to the .NET Framework under-the-hoodFor shared-stated languages like C# and Visual Basic, concurrency features are primarily coming from library features like Parallel ExtensionsLanguage teams are thinking hard about how to possibly integrate concurrency into the core language (this is a hard space).
  • MESSAGING:Late-Binding Support: The ability to do runtime call dispatch rather than being forced into compile-time verification. Named and Optional Parameters: This allows us to clean up our code as we can see. It also goes hand-in-hand with #3, Improved COM interop (bye-bye “ref MissingValue”)Improved COM Interop: Better interop with COM, along with easier deployment via Type Equivalent and embedding of types.Covariance and Contravariance: This is really about patching a problem in our generic type system as it exists today. Most developers won’t be using the generic variance features directly, they will simply be able to do stuff they couldn’t do before.
  • MESSAGING:The DLR provides core services that are necessary for dynamically-typed languages to work on the CLRThe DLR also provides other services that can be used by statically-typed languages as well to achieve more dynamic behavior:Expression Trees (including Statements)Dynamic DispatchCall Site Caching
  • MESSAGING:The power of the DLR is that there are many binders for the DLR. Yes, we can interop with dynamic languages like Python and Ruby like we expect to. However, perhaps even more importantly, there are binders available for .NET, Silverlight, and Office. This allows us to interact between these platforms in very powerful ways that we were unable to currently.
  • MESSAGING:There are several trends in modern programming languages that we feel are important to address and capture with our programming language that we will continue to target. DeclarativeImperative languages focus heavily on the how.Programming logic is achieved via if statements, for loops, while loops, etc.Declarative languages focus on the whatTell the computer “what” you want done, and let it focus on how to get it done (so the language decides whether to achieve the goal via a for loop, foreach loop, recursion, etc.)Focusing on the what instead of the “how” is an important part of “stepping away from the compiler” and better expressing your true intent in code.DynamicAround dynamic languages, you often hear the comparison of dynamically-typed versus statically-typed languages.A better way to express this difference is thinking “late-bound” versus early-bound.Early-bound languages enforce calling conventions, matching contracts (method calls on specific types, for instance), at compile time. However, late-bound languages “punt” this decision until runtime. While early-bound languages gain me benefits like compile-time type-safety, they also enforce rigid constraints on the design of your codeIn this way, code written in early-bound languages becomes more difficult to change.For more information on this “flexibility”, check out Duck Typing in Ruby.ConcurrentConcurrency is a topic that is very important to start addressing ASAP. The “concurrency problem” is already here, not 5 years from now, but today.Functional languages like F# are very powerful when it comes to addressing concurrencyThis power comes from the immutable-by-default approach when enables easier-to-parallelize code since assumptions can be made about the behavior of the code because of no shared-stateF# introduces a very powerful mechanism for achieving concurrency called Asynchronous Workflows (has nothing to do with Workflow Foundation workflows)Async Workflows use Parallel Extensions to the .NET Framework under-the-hoodFor shared-stated languages like C# and Visual Basic, concurrency features are primarily coming from library features like Parallel ExtensionsLanguage teams are thinking hard about how to possibly integrate concurrency into the core language (this is a hard space).

What’s New and Hot in .NET 4.0 Presentation Transcript

  • 1. What’s New & Hot in .NET 4.0?
    Jess Chadwick
    blog.jesschadwick.com
    twitter.com/jchadwick
  • 2. About Me (Only one is true)
    I invented the question mark.
    I have several published magazine articles
    I can swim the 100m breaststroke in under 1:30
  • 3. The boring credentials…
    Decade of development experience
    Recently turned independant consultant
    Speaker & User Group Leader
    Microsoft MVP (ASP.NET)
    ASPInsider
    Writer
    Blog: blog.jesschadwick.com
    Articles: in CoDe and DevConnections magazines
  • 4. What Is The .NET Framework?
    WPF
    Win Forms
    DLR
    ASP.NET
    WCF
    …and more!
    LINQ-to-SQL
    Base Class Libraries
    The CLR
    JIT & NGEN
    Garbage Collector
    Security Model
    Exception Handling
    Loader & Binder
  • 5. .NET 4.0 Overview: New & Updated
    CLR & Framework
    Platforms
    The CLR
    The Base Class Library
    Performance, Concurrency & Parallelization
    New Languages (F#, IronPython)
    Language Enhancements
    Dynamic Language Runtime
    Code Contracts
    Managed Extensibility Framework (MEF)
    Entity Framework
    WPF
    Windows Workflow
    ASP.NET
    ASP.NET MVC
    Web Forms
    ASP.NET AJAX
  • 6. .NET 4.0 Overview: New & Updated
    CLR & Framework
    Platforms
    The CLR
    The Base Class Library
    Performance, Concurrency &Parallelization
    New Languages
    Language Enhancements
    Dynamic Language Runtime
    Code Contracts
    Managed Extensibility Framework (MEF)
    Entity Framework
    WPF
    Windows Workflow
    ASP.NET
    ASP.NET MVC
    Web Forms
    ASP.NET AJAX
    ( Platform demos if we have time )
  • 7. .NET Framework Improvements
  • 8. The Goals of CLR 4
    Working Better Together…
    Faster…
    With Fewer Bugs…
    In-Proc SxS
    Managed Extensibility Framework
    Native/Managed Interop
    DLR Integration
    Threading
    Parallel Extensions
    Garbage Collection
    Profiling
    Code Contracts
    Debugging
    Corrupted State Exceptions
  • 9. Base Class Library Additions
    Numerics
    BigInteger
    Data Structures
    Tuple (newTuple<int,int,string>(1,2,”Test”))
    ISet<T> (SortedSet<T> & HashSet<T>)
    I/O
    Memory-Mapped File
  • 10. Performance, Concurrency, and Parallel Extensions
    Thread-safe collections (BlockingCollection<T>, ConcurrentDictionary<T>, etc.)
    Task Parallel Library (TPL)
    PLINQ
    Lazy Initializationeg: Lazy<IEnumerable<Order>> Orders { get; set;}
  • 11. Code Contracts
  • 12. Design By Contract
    Code Contracts provide a language-agnostic and declarative way to express coding assumptions in .NET programs.
  • 13. A Code Contract contains…
    Pre-conditions: must be true before
    public Rational(int numerator, int denominator)
    {
    Contract.Requires(denominator > 0);

    }
    Post-conditions: must be true after
    public string GetPassword()
    {
    Contract.Ensures(Contract.Result<string>() != null);

    return password;
    }
  • 14. A Code Contract contains…
    Invariants - must always be true
    [ContractInvariantMethod]
    protected void ObjectInvariant()
    {
    Contract.Invariant(denominator > 0);
    }
  • 15. Code Contracts
  • 16. Why are Contracts Useful?
    • Debugging
    • 17. Tooling!
    • 18. Pex (research.microsoft.com/projects/pex/)
  • Language Enhancements
    C#, Visual Basic, plus new Functional & Dynamic Languages
  • 19. New C# 4.0 Features
    Improved COM Inter-op
    Named and Optional Parameters
    Covariance and Contravariance
  • 20. New VB10 Features
    Auto-Implemented Properties
    Collection Initializers
    Statement Lambdas
    Implicit Line Continuation
    Covariance and Contravariance
  • 21. New VB10 Features
    Automatic Properties
    Collection Initializers
    Statement Lambdas
    Implicit Line Continuation
    Covariance and Contravariance
  • 22. Covariance & Contravariance
    “Fix” generics
  • 23. Covariance
    Describes the substitution of related types, such that the ordering from the more restrictive type to the less restrictive type is preserved
  • 24. Covariance
    Describes the substitution of related types, such that the ordering from the more restrictive type to the less restrictive type is preserved
    class Derived : Base { }
    IEnumerable<Derived> d = new List<Derived>();
    IEnumerable<Base> b = d;
  • 25. Contravariance
    Describes the substitution of related types, such that the ordering from the more restrictive type to the less restrictive type is reversed.
  • 26. Contravariance
    Describes the substitution of related types, such that the ordering from the more restrictive type to the less restrictive type is reversed.
    class Derived : Base { }
    public void DoSomething(Action<Derived> func);
    DoSomething((Base x) => x.Foo());
  • 27. New Language Features
  • 28. Emerging Language Trends
  • 29. Emerging Language Trends
  • 30. Introducing… F#!
    F# Is…
    • A functional programming language derived from OCaml and the ML family of languages
    • 31. Very good for computation-intensive problems, highly-parallel problems, and language-oriented programming
    • 32. A first-class .NET 4.0 language, with full Visual Studio 2010 support
  • Emerging Language Trends
  • 33. New C# 4.0 Features
    Improved COM Inter-op
    Named and Optional Parameters
    Covariance and Contravariance
    Late-binding support (via dynamic keyword)
    (Will show up in our demos coming up next!)
  • 34. Dynamic Language Runtime
  • 35. Why a “Dynamic Language Runtime”?
    Dynamically-Typed
    Ruby
    Python
    Statically-Typed
    VB
    Dynamic Language Runtime
    C#
    Common Language Runtime
  • 36. .NET Dynamic Programming
    IronPython
    IronRuby
    C#
    VB.NET
    …whatever!
    Dynamic Language Runtime
    Expression Trees
    Dynamic Dispatch
    Call Site Caching
    PythonBinder
    RubyBinder
    COMBinder
    JScriptBinder
    ObjectBinder
  • 37. Dynamic Language Runtime
  • 38. Emerging Language Trends
  • 39. Declarative Development
    ASP.NET Web Forms (ASPX)
    XAML (WPF & Silverlight)
    Code Contracts
    MEF!
  • 40. Managed Extensibility Framework (MEF)
  • 41. What is MEF?
    MEF is…
    A way to manage dependencies
    A way to provide extensibility in your apps
    A framework to encourage loose coupling and reusability
    A new addition to the Base Class Library
    System.ComponentModel.Composition
  • 42. What is MEF? (Simple Answer)
    Imports and Exports
  • 43. What is MEF? (Simple Answer)
    Imports and Exports
    of components(“parts”)
  • 44. What is MEF? (Complex Answer)
    Imports and Exports
    of components(“parts”)
    wired together via containers
  • 45. Implementing MEF…and, heck – everything else!
  • 46. What’s New in the Platforms?
    WPF, ASP.NET, Workflow, etc!
  • 47. Windows Presentation Framework (WPF)
  • 48. Lots of Good Stuff for WPF
    Multitouch
    Windows 7 taskbar
    Windows 7 ribbon
    Full Trust XBaps
    Cached compositions
    Textclarity
    Layout rounding
    ClickOnce improvements
    Focus mgt improvements
    Support for UIAccessible2
    VSM integration
    Media element improvements
    Client profile
    Data controls
    Accessibility improvements
    Control themes
    Chart controls
    … hundreds of good bug fixes too!
  • 49. Entity Framework
    It’s not just for databases anymore!
  • 50. EF4 Enhancements
    Model-First Development
    Persistence Ignorance (POCO support!)
    Application Patterns (Repository, Unit of Work, etc.)
    Customization of Queries & Generated Code
  • 51. Windows Workflow
  • 52. WF challenges today
    Limited support for XAML-only workflows
    Versioning is problematic
    Composition difficult or impossible
    Writing custom activities and managing data flow is not easy enough today
    Limited WCF integration and activity support
    No generic server host environment
    Bottom line: A high bar to get to enough value to make it worth the tax
  • 53. Moving towards .NET 4.0
    XAML-only workflows are the new default
    Unified model between WF, WCF, and WPF
    Extended base activity library
    Simplified WF programming model
    Support for arguments, variables, expressions
    Major improvements to WCF integration
    Runtime and designer improvements
    Hosting & management via "Dublin"
  • 54. Extended base activity library
    .NET 4.0 comes with several new activities
    Microsoft is planning to ship more activities via CodePlex
  • 55. New flow chart model
    Flowcharts offer a middle ground between the sequential and state machine models
    Simple step-by-step model,
    with decisions and switches
    Allows you to return to previous
    activities in the workflow
  • 56. Improving the Web
    ASP.NET MVC, Web Forms, and ASP.NET AJAX
  • 57. ASP.NET MVC
    v.2 “Officially” part of the framework
    New Features for v2:
    Areas
    Data Annotations support
    Templated Helpers
    Client-Side Validation
  • 58. Web Forms
    • Client ID manipulation
    • 59. Fine-Grained ViewState control
  • ASP.NET AJAX
    • Client-Side Templates
    • 60. Client-Side Data Controls (DataView & DataContext)
    • 61. Declarative Instantiation
    • 62. Command Bubbling
    • 63. Live Bindings
  • Questions?
    Please complete the online evaluation form
  • 64. Thank you!
    Resources
    • Visual Studio 2010:msdn.microsoft.com/en-us/vstudio
    • 65. MEF Homepage: mef.codeplex.com
    • 66. DLR Homepage: dlr.codeplex.com
    • 67. IronPython Homepage: ironpython.codeplex.com
    Contact Info
    Email: jesschadwick@gmail.com
    Blog: blog.jesschadwick.com
    Twitter: twitter.com/jchadwick